comparison libpurple/protocols/jabber/presence.c @ 23431:146d16459cda

make googletalk tune hack work, previously it's not doing anything unless you also change other statuses
author Ka-Hing Cheung <khc@hxbc.us>
date Sun, 06 Jul 2008 17:19:27 +0000
parents 5793bcea224c
children 74960bf43dae
comparison
equal deleted inserted replaced
23430:9ad75be23c93 23431:146d16459cda
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");