--- a/finch/gntconn.c Sat Sep 15 08:22:15 2007 +0000
+++ b/finch/gntconn.c Sat Sep 15 09:53:30 2007 +0000
@@ -104,10 +104,11 @@
PurpleAccount *account = purple_connection_get_account(gc);
- info = g_hash_table_lookup(hash, account);
+ info = g_hash_table_lookup(hash, account); info = g_new0(FinchAutoRecon, 1);
g_hash_table_insert(hash, account, info);
@@ -140,6 +141,17 @@
purple_account_set_enabled(account, FINCH_UI, FALSE);
+ /* If we have any open chats, we probably want to rejoin when we get back online. */ + list = purple_get_chats(); + PurpleConversation *conv = list->data; + if (conv->account != account || + purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) + purple_conversation_set_data(conv, "want-to-rejoin", GINT_TO_POINTER(TRUE)); --- a/finch/gntconv.c Sat Sep 15 08:22:15 2007 +0000
+++ b/finch/gntconv.c Sat Sep 15 09:53:30 2007 +0000
@@ -310,13 +310,41 @@
account_signed_on_off(PurpleConnection *gc, gpointer null)
- GList *ims = purple_get_ims();
- PurpleConversation *conv = ims->data;
+ GList *list = purple_get_ims(); + PurpleConversation *conv = list->data; PurpleConversation *cc = find_conv_with_contact(conv->account, conv->name);
generate_send_to_menu(cc->ui_data);
+ if (PURPLE_CONNECTION_IS_CONNECTED(gc)) { + /* We just signed on. Let's see if there's any chat that we have open, + * and hadn't left before the disconnect. */ + list = purple_get_chats(); + PurpleConversation *conv = list->data; + if (conv->account != gc->account || + !purple_conversation_get_data(conv, "want-to-rejoin")) + chat = purple_blist_find_chat(conv->account, conv->name); + GHashTable *hash = NULL; + if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL) + hash = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, conv->name); + chat = purple_chat_new(gc->account, conv->name, hash); + serv_join_chat(gc, chat->components); + purple_blist_remove_chat(chat);