← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/feature-loudylobby into lp:widelands

 

Teppo Mäenpää has proposed merging lp:~widelands-dev/widelands/feature-loudylobby into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1278026 in widelands: "Waiting for participants in the metaserver lobby is not fun."
  https://bugs.launchpad.net/widelands/+bug/1278026

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/feature-loudylobby/+merge/213784

This silences the IRC messages at lobby. Messages still appear, just the sound goes away.
More about the bridge at https://wl.widelands.org/forum/topic/1468/

Good:
- Very simple change. Improves the use experience in my opinion.

Bad:
- Hard-coded string constants are ugly.
-- 
https://code.launchpad.net/~widelands-dev/widelands/feature-loudylobby/+merge/213784
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/feature-loudylobby into lp:widelands.
=== modified file 'src/wui/gamechatpanel.cc'
--- src/wui/gamechatpanel.cc	2014-03-30 14:05:24 +0000
+++ src/wui/gamechatpanel.cc	2014-04-02 09:03:50 +0000
@@ -65,15 +65,21 @@
 	chatbox.set_text(str);
 
 	// If there are new messages, play a sound
-	if (msgs.size() > chat_message_counter)
+	if (msgs.size() != chat_message_counter)
 	{
 		// computer generated ones are ignored
 		// Note: if many messages arrive simultaneously,
 		// the latest is a system message and some others
 		// are not, then this act wrong!
 		if (!msgs.back().sender.empty() && !m_chat.sound_off())
+		{
 			// The latest message is not a system message
-			play_new_chat_message();
+			if (std::string::npos == msgs.back().sender.find("(IRC)"))
+				// The latest message was not relayed from IRC.
+				// The above built-in string constant should match
+				// that of the IRC bridge.
+				play_new_chat_message();
+		}
 		chat_message_counter = msgs . size();
 
 	}


Follow ups