# HG changeset patch # User Nathan Walp # Date 1073257661 0 # Node ID 38df71d58500b29e36fc78e06e8dbe6a27901f7c # Parent 5e193b3a2342bbf4e463fc63ec4558949e0086f7 [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 diff -r 5e193b3a2342 -r 38df71d58500 src/blist.c --- a/src/blist.c Sun Jan 04 22:26:40 2004 +0000 +++ b/src/blist.c Sun Jan 04 23:07:41 2004 +0000 @@ -1346,18 +1346,21 @@ if(!gaim_account_is_connected(account)) return NULL; + prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); + + if(prpl_info->find_blist_chat != NULL) + return prpl_info->find_blist_chat(account, name); + for (group = gaimbuddylist->root; group != NULL; group = group->next) { for (node = group->child; node != NULL; node = node->next) { if (GAIM_BLIST_NODE_IS_CHAT(node)) { chat = (GaimChat*)node; - if(!gaim_account_is_connected(chat->account)) + if(account != chat->account) continue; - prpl = gaim_find_prpl(gaim_account_get_protocol_id(chat->account)); - prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); - parts = prpl_info->chat_info( gaim_account_get_connection(chat->account)); diff -r 5e193b3a2342 -r 38df71d58500 src/protocols/jabber/jabber.c --- 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 = diff -r 5e193b3a2342 -r 38df71d58500 src/prpl.h --- a/src/prpl.h Sun Jan 04 22:26:40 2004 +0000 +++ b/src/prpl.h Sun Jan 04 23:07:41 2004 +0000 @@ -314,6 +314,8 @@ char *(*get_cb_real_name)(GaimConnection *gc, int id, const char *who); void (*set_chat_topic)(GaimConnection *gc, int id, const char *topic); + + GaimChat *(*find_blist_chat)(GaimAccount *account, const char *name); }; #define GAIM_IS_PROTOCOL_PLUGIN(plugin) \