Mercurial > pidgin
diff libpurple/protocols/jabber/presence.c @ 21229:0b67d509a305
merge of '1bcf84e26d11f259b3c5ec663e3fecc2f01aed33'
and 'ce13b5ca4994abbd4934b3bc568c8b115335c426'
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sun, 14 Oct 2007 02:41:00 +0000 |
parents | fdefa5eb46e2 b1fa7765ca4b |
children | b9680933c2c6 |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/presence.c Sun Oct 14 02:13:14 2007 +0000 +++ b/libpurple/protocols/jabber/presence.c Sun Oct 14 02:41:00 2007 +0000 @@ -33,6 +33,7 @@ #include "buddy.h" #include "chat.h" +#include "google.h" #include "presence.h" #include "iq.h" #include "jutil.h" @@ -104,13 +105,14 @@ char *stripped = NULL; JabberBuddyState state; int priority; - const char *artist, *title, *source, *uri, *track; - int length; + const char *artist = NULL, *title = NULL, *source = NULL, *uri = NULL, *track = NULL; + int length = -1; gboolean allowBuzz; + PurplePresence *p = purple_account_get_presence(account); + PurpleStatus *tune; - if(NULL == status) { - PurplePresence *gpresence = purple_account_get_presence(account); - status = purple_presence_get_active_status(gpresence); + if (NULL == status) { + status = purple_presence_get_active_status(p); } if(!purple_status_is_active(status)) @@ -144,6 +146,12 @@ if (allowBuzz != js->allowBuzz || js->old_state != state || CHANGED(js->old_msg, stripped) || js->old_priority != priority || CHANGED(js->old_avatarhash, js->avatar_hash)) { js->allowBuzz = allowBuzz; + + if (js->googletalk && stripped == NULL && purple_presence_is_status_primitive_active(p, PURPLE_STATUS_TUNE)) { + tune = purple_presence_get_status(p, "tune"); + stripped = jabber_google_presence_outgoing(tune); + } + presence = jabber_presence_create_js(js, state, stripped, priority); if(js->avatar_hash) { @@ -172,12 +180,16 @@ } /* next, check if there are any changes to the tune values */ - artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); - title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); - source = purple_status_get_attr_string(status, PURPLE_TUNE_ALBUM); - uri = purple_status_get_attr_string(status, PURPLE_TUNE_URL); - track = purple_status_get_attr_string(status, PURPLE_TUNE_TRACK); - length = (!purple_status_get_attr_value(status, PURPLE_TUNE_TIME))?-1:purple_status_get_attr_int(status, PURPLE_TUNE_TIME); + tune = purple_presence_get_status(p, "tune"); + if (tune && purple_status_is_active(tune)) { + artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST); + title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); + source = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM); + uri = purple_status_get_attr_string(tune, PURPLE_TUNE_URL); + track = purple_status_get_attr_string(tune, PURPLE_TUNE_TRACK); + 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)) { @@ -731,7 +743,8 @@ } if((found_jbr = jabber_buddy_find_resource(jb, NULL))) { - purple_prpl_got_user_status(js->gc->account, buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, found_jbr->status ? "message" : NULL, found_jbr->status, NULL); + jabber_google_presence_incoming(js, buddy_name, found_jbr); + purple_prpl_got_user_status(js->gc->account, buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, "message", found_jbr->status, NULL); } else { purple_prpl_got_user_status(js->gc->account, buddy_name, "offline", status ? "message" : NULL, status, NULL); }