Mercurial > pidgin.yaz
diff libpurple/protocols/jabber/presence.c @ 25982:7e020fbe2cdb
propagate from branch 'im.pidgin.pidgin' (head 303af74a38e7b313d4fb0be4d4054a16cb13d819)
to branch 'im.pidgin.cpw.darkrain42.xmpp.avatars' (head 11e989f3ac36a0f958f031d55245db093923ea76)
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 07 Mar 2009 01:32:29 +0000 |
parents | 0fa91206cf5a 5f9a24d1c25e |
children | 242a8c97270b |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/presence.c Sat Feb 14 18:23:13 2009 +0000 +++ b/libpurple/protocols/jabber/presence.c Sat Mar 07 01:32:29 2009 +0000 @@ -136,7 +136,7 @@ } purple_status_to_jabber(status, &state, &stripped, &priority); - + /* check for buzz support */ allowBuzz = purple_status_get_attr_boolean(status,"buzz"); /* changing the buzz state has to trigger a re-broadcasting of the presence for caps */ @@ -145,7 +145,7 @@ tune = purple_presence_get_status(p, "tune"); stripped = jabber_google_presence_outgoing(tune); } - + #define CHANGED(a,b) ((!a && b) || (a && a[0] == '\0' && b && b[0] != '\0') || \ (a && !b) || (a && a[0] != '\0' && b && b[0] == '\0') || (a && b && strcmp(a,b))) /* check if there are any differences to the <presence> and send them in that case */ @@ -174,9 +174,9 @@ g_hash_table_foreach(js->chats, chats_send_presence_foreach, presence); xmlnode_free(presence); - + /* update old values */ - + if(js->old_msg) g_free(js->old_msg); if(js->old_avatarhash) @@ -199,7 +199,7 @@ length = (!purple_status_get_attr_value(tune, PURPLE_TUNE_TIME)) ? -1 : purple_status_get_attr_int(tune, PURPLE_TUNE_TIME); } - + if(CHANGED(artist, js->old_artist) || CHANGED(title, js->old_title) || CHANGED(source, js->old_source) || CHANGED(uri, js->old_uri) || CHANGED(track, js->old_track) || (length != js->old_length)) { PurpleJabberTuneInfo tuneinfo = { @@ -211,7 +211,7 @@ (char*)uri }; jabber_tune_set(js->gc, &tuneinfo); - + /* update old values */ g_free(js->old_artist); g_free(js->old_title); @@ -272,27 +272,27 @@ xmlnode_set_namespace(c, "http://jabber.org/protocol/caps"); xmlnode_set_attrib(c, "node", CAPS0115_NODE); xmlnode_set_attrib(c, "ver", VERSION); - + if(js != NULL) { /* add the extensions */ char extlist[1024]; unsigned remaining = 1023; /* one less for the \0 */ GList *feature; - + extlist[0] = '\0'; for(feature = jabber_features; feature && remaining > 0; feature = feature->next) { JabberFeature *feat = (JabberFeature*)feature->data; unsigned featlen; - + if(feat->is_enabled != NULL && feat->is_enabled(js, feat->shortname, feat->namespace) == FALSE) continue; /* skip this feature */ - + featlen = strlen(feat->shortname); - + /* cut off when we don't have any more space left in our buffer (too bad) */ if(featlen > remaining) break; - + strncat(extlist,feat->shortname,remaining); remaining -= featlen; if(feature->next) { /* no space at the end */ @@ -304,7 +304,7 @@ if(remaining < 1023) xmlnode_set_attrib(c, "ext", extlist); } - + return presence; } @@ -753,7 +753,7 @@ const char *node = xmlnode_get_attrib(caps,"node"); const char *ver = xmlnode_get_attrib(caps,"ver"); const char *ext = xmlnode_get_attrib(caps,"ext"); - + if(node && ver) { JabberPresenceCapabilities *userdata = g_new0(JabberPresenceCapabilities, 1); userdata->js = js;