diff src/gtksound.c @ 12850:49b2347863b2

[gaim-migrate @ 15200] SF Patch #1403151 from charkins "This patch prevents two cases for "sonic avalanche" in the sound code. The first is to only play sounds in response to the chat-buddy-joined signal when the new_arrival flag is set." "The second case has to do with jabber pre-filling chat history when a chat is joined. The GAIM_MESSAGE_DELAYED flag is used on these messages, so sound are not played when this flag is set on received messages." "I also fixed sound_playing_event_cb() in signals-test.c which was assuming account!=NULL, which in turn was throwing an assertion error when gaim_account_get_username() was called." committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Thu, 12 Jan 2006 06:59:39 +0000
parents 09ac562f0813
children 33935a6320b8
line wrap: on
line diff
--- a/src/gtksound.c	Thu Jan 12 06:44:23 2006 +0000
+++ b/src/gtksound.c	Thu Jan 12 06:59:39 2006 +0000
@@ -148,6 +148,9 @@
 				   char *message, GaimConversation *conv,
 				   int flags, GaimSoundEventID event)
 {
+	if (flags & GAIM_MESSAGE_DELAYED)
+		return;
+
 	if (conv==NULL)
 		gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE, account);
 	else
@@ -165,9 +168,10 @@
 
 static void
 chat_buddy_join_cb(GaimConversation *conv, const char *name,
-				   GaimConvChatBuddyFlags flags, GaimSoundEventID event)
+				   GaimConvChatBuddyFlags flags, gboolean new_arrival,
+				   GaimSoundEventID event)
 {
-	if (!chat_nick_matches_name(conv, name))
+	if (new_arrival && !chat_nick_matches_name(conv, name))
 		play_conv_event(conv, event);
 }
 
@@ -199,6 +203,9 @@
 {
 	GaimConvChat *chat;
 
+	if (flags & GAIM_MESSAGE_DELAYED)
+		return;
+
 	chat = gaim_conversation_get_chat_data(conv);
 
 	if (chat!=NULL && gaim_conv_chat_is_user_ignored(chat, sender))