Mercurial > pidgin
comparison libpurple/protocols/jabber/presence.c @ 20571:c97e3ab9ef11
Music support for Google Talk
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Thu, 20 Sep 2007 23:22:35 +0000 |
parents | 5913725cbcd6 |
children | 485a0bffe4f5 |
comparison
equal
deleted
inserted
replaced
20570:5913725cbcd6 | 20571:c97e3ab9ef11 |
---|---|
31 #include "util.h" | 31 #include "util.h" |
32 #include "xmlnode.h" | 32 #include "xmlnode.h" |
33 | 33 |
34 #include "buddy.h" | 34 #include "buddy.h" |
35 #include "chat.h" | 35 #include "chat.h" |
36 #include "google.h" | |
36 #include "presence.h" | 37 #include "presence.h" |
37 #include "iq.h" | 38 #include "iq.h" |
38 #include "jutil.h" | 39 #include "jutil.h" |
39 #include "adhoccommands.h" | 40 #include "adhoccommands.h" |
40 | 41 |
105 JabberBuddyState state; | 106 JabberBuddyState state; |
106 int priority; | 107 int priority; |
107 const char *artist = NULL, *title = NULL, *source = NULL, *uri = NULL, *track = NULL; | 108 const char *artist = NULL, *title = NULL, *source = NULL, *uri = NULL, *track = NULL; |
108 int length = -1; | 109 int length = -1; |
109 gboolean allowBuzz; | 110 gboolean allowBuzz; |
111 PurplePresence *p = purple_account_get_presence(account); | |
110 PurpleStatus *tune; | 112 PurpleStatus *tune; |
111 | 113 |
112 if(NULL == status) { | 114 if(NULL == status) { |
113 PurplePresence *gpresence = purple_account_get_presence(account); | 115 PurplePresence *gpresence = purple_account_get_presence(account); |
114 status = purple_presence_get_active_status(gpresence); | 116 status = purple_presence_get_active_status(gpresence); |
143 (a && !b) || (a && a[0] != '\0' && b && b[0] == '\0') || (a && b && strcmp(a,b))) | 145 (a && !b) || (a && a[0] != '\0' && b && b[0] == '\0') || (a && b && strcmp(a,b))) |
144 /* check if there are any differences to the <presence> and send them in that case */ | 146 /* check if there are any differences to the <presence> and send them in that case */ |
145 if (allowBuzz != js->allowBuzz || js->old_state != state || CHANGED(js->old_msg, stripped) || | 147 if (allowBuzz != js->allowBuzz || js->old_state != state || CHANGED(js->old_msg, stripped) || |
146 js->old_priority != priority || CHANGED(js->old_avatarhash, js->avatar_hash)) { | 148 js->old_priority != priority || CHANGED(js->old_avatarhash, js->avatar_hash)) { |
147 js->allowBuzz = allowBuzz; | 149 js->allowBuzz = allowBuzz; |
150 | |
151 if (js->googletalk && stripped == NULL && purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { | |
152 tune = purple_presence_get_status(presence, "tune"); | |
153 stripped = jabber_google_presence_outgoing(tune); | |
154 } | |
155 | |
148 presence = jabber_presence_create_js(js, state, stripped, priority); | 156 presence = jabber_presence_create_js(js, state, stripped, priority); |
149 | 157 |
150 if(js->avatar_hash) { | 158 if(js->avatar_hash) { |
151 x = xmlnode_new_child(presence, "x"); | 159 x = xmlnode_new_child(presence, "x"); |
152 xmlnode_set_namespace(x, "vcard-temp:x:update"); | 160 xmlnode_set_namespace(x, "vcard-temp:x:update"); |
733 } | 741 } |
734 } | 742 } |
735 } | 743 } |
736 | 744 |
737 if((found_jbr = jabber_buddy_find_resource(jb, NULL))) { | 745 if((found_jbr = jabber_buddy_find_resource(jb, NULL))) { |
738 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); | 746 const char *message; |
747 jabber_google_presence_incoming(js, buddy_name, found_jbr); | |
748 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); | |
739 } else { | 749 } else { |
740 purple_prpl_got_user_status(js->gc->account, buddy_name, "offline", status ? "message" : NULL, status, NULL); | 750 purple_prpl_got_user_status(js->gc->account, buddy_name, "offline", status ? "message" : NULL, status, NULL); |
741 } | 751 } |
742 g_free(buddy_name); | 752 g_free(buddy_name); |
743 } | 753 } |