← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3169: equate message sending behavior between hubs & PMs

 

------------------------------------------------------------
revno: 3169
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Fri 2013-01-18 22:01:15 +0100
message:
  equate message sending behavior between hubs & PMs
modified:
  changelog.txt
  help/settings_appearance.html
  win32/AppearancePage.cpp
  win32/HubFrame.cpp
  win32/PrivateFrame.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-12-27 21:11:22 +0000
+++ changelog.txt	2013-01-18 21:01:15 +0000
@@ -13,6 +13,9 @@
 * [L#311818] Share file name duplicates due to case differences (poy)
 * [L#311818] Reject file lists that contain duplicate items (poy)
 * Drag & drop text into text input fields (poy)
+* [L#1096465] Add "user online" / "user offline" status lines to PMs (emtee, poy)
+* Apply "send unknown /commands" to PMs (poy)
+* Don't clear the message box when trying to send a message to a disconnected hub (poy)
 
 Note: The hash registry will be upgraded when running this version for the
 first time. Make sure all your drives are connected to avoid re-hashing.

=== modified file 'help/settings_appearance.html'
--- help/settings_appearance.html	2012-02-01 16:26:37 +0000
+++ help/settings_appearance.html	2013-01-18 21:01:15 +0000
@@ -25,7 +25,7 @@
   <dd cshelp="IDH_SETTINGS_APPEARANCE_TIME_STAMPS">When enabled, a string representing the current
   time (called "timestamp") will be prepended to every chat message. To customize the timestamp
   format, use the <a href="#timestamp_format">Timestamp format</a> option below.</dd>
-  <dt id="viewstatus">View status messages in main chat</dt>
+  <dt id="viewstatus">View status messages in chat</dt>
   <dd cshelp="IDH_SETTINGS_APPEARANCE_STATUS_IN_CHAT">Show some messages destined for the Status Bar in main chat as
 well. <i>It's generally a good idea to leave this enabled.</i></dd>
   <dt id="filterspam">Filter spam messages</dt>

=== modified file 'win32/AppearancePage.cpp'
--- win32/AppearancePage.cpp	2012-03-22 19:39:27 +0000
+++ win32/AppearancePage.cpp	2013-01-18 21:01:15 +0000
@@ -40,7 +40,7 @@
 	{ SettingsManager::MINIMIZE_TRAY, N_("Minimize to tray"), IDH_SETTINGS_APPEARANCE_MINIMIZE_TRAY },
 	{ SettingsManager::ALWAYS_TRAY, N_("Always display tray icon"), IDH_SETTINGS_APPEARANCE_ALWAYS_TRAY },
 	{ SettingsManager::TIME_STAMPS, N_("Show timestamps in chat by default"), IDH_SETTINGS_APPEARANCE_TIME_STAMPS },
-	{ SettingsManager::STATUS_IN_CHAT, N_("View status messages in main chat"), IDH_SETTINGS_APPEARANCE_STATUS_IN_CHAT },
+	{ SettingsManager::STATUS_IN_CHAT, N_("View status messages in chat"), IDH_SETTINGS_APPEARANCE_STATUS_IN_CHAT },
 	{ SettingsManager::FILTER_MESSAGES, N_("Filter spam messages"), IDH_SETTINGS_APPEARANCE_FILTER_MESSAGES },
 	{ SettingsManager::SHOW_JOINS, N_("Show joins / parts in chat by default"), IDH_SETTINGS_APPEARANCE_SHOW_JOINS },
 	{ SettingsManager::FAV_SHOW_JOINS, N_("Only show joins / parts for favorite users"), IDH_SETTINGS_APPEARANCE_FAV_SHOW_JOINS },

=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp	2012-11-05 20:39:11 +0000
+++ win32/HubFrame.cpp	2013-01-18 21:01:15 +0000
@@ -404,7 +404,10 @@
 }
 
 void HubFrame::enterImpl(const tstring& s) {
-	// Special command
+	bool resetText = true;
+	bool send = false;
+
+	// Process special commands
 	if(s[0] == _T('/')) {
 		tstring cmd = s;
 		tstring param;
@@ -414,7 +417,7 @@
 
 		if(PluginManager::getInstance()->onChatCommand(client, Text::fromT(s))) {
 			// Plugins, chat commands
-			message->setText(Util::emptyStringT);
+
 		} else if(WinUtil::checkCommand(cmd, param, msg, status, thirdPerson)) {
 			if(!msg.empty()) {
 				client->hubMessage(Text::fromT(msg), thirdPerson);
@@ -532,22 +535,34 @@
 					PrivateFrame::openWindow(getParent(), HintedUser(ui->getUser(), url), Util::emptyStringT);
 				}
 			}
+
+		} else if(SETTING(SEND_UNKNOWN_COMMANDS)) {
+			send = true;
 		} else {
-			if (SETTING(SEND_UNKNOWN_COMMANDS)) {
-				client->hubMessage(Text::fromT(s));
-			} else {
-				addStatus(str(TF_("Unknown command: %1%") % cmd));
-			}
+			addStatus(str(TF_("Unknown command: %1%") % cmd));
 		}
-		message->setText(_T(""));
+
 	} else if(waitingForPW) {
 		addStatus(T_("Don't remove /password before your password"));
 		message->setText(_T("/password "));
 		message->setFocus();
 		message->setSelection(10, 10);
+		resetText = false;
+
 	} else {
-		client->hubMessage(Text::fromT(s));
-		message->setText(_T(""));
+		send = true;
+	}
+
+	if(send) {
+		if(client->isConnected()) {
+			client->hubMessage(Text::fromT(s));
+		} else {
+			addStatus(T_("The message cannot be delivered because the hub is offline"));
+			resetText = false;
+		}
+	}
+	if(resetText) {
+		message->setText(Util::emptyStringT);
 	}
 }
 

=== modified file 'win32/PrivateFrame.cpp'
--- win32/PrivateFrame.cpp	2012-11-05 20:39:11 +0000
+++ win32/PrivateFrame.cpp	2013-01-18 21:01:15 +0000
@@ -273,6 +273,9 @@
 	setText(WinUtil::getNicks(cid, hint) + _T(" - ") + hubNames.first);
 	hubName = move(hubNames.first);
 
+	if(hubNames.second != online) {
+		addStatus(hubNames.second ? T_("User went online") : T_("User went offline"));
+	}
 	online = hubNames.second;
 	setIcon(online ? IDI_PRIVATE : IDI_PRIVATE_OFF);
 
@@ -311,6 +314,7 @@
 void PrivateFrame::enterImpl(const tstring& s) {
 	bool resetText = true;
 	bool send = false;
+
 	// Process special commands
 	if(s[0] == '/') {
 		tstring cmd = s;
@@ -321,8 +325,7 @@
 
 		if(PluginManager::getInstance()->onChatCommandPM(replyTo.getUser(), Text::fromT(s))) {
 			// Plugins, chat commands
-			resetText = true;
-			send = false;
+
 		} else if(WinUtil::checkCommand(cmd, param, message, status, thirdPerson)) {
 			if(!message.empty()) {
 				sendMessage(message, thirdPerson);
@@ -352,9 +355,13 @@
 			openLog();
 		} else if(Util::stricmp(cmd.c_str(), _T("help")) == 0) {
 			addChat(_T("*** ") + WinUtil::commands + _T(", /getlist, /grant, /close, /favorite, /ignore, /unignore, /log <system, downloads, uploads>"));
-		} else {
+
+		} else if(SETTING(SEND_UNKNOWN_COMMANDS)) {
 			send = true;
+		} else {
+			addStatus(str(TF_("Unknown command: %1%") % cmd));
 		}
+
 	} else {
 		send = true;
 	}
@@ -363,7 +370,7 @@
 		if(online) {
 			sendMessage(s);
 		} else {
-			addStatus(T_("User went offline"));
+			addStatus(T_("The message cannot be delivered because the user is offline"));
 			resetText = false;
 		}
 	}