diff src/protocols/jabber/jabber.c @ 7999:38df71d58500

[gaim-migrate @ 8676] this fixes the add/remove button showing up incorrectly for jabber chat rooms when you add or remove a chat, the button doesn't automagically update in the chat window. i'm too hungry to figure that out right now, so someone else should do it. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 04 Jan 2004 23:07:41 +0000
parents 6fca0d9cc98b
children c4b5a35c7a12
line wrap: on
line diff
--- a/src/protocols/jabber/jabber.c	Sun Jan 04 22:26:40 2004 +0000
+++ b/src/protocols/jabber/jabber.c	Sun Jan 04 23:07:41 2004 +0000
@@ -1081,6 +1081,39 @@
 	return m;
 }
 
+static GaimChat *jabber_find_blist_chat(GaimAccount *account, const char *name)
+{
+	GaimBlistNode *gnode, *cnode;
+	JabberID *jid;
+
+	if(!(jid = jabber_id_new(name)))
+		return NULL;
+
+	for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
+		for(cnode = gnode->child; cnode; cnode = cnode->next) {
+			GaimChat *chat = (GaimChat*)cnode;
+			const char *room, *server;
+			if(!GAIM_BLIST_NODE_IS_CHAT(cnode))
+				continue;
+
+			if(chat->account != account)
+				return;
+
+			if(!(room = g_hash_table_lookup(chat->components, "room")))
+				continue;
+			if(!(server = g_hash_table_lookup(chat->components, "server")))
+				continue;
+
+			if(!g_utf8_collate(room, jid->node) && !g_utf8_collate(server, jid->domain)) {
+				jabber_id_free(jid);
+				return chat;
+			}
+		}
+	}
+	jabber_id_free(jid);
+	return NULL;
+}
+
 static GaimPluginProtocolInfo prpl_info =
 {
 	OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME,
@@ -1135,7 +1168,8 @@
 	NULL, /* set_buddy_icon */
 	NULL, /* remove_group */
 	jabber_chat_buddy_real_name,
-	jabber_chat_set_topic
+	jabber_chat_set_topic,
+	jabber_find_blist_chat
 };
 
 static GaimPluginInfo info =