changeset 9846:c28d5b45624e

[gaim-migrate @ 10724] A patch from Nathan Fredrickson that should make Gaim not play sounds for people joining chats when you join chat. Um, his explanation is better: http://sourceforge.net/tracker/index.php?func=detail&aid=1008904&group_id=235&atid=300235 committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 24 Aug 2004 04:12:28 +0000
parents 7c459857f1c2
children ab097ff50f5b
files plugins/ChangeLog.API src/conversation.c src/conversation.h src/gtkconv.c src/protocols/irc/msgs.c src/protocols/jabber/presence.c src/protocols/msn/msn.c src/protocols/msn/switchboard.c src/protocols/napster/napster.c src/protocols/novell/novell.c src/protocols/oscar/oscar.c src/protocols/silc/ops.c src/protocols/toc/toc.c src/protocols/yahoo/yahoochat.c src/protocols/yahoo/ycht.c src/protocols/zephyr/zephyr.c
diffstat 16 files changed, 37 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/ChangeLog.API	Tue Aug 24 01:26:54 2004 +0000
+++ b/plugins/ChangeLog.API	Tue Aug 24 04:12:28 2004 +0000
@@ -38,6 +38,9 @@
 	* Added: conversation-updated for any update to the data associated
 	  with the conversation (topic, icon, adding to buddy list, etc.)
 
+	Conversation API:
+	* Changed: gaim_conv_chat_add_user() (added new_arrival parameter)
+
 version 0.81 (08/05/2004):
 	Commands API:
 	* Most functions now have a void *data argument.
--- a/src/conversation.c	Tue Aug 24 01:26:54 2004 +0000
+++ b/src/conversation.c	Tue Aug 24 04:12:28 2004 +0000
@@ -1923,7 +1923,7 @@
 
 void
 gaim_conv_chat_add_user(GaimConvChat *chat, const char *user, const char *extra_msg,
-						GaimConvChatBuddyFlags flags)
+						GaimConvChatBuddyFlags flags, gboolean new_arrival)
 {
 	GaimConversation *conv;
 	GaimConversationUiOps *ops;
@@ -1946,9 +1946,9 @@
 		g_list_append(gaim_conv_chat_get_users(chat), cb));
 
 	if (ops != NULL && ops->chat_add_user != NULL)
-		ops->chat_add_user(conv, user);
-
-	if (!quiet) {
+		ops->chat_add_user(conv, user, new_arrival);
+
+	if (!quiet && new_arrival) {
 		if (extra_msg == NULL)
 			g_snprintf(tmp, sizeof(tmp), _("%s entered the room."), user);
 		else
--- a/src/conversation.h	Tue Aug 24 01:26:54 2004 +0000
+++ b/src/conversation.h	Tue Aug 24 04:12:28 2004 +0000
@@ -183,7 +183,7 @@
 	                   const char *message, GaimMessageFlags flags,
 	                   time_t mtime);
 
-	void (*chat_add_user)(GaimConversation *conv, const char *user);
+	void (*chat_add_user)(GaimConversation *conv, const char *user, gboolean new_arrival);
 	void (*chat_add_users)(GaimConversation *conv, GList *users);
 	void (*chat_rename_user)(GaimConversation *conv,
 	                         const char *old_name, const char *new_name);
@@ -1192,7 +1192,8 @@
  * @param flags     The users flags
  */
 void gaim_conv_chat_add_user(GaimConvChat *chat, const char *user,
-							 const char *extra_msg, GaimConvChatBuddyFlags flags);
+							 const char *extra_msg, GaimConvChatBuddyFlags flags,
+							 gboolean new_arrival);
 
 /**
  * Adds a list of users to a chat.
--- a/src/gtkconv.c	Tue Aug 24 01:26:54 2004 +0000
+++ b/src/gtkconv.c	Tue Aug 24 04:12:28 2004 +0000
@@ -5184,7 +5184,7 @@
 }
 
 static void
-gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user)
+gaim_gtkconv_chat_add_user(GaimConversation *conv, const char *user, gboolean new_arrival)
 {
 	GaimConvChat *chat;
 	GaimGtkConversation *gtkconv;
@@ -5205,7 +5205,7 @@
 
 	gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp);
 
-	if (gtkconv->make_sound)
+	if (gtkconv->make_sound && new_arrival)
 		gaim_sound_play_event(GAIM_SOUND_CHAT_JOIN);
 
 	add_chat_buddy_common(conv, user);
--- a/src/protocols/irc/msgs.c	Tue Aug 24 01:26:54 2004 +0000
+++ b/src/protocols/irc/msgs.c	Tue Aug 24 04:12:28 2004 +0000
@@ -593,7 +593,7 @@
 	}
 
 	userhost = irc_mask_userhost(from);
-	gaim_conv_chat_add_user(GAIM_CONV_CHAT(convo), nick, userhost, GAIM_CBFLAGS_NONE);
+	gaim_conv_chat_add_user(GAIM_CONV_CHAT(convo), nick, userhost, GAIM_CBFLAGS_NONE, TRUE);
 
 	if ((ib = g_hash_table_lookup(irc->buddies, nick)) != NULL) {
 		ib->flag = TRUE;
--- a/src/protocols/jabber/presence.c	Tue Aug 24 01:26:54 2004 +0000
+++ b/src/protocols/jabber/presence.c	Tue Aug 24 04:12:28 2004 +0000
@@ -207,6 +207,7 @@
 	JabberBuddy *jb;
 	JabberBuddyResource *jbr = NULL;
 	GaimConvChatBuddyFlags flags = GAIM_CBFLAGS_NONE;
+	gboolean delayed = FALSE;
 	GaimBuddy *b;
 	char *buddy_name;
 	int state = 0;
@@ -272,7 +273,9 @@
 			}
 		} else if(!strcmp(y->name, "x")) {
 			const char *xmlns = xmlnode_get_attrib(y, "xmlns");
-			if(xmlns && !strcmp(xmlns, "http://jabber.org/protocol/muc#user")) {
+			if(xmlns && !strcmp(xmlns, "jabber:x:delay")) {
+				delayed = TRUE;
+			} else if(xmlns && !strcmp(xmlns, "http://jabber.org/protocol/muc#user")) {
 				xmlnode *z;
 
 				muc = TRUE;
@@ -413,7 +416,7 @@
 
 			if(!jabber_chat_find_buddy(chat->conv, jid->resource))
 				gaim_conv_chat_add_user(GAIM_CONV_CHAT(chat->conv), jid->resource,
-						real_jid, flags);
+						real_jid, flags, !delayed);
 			else
 				gaim_conv_chat_user_set_flags(GAIM_CONV_CHAT(chat->conv), jid->resource,
 						flags);
--- a/src/protocols/msn/msn.c	Tue Aug 24 01:26:54 2004 +0000
+++ b/src/protocols/msn/msn.c	Tue Aug 24 04:12:28 2004 +0000
@@ -340,7 +340,7 @@
 	swboard->conv = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat");
 
 	gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->conv),
-							gaim_account_get_username(buddy->account), NULL, GAIM_CBFLAGS_NONE);
+							gaim_account_get_username(buddy->account), NULL, GAIM_CBFLAGS_NONE, TRUE);
 }
 
 static void
--- a/src/protocols/msn/switchboard.c	Tue Aug 24 01:26:54 2004 +0000
+++ b/src/protocols/msn/switchboard.c	Tue Aug 24 04:12:28 2004 +0000
@@ -68,7 +68,7 @@
 
 	if ((swboard->conv != NULL) && (gaim_conversation_get_type(swboard->conv) == GAIM_CONV_CHAT))
 	{
-		gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->conv), user, NULL, GAIM_CBFLAGS_NONE);
+		gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->conv), user, NULL, GAIM_CBFLAGS_NONE, TRUE);
 	}
 	else if (swboard->current_users > 1 || swboard->total_users > 1)
 	{
@@ -99,14 +99,14 @@
 				 * tmp_user); */
 
 				gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->conv),
-										tmp_user, NULL, GAIM_CBFLAGS_NONE);
+										tmp_user, NULL, GAIM_CBFLAGS_NONE, TRUE);
 			}
 
 			/* gaim_debug_info("msn", "[chat] We add ourselves.\n"); */
 
 			gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->conv),
 									gaim_account_get_username(account),
-									NULL, GAIM_CBFLAGS_NONE);
+									NULL, GAIM_CBFLAGS_NONE, TRUE);
 
 			g_free(swboard->im_user);
 			swboard->im_user = NULL;
--- a/src/protocols/napster/napster.c	Tue Aug 24 01:26:54 2004 +0000
+++ b/src/protocols/napster/napster.c	Tue Aug 24 04:12:28 2004 +0000
@@ -364,7 +364,7 @@
 	case 408: /* MSG_SERVER_CHANNEL_USER_LIST */
 		res = g_strsplit(buf, " ", 4);
 		c = nap_find_chat(gc, res[0]);
-		gaim_conv_chat_add_user(GAIM_CONV_CHAT(c), res[1], NULL, GAIM_CBFLAGS_NONE);
+		gaim_conv_chat_add_user(GAIM_CONV_CHAT(c), res[1], NULL, GAIM_CBFLAGS_NONE, TRUE);
 		g_strfreev(res);
 		break;
 
--- a/src/protocols/novell/novell.c	Tue Aug 24 01:26:54 2004 +0000
+++ b/src/protocols/novell/novell.c	Tue Aug 24 04:12:28 2004 +0000
@@ -652,7 +652,8 @@
 				ur = nm_conference_get_participant(conference, i);
 				if (ur) {
 					name = nm_user_record_get_display_id(ur);
-					gaim_conv_chat_add_user(GAIM_CONV_CHAT(chat), name, NULL, GAIM_CBFLAGS_NONE);
+					gaim_conv_chat_add_user(GAIM_CONV_CHAT(chat), name, NULL, 
+											GAIM_CBFLAGS_NONE, TRUE);
 				}
 			}
 		}
@@ -1921,7 +1922,8 @@
 					nm_conference_set_data(conference, (gpointer) chat);
 
 					name = nm_user_record_get_display_id(ur);
-					gaim_conv_chat_add_user(GAIM_CONV_CHAT(chat), name, NULL, GAIM_CBFLAGS_NONE);
+					gaim_conv_chat_add_user(GAIM_CONV_CHAT(chat), name, NULL, 
+											GAIM_CBFLAGS_NONE, TRUE);
 
 				}
 			}
@@ -1932,7 +1934,8 @@
 			if (ur) {
 				name = nm_user_record_get_display_id(ur);
 				if (!gaim_conv_chat_find_user(GAIM_CONV_CHAT(chat), name)) {
-					gaim_conv_chat_add_user(GAIM_CONV_CHAT(chat), name, NULL, GAIM_CBFLAGS_NONE);
+					gaim_conv_chat_add_user(GAIM_CONV_CHAT(chat), name, NULL, 
+											GAIM_CBFLAGS_NONE, TRUE);
 				}
 			}
 		}
--- a/src/protocols/oscar/oscar.c	Tue Aug 24 01:26:54 2004 +0000
+++ b/src/protocols/oscar/oscar.c	Tue Aug 24 04:12:28 2004 +0000
@@ -4305,7 +4305,7 @@
 		return 1;
 
 	for (i = 0; i < count; i++)
-		gaim_conv_chat_add_user(GAIM_CONV_CHAT(c->conv), info[i].sn, NULL, GAIM_CBFLAGS_NONE);
+		gaim_conv_chat_add_user(GAIM_CONV_CHAT(c->conv), info[i].sn, NULL, GAIM_CBFLAGS_NONE, TRUE);
 
 	return 1;
 }
--- a/src/protocols/silc/ops.c	Tue Aug 24 01:26:54 2004 +0000
+++ b/src/protocols/silc/ops.c	Tue Aug 24 04:12:28 2004 +0000
@@ -272,7 +272,7 @@
 		g_snprintf(buf, sizeof(buf), "%s@%s",
 			   client_entry->username, client_entry->hostname);
 		gaim_conv_chat_add_user(GAIM_CONV_CHAT(convo),
-					g_strdup(client_entry->nickname), buf, GAIM_CBFLAGS_NONE);
+					g_strdup(client_entry->nickname), buf, GAIM_CBFLAGS_NONE, TRUE);
 
 		break;
 
--- a/src/protocols/toc/toc.c	Tue Aug 24 01:26:54 2004 +0000
+++ b/src/protocols/toc/toc.c	Tue Aug 24 04:12:28 2004 +0000
@@ -830,7 +830,7 @@
 
 		if (in && (*in == 'T'))
 			while ((buddy = strtok(NULL, ":")) != NULL)
-				gaim_conv_chat_add_user(chat, buddy, NULL, GAIM_CBFLAGS_NONE);
+				gaim_conv_chat_add_user(chat, buddy, NULL, GAIM_CBFLAGS_NONE, TRUE);
 		else
 			while ((buddy = strtok(NULL, ":")) != NULL)
 				gaim_conv_chat_remove_user(chat, buddy, NULL);
--- a/src/protocols/yahoo/yahoochat.c	Tue Aug 24 01:26:54 2004 +0000
+++ b/src/protocols/yahoo/yahoochat.c	Tue Aug 24 04:12:28 2004 +0000
@@ -76,7 +76,7 @@
 	for (i = newusers; i; i = i->next) {
 		if (gaim_conv_chat_find_user(chat, i->data))
 			continue;
-		gaim_conv_chat_add_user(chat, i->data, NULL, GAIM_CBFLAGS_NONE);
+		gaim_conv_chat_add_user(chat, i->data, NULL, GAIM_CBFLAGS_NONE, TRUE);
 	}
 }
 
@@ -85,7 +85,7 @@
 	if (gaim_conv_chat_find_user(chat, user))
 		return;
 
-	gaim_conv_chat_add_user(chat, user, reason, GAIM_CBFLAGS_NONE);
+	gaim_conv_chat_add_user(chat, user, reason, GAIM_CBFLAGS_NONE, TRUE);
 }
 
 static GaimConversation *yahoo_find_conference(GaimConnection *gc, const char *name)
@@ -663,7 +663,7 @@
 			if (!strcmp(memarr[i], "") || !strcmp(memarr[i], dn))
 					continue;
 			yahoo_packet_hash(pkt, 3, memarr[i]);
-			gaim_conv_chat_add_user(GAIM_CONV_CHAT(c), memarr[i], NULL, GAIM_CBFLAGS_NONE);
+			gaim_conv_chat_add_user(GAIM_CONV_CHAT(c), memarr[i], NULL, GAIM_CBFLAGS_NONE, TRUE);
 		}
 	}
 	yahoo_send_packet(yd, pkt);
--- a/src/protocols/yahoo/ycht.c	Tue Aug 24 01:26:54 2004 +0000
+++ b/src/protocols/yahoo/ycht.c	Tue Aug 24 04:12:28 2004 +0000
@@ -118,7 +118,7 @@
 		if (new_room) {
 			/*if (!strcmp(members[i], gaim_connection_get_display_name(ycht->gc)))
 				continue;*/
-			gaim_conv_chat_add_user(GAIM_CONV_CHAT(c), members[i], NULL, GAIM_CBFLAGS_NONE);
+			gaim_conv_chat_add_user(GAIM_CONV_CHAT(c), members[i], NULL, GAIM_CBFLAGS_NONE, TRUE);
 		} else {
 			yahoo_chat_add_user(GAIM_CONV_CHAT(c), members[i], NULL);
 		}
--- a/src/protocols/zephyr/zephyr.c	Tue Aug 24 01:26:54 2004 +0000
+++ b/src/protocols/zephyr/zephyr.c	Tue Aug 24 04:12:28 2004 +0000
@@ -736,7 +736,7 @@
                                                                         (unsigned char)addrs[1], (unsigned char)addrs[2], 
                                                                         (unsigned char) addrs[3]);
                                         
-                                        gaim_conv_chat_add_user(gcc, sendertmp, ipaddr, GAIM_CBFLAGS_NONE);
+                                        gaim_conv_chat_add_user(gcc, sendertmp, ipaddr, GAIM_CBFLAGS_NONE, TRUE);
                                         g_free(ipaddr); /* fix memory leak? */
                                         
                                 }