| 103 static void |
103 static void |
| 104 finch_connection_report_disconnect(PurpleConnection *gc, const char *text) |
104 finch_connection_report_disconnect(PurpleConnection *gc, const char *text) |
| 105 { |
105 { |
| 106 FinchAutoRecon *info; |
106 FinchAutoRecon *info; |
| 107 PurpleAccount *account = purple_connection_get_account(gc); |
107 PurpleAccount *account = purple_connection_get_account(gc); |
| 108 |
108 GList *list; |
| 109 info = g_hash_table_lookup(hash, account); |
|
| 110 |
109 |
| 111 if (!gc->wants_to_die) { |
110 if (!gc->wants_to_die) { |
| |
111 info = g_hash_table_lookup(hash, account); |
| |
112 |
| 112 if (info == NULL) { |
113 if (info == NULL) { |
| 113 info = g_new0(FinchAutoRecon, 1); |
114 info = g_new0(FinchAutoRecon, 1); |
| 114 g_hash_table_insert(hash, account, info); |
115 g_hash_table_insert(hash, account, info); |
| 115 info->delay = g_random_int_range(INITIAL_RECON_DELAY_MIN, INITIAL_RECON_DELAY_MAX); |
116 info->delay = g_random_int_range(INITIAL_RECON_DELAY_MIN, INITIAL_RECON_DELAY_MAX); |
| 116 } else { |
117 } else { |
| 139 g_free(act); |
140 g_free(act); |
| 140 g_free(primary); |
141 g_free(primary); |
| 141 g_free(secondary); |
142 g_free(secondary); |
| 142 purple_account_set_enabled(account, FINCH_UI, FALSE); |
143 purple_account_set_enabled(account, FINCH_UI, FALSE); |
| 143 } |
144 } |
| |
145 |
| |
146 /* If we have any open chats, we probably want to rejoin when we get back online. */ |
| |
147 list = purple_get_chats(); |
| |
148 while (list) { |
| |
149 PurpleConversation *conv = list->data; |
| |
150 list = list->next; |
| |
151 if (conv->account != account || |
| |
152 purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) |
| |
153 continue; |
| |
154 purple_conversation_set_data(conv, "want-to-rejoin", GINT_TO_POINTER(TRUE)); |
| |
155 } |
| 144 } |
156 } |
| 145 |
157 |
| 146 static void |
158 static void |
| 147 account_removed_cb(PurpleAccount *account, gpointer user_data) |
159 account_removed_cb(PurpleAccount *account, gpointer user_data) |
| 148 { |
160 { |