# HG changeset patch # User Mark Doliner # Date 1111951758 0 # Node ID fffc664d5294a9fa72824ae7d0e2c53c7f04898c # Parent 8a97b59f007110477de8589c2d2d1ffd7067d24e [gaim-migrate @ 12358] Some TLC for Jabber and Yahoo!. Jabber no longer crashes at signoff. Is Left Eye Lopez the one that burned down that guy's house? committer: Tailor Script diff -r 8a97b59f0071 -r fffc664d5294 src/connection.c --- a/src/connection.c Sun Mar 27 19:12:52 2005 +0000 +++ b/src/connection.c Sun Mar 27 19:29:18 2005 +0000 @@ -82,6 +82,9 @@ g_return_if_fail(account != NULL); + if (gaim_account_is_connected(account)) + return; + prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); if (prpl != NULL) diff -r 8a97b59f0071 -r fffc664d5294 src/protocols/jabber/presence.c --- a/src/protocols/jabber/presence.c Sun Mar 27 19:12:52 2005 +0000 +++ b/src/protocols/jabber/presence.c Sun Mar 27 19:29:18 2005 +0000 @@ -91,6 +91,8 @@ { GaimConnection *gc = NULL; JabberStream *js = NULL; + gboolean connected; + int primitive; xmlnode *presence, *x, *photo; char *stripped = NULL; const char *msg; @@ -100,15 +102,21 @@ if(!gaim_status_is_active(status)) return; - if(!account) return ; - gc = account->gc; - - if (!gc && strcmp(gaim_status_get_id(status), "offline")) + connected = gaim_account_is_connected(account); + primitive = gaim_status_type_get_primitive(gaim_status_get_type(status)); + + if(primitive != GAIM_STATUS_OFFLINE && !connected) { gaim_account_connect(account); - - if(!gc) return; - js= gc->proto_data; - + } else if(primitive == GAIM_STATUS_OFFLINE && connected) { + gaim_account_disconnect(account); + } + + if(!connected) + return; + + gc = gaim_account_get_connection(account); + js = gc->proto_data; + gaim_status_to_jabber(status, &state, &msg, &priority); if(msg) diff -r 8a97b59f0071 -r fffc664d5294 src/protocols/yahoo/yahoo.c --- a/src/protocols/yahoo/yahoo.c Sun Mar 27 19:12:52 2005 +0000 +++ b/src/protocols/yahoo/yahoo.c Sun Mar 27 19:29:18 2005 +0000 @@ -2760,6 +2760,7 @@ static void yahoo_set_status(GaimAccount *account, GaimStatus *status) { GaimConnection *gc = gaim_account_get_connection(account); + gboolean connected = gaim_account_is_connected(account); struct yahoo_data *yd; struct yahoo_packet *pkt; int old_status; @@ -2770,14 +2771,17 @@ id = gaim_status_get_id(status); if (!gaim_status_is_active(status)) return; - if (strcmp(id, YAHOO_STATUS_TYPE_OFFLINE) && !gc) { + if (strcmp(id, YAHOO_STATUS_TYPE_OFFLINE) && !connected) { gaim_account_connect(account); return; - } else if (!strcmp(id, YAHOO_STATUS_TYPE_OFFLINE) && gc) { + } else if (!strcmp(id, YAHOO_STATUS_TYPE_OFFLINE) && connected) { gaim_account_disconnect(account); return; } + if (!connected) + return; + yd = (struct yahoo_data *)gc->proto_data; old_status = yd->current_status;