comparison src/connection.c @ 6393:74ca311ceb2a

[gaim-migrate @ 6898] This manages to not make jabber (and maybe others) not crash on connection errors and stuff. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Wed, 06 Aug 2003 14:33:58 +0000
parents ae8b0a12e6f3
children ff4551719cc7
comparison
equal deleted inserted replaced
6392:e9974608b319 6393:74ca311ceb2a
80 g_free(gc->away); 80 g_free(gc->away);
81 81
82 if (gc->away_state != NULL) 82 if (gc->away_state != NULL)
83 g_free(gc->away_state); 83 g_free(gc->away_state);
84 84
85 if (gc->disconnect_timeout)
86 g_source_remove(gc->disconnect_timeout);
87
85 g_free(gc); 88 g_free(gc);
86 } 89 }
87 90
88 static void request_pass_ok_cb(GaimAccount *account, const char *entry) 91 static void request_pass_ok_cb(GaimAccount *account, const char *entry)
89 { 92 {
399 gchar *primary, *secondary; 402 gchar *primary, *secondary;
400 403
401 g_return_if_fail(gc != NULL); 404 g_return_if_fail(gc != NULL);
402 g_return_if_fail(text != NULL); 405 g_return_if_fail(text != NULL);
403 406
407 /* If we've already got one error, we don't need any more */
408 if(gc->disconnect_timeout)
409 return;
410
404 primary = g_strdup_printf(_("%s has been disconnected"), 411 primary = g_strdup_printf(_("%s has been disconnected"),
405 gaim_account_get_username(gaim_connection_get_account(gc))); 412 gaim_account_get_username(gaim_connection_get_account(gc)));
406 secondary = g_strdup_printf("%s\n%s", full_date(), 413 secondary = g_strdup_printf("%s\n%s", full_date(),
407 text ? text : _("Reason Unknown.")); 414 text ? text : _("Reason Unknown."));
408 gaim_notify_error(NULL, _("Connection Error"), primary, secondary); 415 gaim_notify_error(NULL, _("Connection Error"), primary, secondary);
412 ops = gaim_get_connection_ui_ops(); 419 ops = gaim_get_connection_ui_ops();
413 420
414 if (ops != NULL && ops->disconnected != NULL) 421 if (ops != NULL && ops->disconnected != NULL)
415 ops->disconnected(gc, text); 422 ops->disconnected(gc, text);
416 423
417 g_timeout_add(0, gaim_connection_disconnect_cb, 424 gc->disconnect_timeout = g_timeout_add(0, gaim_connection_disconnect_cb,
418 gaim_connection_get_account(gc)); 425 gaim_connection_get_account(gc));
419 } 426 }
420 427
421 void 428 void
422 gaim_connections_disconnect_all(void) 429 gaim_connections_disconnect_all(void)