comparison libpurple/protocols/jabber/presence.c @ 23986:1de1494a13e5

propagate from branch 'im.pidgin.pidgin' (head e685599ddcc769d157547685b5498df0662de8a2) to branch 'im.pidgin.xmpp.custom_smiley' (head 110555eba89887adcf842166213ffc82770c0ee4)
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 04 Sep 2008 21:27:33 +0000
parents 74960bf43dae
children 39841a84c944 e23b447aa5ca ba362a67278c e9b7e41dc816
comparison
equal deleted inserted replaced
23449:c45d05bd58ed 23986:1de1494a13e5
139 purple_status_to_jabber(status, &state, &stripped, &priority); 139 purple_status_to_jabber(status, &state, &stripped, &priority);
140 140
141 /* check for buzz support */ 141 /* check for buzz support */
142 allowBuzz = purple_status_get_attr_boolean(status,"buzz"); 142 allowBuzz = purple_status_get_attr_boolean(status,"buzz");
143 /* changing the buzz state has to trigger a re-broadcasting of the presence for caps */ 143 /* changing the buzz state has to trigger a re-broadcasting of the presence for caps */
144
145 if (js->googletalk && stripped == NULL && purple_presence_is_status_primitive_active(p, PURPLE_STATUS_TUNE)) {
146 tune = purple_presence_get_status(p, "tune");
147 stripped = jabber_google_presence_outgoing(tune);
148 }
144 149
145 #define CHANGED(a,b) ((!a && b) || (a && a[0] == '\0' && b && b[0] != '\0') || \ 150 #define CHANGED(a,b) ((!a && b) || (a && a[0] == '\0' && b && b[0] != '\0') || \
146 (a && !b) || (a && a[0] != '\0' && b && b[0] == '\0') || (a && b && strcmp(a,b))) 151 (a && !b) || (a && a[0] != '\0' && b && b[0] == '\0') || (a && b && strcmp(a,b)))
147 /* check if there are any differences to the <presence> and send them in that case */ 152 /* check if there are any differences to the <presence> and send them in that case */
148 if (allowBuzz != js->allowBuzz || js->old_state != state || CHANGED(js->old_msg, stripped) || 153 if (allowBuzz != js->allowBuzz || js->old_state != state || CHANGED(js->old_msg, stripped) ||
149 js->old_priority != priority || CHANGED(js->old_avatarhash, js->avatar_hash)) { 154 js->old_priority != priority || CHANGED(js->old_avatarhash, js->avatar_hash)) {
150 js->allowBuzz = allowBuzz; 155 js->allowBuzz = allowBuzz;
151
152 if (js->googletalk && stripped == NULL && purple_presence_is_status_primitive_active(p, PURPLE_STATUS_TUNE)) {
153 tune = purple_presence_get_status(p, "tune");
154 stripped = jabber_google_presence_outgoing(tune);
155 }
156 156
157 presence = jabber_presence_create_js(js, state, stripped, priority); 157 presence = jabber_presence_create_js(js, state, stripped, priority);
158 158
159 if(js->avatar_hash) { 159 if(js->avatar_hash) {
160 x = xmlnode_new_child(presence, "x"); 160 x = xmlnode_new_child(presence, "x");
176 g_free(js->old_avatarhash); 176 g_free(js->old_avatarhash);
177 js->old_msg = g_strdup(stripped); 177 js->old_msg = g_strdup(stripped);
178 js->old_avatarhash = g_strdup(js->avatar_hash); 178 js->old_avatarhash = g_strdup(js->avatar_hash);
179 js->old_state = state; 179 js->old_state = state;
180 js->old_priority = priority; 180 js->old_priority = priority;
181 g_free(stripped); 181 }
182 } 182 g_free(stripped);
183 183
184 /* next, check if there are any changes to the tune values */ 184 /* next, check if there are any changes to the tune values */
185 tune = purple_presence_get_status(p, "tune"); 185 tune = purple_presence_get_status(p, "tune");
186 if (tune && purple_status_is_active(tune)) { 186 if (tune && purple_status_is_active(tune)) {
187 artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST); 187 artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST);
188 title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); 188 title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE);