diff finch/gntconv.c @ 20552:b7460582a135

Fix #104 (Reconnect to network should reconnect chats also). This has been working OK in finch. I think it's going to work in Pidgin too. If you are in a chat when an account disconnects due to some error, then you will rejoin the chats when the account signs back on.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 19 Sep 2007 10:57:37 +0000
parents 6bf32c9e15a7
children bed3c9affda6
line wrap: on
line diff
--- a/finch/gntconv.c	Wed Sep 19 10:07:03 2007 +0000
+++ b/finch/gntconv.c	Wed Sep 19 10:57:37 2007 +0000
@@ -326,8 +326,8 @@
 		list = purple_get_chats();
 		while (list) {
 			PurpleConversation *conv = list->data;
-			gboolean del = FALSE;
 			PurpleChat *chat;
+			GHashTable *comps = NULL;
 
 			list = list->next;
 			if (conv->account != gc->account ||
@@ -336,15 +336,14 @@
 
 			chat = purple_blist_find_chat(conv->account, conv->name);
 			if (chat == NULL) {
-				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);
-				del = TRUE;
+					comps = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, conv->name);
+			} else {
+				comps = chat->components;
 			}
-			serv_join_chat(gc, chat->components);
-			if (del)
-				purple_blist_remove_chat(chat);
+			serv_join_chat(gc, comps);
+			if (chat == NULL && comps != NULL)
+				g_hash_table_destroy(comps);
 		}
 	}
 }