← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2822: Make the away message optional

 

------------------------------------------------------------
revno: 2822
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2012-01-16 18:56:17 +0100
message:
  Make the away message optional
modified:
  changelog.txt
  dcpp/SettingsManager.cpp
  dcpp/Util.cpp
  dcpp/version.h
  help/settings_general.html
  win32/DCPlusPlus.rc
  win32/GeneralPage.cpp
  win32/PrivateFrame.cpp
  win32/WinUtil.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt	2012-01-15 16:08:29 +0000
+++ changelog.txt	2012-01-16 17:56:17 +0000
@@ -10,6 +10,7 @@
 * Propose a default nick using the Win user account name (poy)
 * [L#914457] Fix missing tab icons (poy)
 * Add a setting to enable away mode when Windows is locked (poy)
+* Make the away message optional (poy)
 
 -- 0.791 2012-01-14 --
 * Update translations

=== modified file 'dcpp/SettingsManager.cpp'
--- dcpp/SettingsManager.cpp	2012-01-15 16:08:29 +0000
+++ dcpp/SettingsManager.cpp	2012-01-16 17:56:17 +0000
@@ -206,7 +206,6 @@
 	setDefault(SFV_CHECK, true);
 	setDefault(AUTO_AWAY, false);
 	setDefault(AWAY_COMP_LOCK, false);
-	setDefault(DEFAULT_AWAY_MESSAGE, "I'm away. State your business and I might answer later if you're lucky.");
 	setDefault(TIME_STAMPS_FORMAT, "%H:%M");
 	setDefault(COUNTRY_FORMAT, "%[2code] - %[name]");
 	setDefault(MAX_COMPRESSION, 6);
@@ -454,6 +453,13 @@
 				Util::replace("FavUsers", "Users", strSettings[TOOLBAR - STR_FIRST]);
 		}
 
+		if(v <= 0.791) {
+			// the meaning of a default away message has changed: it now means "no away message".
+			if(SETTING(DEFAULT_AWAY_MESSAGE).empty()) {
+				set(DEFAULT_AWAY_MESSAGE, "I'm away. State your business and I might answer later if you're lucky.");
+			}
+		}
+
 		if(SETTING(SET_MINISLOT_SIZE) < 64)
 			set(SET_MINISLOT_SIZE, 64);
 		if(SETTING(AUTODROP_INTERVAL) < 1)

=== modified file 'dcpp/Util.cpp'
--- dcpp/Util.cpp	2012-01-15 16:08:29 +0000
+++ dcpp/Util.cpp	2012-01-16 17:56:17 +0000
@@ -496,7 +496,8 @@
 }
 
 string Util::getAwayMessage() {
-	return (formatTime(awayMsg.empty() ? SETTING(DEFAULT_AWAY_MESSAGE) : awayMsg, awayTime)) + " <" APPNAME " v" VERSIONSTRING ">";
+	const auto& msg = awayMsg.empty() ? SETTING(DEFAULT_AWAY_MESSAGE) : awayMsg;
+	return msg.empty() ? msg : formatTime(msg, awayTime) + " <" APPNAME " v" VERSIONSTRING ">";
 }
 
 string Util::formatBytes(int64_t aBytes) {
@@ -1043,7 +1044,6 @@
 		if(getAway()) {
 			awayTime = time(0);
 		}
-		printf("updating away!!!!!!!!!!! b = %d\n", getAway());
 		ClientManager::getInstance()->infoUpdated();
 	}
 }

=== modified file 'dcpp/version.h'
--- dcpp/version.h	2012-01-13 20:55:20 +0000
+++ dcpp/version.h	2012-01-16 17:56:17 +0000
@@ -21,8 +21,8 @@
 #define APPNAME "DC++"
 
 // don't forget to update the .rc file as well!
-#define VERSIONSTRING "0.790"
-#define VERSIONFLOAT 0.790
+#define VERSIONSTRING "0.7915"
+#define VERSIONFLOAT 0.7915
 
 namespace dcpp {
 extern const std::string fullVersionString;

=== modified file 'help/settings_general.html'
--- help/settings_general.html	2012-01-15 16:08:29 +0000
+++ help/settings_general.html	2012-01-16 17:56:17 +0000
@@ -41,12 +41,14 @@
 
 <dl style="margin-left: 40px;">
 
-	<dt id="awaymsg">Default away message</dt>
+	<dt id="awaymsg">Away message (empty = no away message)</dt>
 	<dd cshelp="IDH_SETTINGS_GENERAL_DEFAULT_AWAY_MESSAGE">
-	This is the default away message that will appear when someone PMs you for the first time while
-	you are in the away mode. All time formatting variables are available, see
-	<a href="settings_logs.html#timeformat">Logs</a>. Use Ctrl + Enter to create a new line. <br/>
-	(default: "I'm away. State your business and I might answer later if you're lucky.")
+	This defines the default away message. An away message is a message that is automatically sent
+	back as a response to private messages received by DC++ while it is in away mode. All time
+	formatting variables are available, see <a href="settings_logs.html#timeformat">Logs</a>. Use
+	Ctrl + Enter to create a new line. When this field is empty, no default away message is set.
+	Note that this default message can be overridden by specifying a custom message with the
+	<a href="chat_commands.html#awayback">/away &lt;message&gt; chat command</a>.
 	</dd>
 
 	<dt id="autoaway">Auto-away on minimize (and back on restore)</dt>

=== modified file 'win32/DCPlusPlus.rc'
--- win32/DCPlusPlus.rc	2012-01-13 20:55:20 +0000
+++ win32/DCPlusPlus.rc	2012-01-16 17:56:17 +0000
@@ -117,8 +117,8 @@
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,7,9,0
- PRODUCTVERSION 0,7,9,0
+ FILEVERSION 0,7,9,15
+ PRODUCTVERSION 0,7,9,15
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -135,12 +135,12 @@
         BEGIN
             VALUE "Comments", "http://dcplusplus.sourceforge.net";
             VALUE "FileDescription", "DC++"
-            VALUE "FileVersion", "0, 7, 9, 0"
+            VALUE "FileVersion", "0, 7, 9, 15"
             VALUE "InternalName", "DC++"
             VALUE "LegalCopyright", "Copyright 2001-2012 Jacek Sieka"
             VALUE "OriginalFilename", "DCPlusPlus.exe"
             VALUE "ProductName", "DC++"
-            VALUE "ProductVersion", "0, 7, 9, 0"
+            VALUE "ProductVersion", "0, 7, 9, 15"
         END
     END
     BLOCK "VarFileInfo"

=== modified file 'win32/GeneralPage.cpp'
--- win32/GeneralPage.cpp	2012-01-15 16:08:29 +0000
+++ win32/GeneralPage.cpp	2012-01-16 17:56:17 +0000
@@ -86,7 +86,7 @@
 		cur->setSpacing(grid->getSpacing());
 
 		{
-			group = cur->addChild(GroupBox::Seed(T_("Default away message")));
+			group = cur->addChild(GroupBox::Seed(T_("Away message (empty = no away message)")));
 			group->setHelpId(IDH_SETTINGS_GENERAL_DEFAULT_AWAY_MESSAGE);
 
 			auto seed = WinUtil::Seeds::Dialog::textBox;
@@ -112,9 +112,11 @@
 		// fill the Nick field with the Win user account name.
 		DWORD size = 0;
 		::GetUserName(0, &size);
-		tstring str(size - 1, 0);
-		if(::GetUserName(&str[0], &size)) {
-			nick->setText(str);
+		if(size > 1) {
+			tstring str(size - 1, 0);
+			if(::GetUserName(&str[0], &size)) {
+				nick->setText(str);
+			}
 		}
 	}
 

=== modified file 'win32/PrivateFrame.cpp'
--- win32/PrivateFrame.cpp	2012-01-13 20:55:20 +0000
+++ win32/PrivateFrame.cpp	2012-01-16 17:56:17 +0000
@@ -64,15 +64,22 @@
 		auto p = new PrivateFrame(parent, HintedUser(user, hubHint));
 		if(!BOOLSETTING(POPUNDER_PM))
 			p->activate();
+
 		p->addChat(aMessage);
-		if(Util::getAway()) {
-			if(!(BOOLSETTING(NO_AWAYMSG_TO_BOTS) && user->isSet(User::BOT)))
-				p->sendMessage(Text::toT(Util::getAwayMessage()));
+
+		if(Util::getAway() && !(BOOLSETTING(NO_AWAYMSG_TO_BOTS) && user->isSet(User::BOT))) {
+			auto awayMessage = Util::getAwayMessage();
+			if(!awayMessage.empty()) {
+				p->sendMessage(Text::toT(awayMessage));
+			}
 		}
+
 		WinUtil::notify(WinUtil::NOTIFICATION_PM_WINDOW, aMessage, [user] { activateWindow(user); });
+
 	} else {
 		i->second->addChat(aMessage);
 	}
+
 	WinUtil::notify(WinUtil::NOTIFICATION_PM, aMessage, [user] { activateWindow(user); });
 }
 

=== modified file 'win32/WinUtil.cpp'
--- win32/WinUtil.cpp	2012-01-15 16:08:29 +0000
+++ win32/WinUtil.cpp	2012-01-16 17:56:17 +0000
@@ -562,7 +562,8 @@
 		} else {
 			Util::setAway(true);
 			Util::setAwayMessage(Text::fromT(param));
-			status = str(TF_("Away mode on: %1%") % Text::toT(Util::getAwayMessage()));
+			auto awayMessage = Util::getAwayMessage();
+			status = str(TF_("Away mode on: %1%") % (awayMessage.empty() ? T_("No away message") : Text::toT(awayMessage)));
 		}
 	} else if(Util::stricmp(cmd.c_str(), _T("back")) == 0) {
 		Util::setAway(false);