comparison src/connection.c @ 9190:9e3289499977

[gaim-migrate @ 9985] Patch by Evan Schoenberg. The disconnected UI op was called twice on connection errors. Now it is only called once. He describes it as follows: "Currently, the UI's disconnected callback is called twice when there is a connection error. First, it is called by gaim_connection_error(). Then, gaim_connection_disconnect_cb is called, leading to a call to gaim_connection_set_state() at which point the gc's state is set to GAIM_DISCONNECTED. Finally, the UI's disconnected callback is called once the state is set to GAIM_DISCONNECTED. The call in gaim_connection_error() is incorrect; there is no need to manually call the UI's disconnected callback. It causes really nasty problems for smart reconnection handling and is wasteful. :)" committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 06 Jun 2004 02:07:59 +0000
parents db1dc2d02020
children 7a8aa87164ae
comparison
equal deleted inserted replaced
9189:2645d2ccbe80 9190:9e3289499977
399 char *msg = g_strdup_printf("+++ %s signed off", 399 char *msg = g_strdup_printf("+++ %s signed off",
400 gaim_account_get_username(account)); 400 gaim_account_get_username(account));
401 gaim_log_write(log, GAIM_MESSAGE_SYSTEM, 401 gaim_log_write(log, GAIM_MESSAGE_SYSTEM,
402 gaim_account_get_username(account), time(NULL), 402 gaim_account_get_username(account), time(NULL),
403 msg); 403 msg);
404 g_free(msg); 404 g_free(msg);
405 } 405 }
406 406
407 gaim_account_destroy_log(account); 407 gaim_account_destroy_log(account);
408 408
409 if (ops != NULL && ops->disconnected != NULL) 409 if (ops != NULL && ops->disconnected != NULL)
410 ops->disconnected(gc); 410 ops->disconnected(gc);
411 } 411 }
412 } 412 }
413 413
414 void 414 void
415 gaim_connection_set_account(GaimConnection *gc, GaimAccount *account) 415 gaim_connection_set_account(GaimConnection *gc, GaimAccount *account)
501 ops = gaim_connections_get_ui_ops(); 501 ops = gaim_connections_get_ui_ops();
502 502
503 if (ops != NULL) { 503 if (ops != NULL) {
504 if (ops->report_disconnect != NULL) 504 if (ops->report_disconnect != NULL)
505 ops->report_disconnect(gc, text); 505 ops->report_disconnect(gc, text);
506
507 if (ops->disconnected != NULL)
508 ops->disconnected(gc);
509 } 506 }
510 507
511 gc->disconnect_timeout = gaim_timeout_add(0, gaim_connection_disconnect_cb, 508 gc->disconnect_timeout = gaim_timeout_add(0, gaim_connection_disconnect_cb,
512 gaim_connection_get_account(gc)); 509 gaim_connection_get_account(gc));
513 } 510 }