Mercurial > pidgin
diff src/protocols/jabber/presence.c @ 10755:fffc664d5294
[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 <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 27 Mar 2005 19:29:18 +0000 |
parents | 55af3fa46329 |
children | cef48e318125 |
line wrap: on
line diff
--- 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)