Mercurial > pidgin.yaz
comparison src/connection.c @ 6460:ff4551719cc7
[gaim-migrate @ 6969]
I almost hate to do this in a way, but I added another connection UI op
specifically for reporting disconnects, so that it's no longer in the core.
This will let UIs display a disconnect in ways other than an error dialog,
or allow plugins to turn off disconnect notifications.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Wed, 13 Aug 2003 22:40:41 +0000 |
parents | 74ca311ceb2a |
children | 4aa3b1cec52b |
comparison
equal
deleted
inserted
replaced
6459:b52870734c21 | 6460:ff4551719cc7 |
---|---|
314 | 314 |
315 serv_set_permit_deny(gc); | 315 serv_set_permit_deny(gc); |
316 } | 316 } |
317 else if (gc->state == GAIM_DISCONNECTED) { | 317 else if (gc->state == GAIM_DISCONNECTED) { |
318 if (ops != NULL && ops->disconnected != NULL) | 318 if (ops != NULL && ops->disconnected != NULL) |
319 ops->disconnected(gc, NULL); | 319 ops->disconnected(gc); |
320 } | 320 } |
321 } | 321 } |
322 | 322 |
323 void | 323 void |
324 gaim_connection_set_account(GaimConnection *gc, GaimAccount *account) | 324 gaim_connection_set_account(GaimConnection *gc, GaimAccount *account) |
397 | 397 |
398 void | 398 void |
399 gaim_connection_error(GaimConnection *gc, const char *text) | 399 gaim_connection_error(GaimConnection *gc, const char *text) |
400 { | 400 { |
401 GaimConnectionUiOps *ops; | 401 GaimConnectionUiOps *ops; |
402 gchar *primary, *secondary; | |
403 | 402 |
404 g_return_if_fail(gc != NULL); | 403 g_return_if_fail(gc != NULL); |
405 g_return_if_fail(text != NULL); | 404 g_return_if_fail(text != NULL); |
406 | 405 |
407 /* If we've already got one error, we don't need any more */ | 406 /* If we've already got one error, we don't need any more */ |
408 if(gc->disconnect_timeout) | 407 if (gc->disconnect_timeout) |
409 return; | 408 return; |
410 | |
411 primary = g_strdup_printf(_("%s has been disconnected"), | |
412 gaim_account_get_username(gaim_connection_get_account(gc))); | |
413 secondary = g_strdup_printf("%s\n%s", full_date(), | |
414 text ? text : _("Reason Unknown.")); | |
415 gaim_notify_error(NULL, _("Connection Error"), primary, secondary); | |
416 g_free(primary); | |
417 g_free(secondary); | |
418 | 409 |
419 ops = gaim_get_connection_ui_ops(); | 410 ops = gaim_get_connection_ui_ops(); |
420 | 411 |
421 if (ops != NULL && ops->disconnected != NULL) | 412 if (ops != NULL) { |
422 ops->disconnected(gc, text); | 413 if (ops->report_disconnect != NULL) |
414 ops->report_disconnect(gc, text); | |
415 | |
416 if (ops->disconnected != NULL) | |
417 ops->disconnected(gc); | |
418 } | |
423 | 419 |
424 gc->disconnect_timeout = g_timeout_add(0, gaim_connection_disconnect_cb, | 420 gc->disconnect_timeout = g_timeout_add(0, gaim_connection_disconnect_cb, |
425 gaim_connection_get_account(gc)); | 421 gaim_connection_get_account(gc)); |
426 } | 422 } |
427 | 423 |