| 134 |
134 |
| 135 return FALSE; |
135 return FALSE; |
| 136 } |
136 } |
| 137 |
137 |
| 138 static void |
138 static void |
| 139 pidgin_connection_report_disconnect_reason (PurpleConnection *gc, |
139 pidgin_connection_report_disconnect(PurpleConnection *gc, |
| 140 PurpleConnectionError reason, |
140 PurpleConnectionError reason, |
| 141 const char *text) |
141 const char *text) |
| 142 { |
142 { |
| 143 PurpleAccount *account = NULL; |
143 PurpleAccount *account = NULL; |
| 144 PidginAutoRecon *info; |
144 PidginAutoRecon *info; |
| 145 GList *list; |
|
| 146 |
145 |
| 147 account = purple_connection_get_account(gc); |
146 account = purple_connection_get_account(gc); |
| 148 info = g_hash_table_lookup(auto_reconns, account); |
147 info = g_hash_table_lookup(auto_reconns, account); |
| 149 |
148 |
| 150 if (!purple_connection_error_is_fatal (reason)) { |
149 if (!purple_connection_error_is_fatal (reason)) { |
| 162 if (info != NULL) |
161 if (info != NULL) |
| 163 g_hash_table_remove(auto_reconns, account); |
162 g_hash_table_remove(auto_reconns, account); |
| 164 |
163 |
| 165 purple_account_set_enabled(account, PIDGIN_UI, FALSE); |
164 purple_account_set_enabled(account, PIDGIN_UI, FALSE); |
| 166 } |
165 } |
| 167 |
|
| 168 /* If we have any open chats, we probably want to rejoin when we get back online. */ |
|
| 169 list = purple_get_chats(); |
|
| 170 while (list) { |
|
| 171 PurpleConversation *conv = list->data; |
|
| 172 list = list->next; |
|
| 173 if (conv->account != account || |
|
| 174 purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) |
|
| 175 continue; |
|
| 176 purple_conversation_set_data(conv, "want-to-rejoin", GINT_TO_POINTER(TRUE)); |
|
| 177 } |
|
| 178 } |
166 } |
| 179 |
167 |
| 180 static void pidgin_connection_network_connected (void) |
168 static void pidgin_connection_network_connected (void) |
| 181 { |
169 { |
| 182 GList *list, *l; |
170 GList *list, *l; |
| 222 { |
210 { |
| 223 pidgin_connection_connect_progress, |
211 pidgin_connection_connect_progress, |
| 224 pidgin_connection_connected, |
212 pidgin_connection_connected, |
| 225 pidgin_connection_disconnected, |
213 pidgin_connection_disconnected, |
| 226 pidgin_connection_notice, |
214 pidgin_connection_notice, |
| 227 NULL, /* report_disconnect */ |
|
| 228 pidgin_connection_network_connected, |
215 pidgin_connection_network_connected, |
| 229 pidgin_connection_network_disconnected, |
216 pidgin_connection_network_disconnected, |
| 230 pidgin_connection_report_disconnect_reason, |
217 pidgin_connection_report_disconnect, |
| 231 NULL, |
218 NULL, |
| 232 NULL, |
219 NULL, |
| 233 NULL |
220 NULL |
| 234 }; |
221 }; |
| 235 |
222 |