comparison libpurple/connection.c @ 20813:66e7b104b4ea

rlaager pointed out that purple_connection_error_reason should be setting wants_to_die appropriately to the reason, rather than leaving it up to the prpl, so let's make it so!
author Will Thompson <will.thompson@collabora.co.uk>
date Tue, 09 Oct 2007 13:25:47 +0000
parents 682543aced31
children 38d7c849d444
comparison
equal deleted inserted replaced
20812:88aa557b997f 20813:66e7b104b4ea
486 } 486 }
487 487
488 void 488 void
489 purple_connection_error(PurpleConnection *gc, const char *text) 489 purple_connection_error(PurpleConnection *gc, const char *text)
490 { 490 {
491 purple_connection_error_reason (gc, PURPLE_REASON_OTHER_ERROR, text); 491 PurpleDisconnectReason reason = gc->wants_to_die
492 ? PURPLE_REASON_OTHER_ERROR
493 : PURPLE_REASON_NETWORK_ERROR;
494 purple_connection_error_reason (gc, reason, text);
492 } 495 }
493 496
494 void 497 void
495 purple_connection_error_reason (PurpleConnection *gc, 498 purple_connection_error_reason (PurpleConnection *gc,
496 PurpleDisconnectReason reason, 499 PurpleDisconnectReason reason,
497 const char *description) 500 const char *description)
498 { 501 {
499 PurpleConnectionUiOps *ops; 502 PurpleConnectionUiOps *ops;
500 gboolean fatal;
501 503
502 g_return_if_fail(gc != NULL); 504 g_return_if_fail(gc != NULL);
505 g_assert (reason < PURPLE_NUM_REASONS);
503 506
504 if (description == NULL) { 507 if (description == NULL) {
505 purple_debug_error("connection", "purple_connection_error_reason: check `description != NULL' failed\n"); 508 purple_debug_error("connection", "purple_connection_error_reason: check `description != NULL' failed\n");
506 description = _("Unknown error"); 509 description = _("Unknown error");
507 } 510 }
508 511
509 g_assert (reason < PURPLE_NUM_REASONS);
510
511 /* This should probably be removed at some point */
512 fatal = purple_connection_reason_is_fatal (reason);
513 if (fatal != gc->wants_to_die)
514 purple_debug_warning ("connection",
515 "reason %u is %sfatal but wants_to_die is %u",
516 reason, (fatal ? "" : "not "), gc->wants_to_die);
517
518 /* If we've already got one error, we don't need any more */ 512 /* If we've already got one error, we don't need any more */
519 if (gc->disconnect_timeout) 513 if (gc->disconnect_timeout)
520 return; 514 return;
515
516 gc->wants_to_die = purple_connection_reason_is_fatal (reason);
521 517
522 ops = purple_connections_get_ui_ops(); 518 ops = purple_connections_get_ui_ops();
523 519
524 if (ops != NULL) 520 if (ops != NULL)
525 { 521 {