libpurple/protocols/jabber/presence.c

branch
sadrul.currentmedia
changeset 21197
f109bdb267e0
parent 21195
fd63ef5027d7
child 21204
93f18311e16a
equal deleted inserted replaced
21196:cb0d1770b768 21197:f109bdb267e0
109 int length = -1; 109 int length = -1;
110 gboolean allowBuzz; 110 gboolean allowBuzz;
111 PurplePresence *p = purple_account_get_presence(account); 111 PurplePresence *p = purple_account_get_presence(account);
112 PurpleStatus *tune; 112 PurpleStatus *tune;
113 113
114 if(NULL == status) { 114 if (NULL == status) {
115 PurplePresence *gpresence = purple_account_get_presence(account); 115 status = purple_presence_get_active_status(p);
116 status = purple_presence_get_active_status(gpresence);
117 } 116 }
118 117
119 if(!purple_status_is_active(status)) 118 if(!purple_status_is_active(status))
120 return; 119 return;
121 120
146 /* check if there are any differences to the <presence> and send them in that case */ 145 /* check if there are any differences to the <presence> and send them in that case */
147 if (allowBuzz != js->allowBuzz || js->old_state != state || CHANGED(js->old_msg, stripped) || 146 if (allowBuzz != js->allowBuzz || js->old_state != state || CHANGED(js->old_msg, stripped) ||
148 js->old_priority != priority || CHANGED(js->old_avatarhash, js->avatar_hash)) { 147 js->old_priority != priority || CHANGED(js->old_avatarhash, js->avatar_hash)) {
149 js->allowBuzz = allowBuzz; 148 js->allowBuzz = allowBuzz;
150 149
151 if (js->googletalk && stripped == NULL && purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { 150 if (js->googletalk && stripped == NULL && purple_presence_is_status_primitive_active(p, PURPLE_STATUS_TUNE)) {
152 tune = purple_presence_get_status(presence, "tune"); 151 tune = purple_presence_get_status(p, "tune");
153 stripped = jabber_google_presence_outgoing(tune); 152 stripped = jabber_google_presence_outgoing(tune);
154 } 153 }
155 154
156 presence = jabber_presence_create_js(js, state, stripped, priority); 155 presence = jabber_presence_create_js(js, state, stripped, priority);
157 156
179 js->old_priority = priority; 178 js->old_priority = priority;
180 g_free(stripped); 179 g_free(stripped);
181 } 180 }
182 181
183 /* next, check if there are any changes to the tune values */ 182 /* next, check if there are any changes to the tune values */
184 tune = purple_presence_get_status(purple_status_get_presence(status), "tune"); 183 tune = purple_presence_get_status(p, "tune");
185 if (tune && purple_status_is_active(tune)) { 184 if (tune && purple_status_is_active(tune)) {
186 artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST); 185 artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST);
187 title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); 186 title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE);
188 source = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM); 187 source = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM);
189 uri = purple_status_get_attr_string(tune, PURPLE_TUNE_URL); 188 uri = purple_status_get_attr_string(tune, PURPLE_TUNE_URL);
741 } 740 }
742 } 741 }
743 } 742 }
744 743
745 if((found_jbr = jabber_buddy_find_resource(jb, NULL))) { 744 if((found_jbr = jabber_buddy_find_resource(jb, NULL))) {
746 const char *message;
747 jabber_google_presence_incoming(js, buddy_name, found_jbr); 745 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); 746 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);
749 } else { 747 } else {
750 purple_prpl_got_user_status(js->gc->account, buddy_name, "offline", status ? "message" : NULL, status, NULL); 748 purple_prpl_got_user_status(js->gc->account, buddy_name, "offline", status ? "message" : NULL, status, NULL);
751 } 749 }

mercurial