# HG changeset patch # User Sadrul Habib Chowdhury # Date 1165894249 0 # Node ID 4b500bd49d389d882eccc60a7f56856fafa6b9fa # Parent 6c43dbf293ad7bda14877e41ea06c7ca68f674e8 [gaim-migrate @ 17967] Fix auto-joining chatrooms. You don't need to keep the buddylist open for autojoins to work. committer: Tailor Script diff -r 6c43dbf293ad -r 4b500bd49d38 console/gntblist.c --- a/console/gntblist.c Tue Dec 12 01:06:42 2006 +0000 +++ b/console/gntblist.c Tue Dec 12 03:30:49 2006 +0000 @@ -109,6 +109,7 @@ static void savedstatus_changed(GaimSavedStatus *now, GaimSavedStatus *old); static void blist_show(GaimBuddyList *list); static void update_buddy_display(GaimBuddy *buddy, GGBlist *ggblist); +static void account_signed_on_cb(); /* Sort functions */ static int blist_node_compare_text(GaimBlistNode *n1, GaimBlistNode *n2); @@ -515,11 +516,6 @@ node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), chat, gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), group, NULL); - - /* XXX: This causes problem because you can close a chat window, hide the buddylist. - * When you show the buddylist, you automatically join the chat again. */ - if (gaim_blist_node_get_bool((GaimBlistNode*)chat, "gnt-autojoin")) - serv_join_chat(gaim_account_get_connection(chat->account), chat->components); } static void @@ -1587,6 +1583,8 @@ gaim_prefs_connect_callback(gg_blist_get_handle(), PREF_ROOT "/sort_type", redraw_blist, NULL); + gaim_signal_connect(gaim_connections_get_handle(), "signed-on", gaim_blist_get_handle(), + G_CALLBACK(account_signed_on_cb), NULL); return; } @@ -1945,6 +1943,21 @@ } } +static void +account_signed_on_cb() +{ + GaimBlistNode *node; + + for (node = gaim_blist_get_root(); node; + node = gaim_blist_node_next(node, FALSE)) { + if (GAIM_BLIST_NODE_IS_CHAT(node)) { + GaimChat *chat = (GaimChat*)node; + if (gaim_blist_node_get_bool(node, "gnt-autojoin")) + serv_join_chat(gaim_account_get_connection(chat->account), chat->components); + } + } +} + static void show_offline_cb(GntMenuItem *item, gpointer n) { gaim_prefs_set_bool(PREF_ROOT "/showoffline",