changeset 11815:821f40e1912f

[gaim-migrate @ 14106] SF Patch #1336924 from sadrul 'From the wiki: "If you have a tab open for a given contact, and then drag an additional buddy into that contact, the send to menu does not update." This patch updates all the focused-conversations in every window (note that not all conversation in every tab). This wouldn't be necessary if it was possible to tell which contact a buddy was removed from. But that info is not available, so this is the way I can think of. It works, and will probably not cause too much overhead for most users -- assuming most of them use tabbed convs and hence number of windows won't be too great.' To track which contact was updated would be problematic, I think. This doesn't seem like too much overhead to me and it keeps the code clean. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 25 Oct 2005 13:56:14 +0000
parents fa17fc619f17
children 60fcaea41fc0
files src/gtkconv.c
diffstat 1 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkconv.c	Tue Oct 25 13:29:28 2005 +0000
+++ b/src/gtkconv.c	Tue Oct 25 13:56:14 2005 +0000
@@ -3800,6 +3800,26 @@
 	return NULL;
 }
 
+static void
+buddy_update_cb(GaimBlistNode *bnode)
+{
+	GList *list;
+
+	g_return_if_fail(bnode);
+	g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(bnode));
+
+	for (list = gaim_gtk_conv_windows_get_list(); list; list = list->next)
+	{
+		GaimGtkWindow *win = list->data;
+		GaimConversation *conv = gaim_gtk_conv_window_get_active_conversation(win);
+
+		if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM)
+			continue;
+
+		gaim_conversation_update(conv, GAIM_CONV_ACCOUNT_ONLINE);
+	}
+}
+
 /**************************************************************************
  * Conversation UI operations
  **************************************************************************/
@@ -3897,6 +3917,14 @@
 	                         G_CALLBACK(gtk_widget_grab_focus),
 	                         gtkconv->entry);
 
+	if (conv_type == GAIM_CONV_TYPE_IM)
+	{
+		gaim_signal_connect(gaim_blist_get_handle(), "buddy-added", gtkconv,
+							G_CALLBACK(buddy_update_cb), conv);
+		gaim_signal_connect(gaim_blist_get_handle(), "buddy-removed", gtkconv,
+							G_CALLBACK(buddy_update_cb), conv);
+	}
+
 	gaim_gtkconv_placement_place(gtkconv);
 }