libpurple/protocols/jabber/presence.c

branch
cpw.darkrain42.xmpp.avatars
changeset 25810
5cf3c22e52df
parent 25154
492b9d6b48a5
child 26090
2b9ffd42e91f
equal deleted inserted replaced
25809:f0d37a73663a 25810:5cf3c22e52df
153 js->old_priority != priority || CHANGED(js->old_avatarhash, js->avatar_hash)) { 153 js->old_priority != priority || CHANGED(js->old_avatarhash, js->avatar_hash)) {
154 js->allowBuzz = allowBuzz; 154 js->allowBuzz = allowBuzz;
155 155
156 presence = jabber_presence_create_js(js, state, stripped, priority); 156 presence = jabber_presence_create_js(js, state, stripped, priority);
157 157
158 if(js->avatar_hash) { 158 /* Per XEP-0153 4.1, we must always send the <x> */
159 x = xmlnode_new_child(presence, "x"); 159 x = xmlnode_new_child(presence, "x");
160 xmlnode_set_namespace(x, "vcard-temp:x:update"); 160 xmlnode_set_namespace(x, "vcard-temp:x:update");
161 /*
162 * FIXME: Per XEP-0153 4.3.2 bullet 2, we must not publish our
163 * image hash if another resource has logged in and updated the
164 * vcard avatar. Requires changes in jabber_presence_parse.
165 */
166 if (js->vcard_fetched) {
167 /* Always publish a <photo>; it's empty if we have no image. */
161 photo = xmlnode_new_child(x, "photo"); 168 photo = xmlnode_new_child(x, "photo");
162 xmlnode_insert_data(photo, js->avatar_hash, -1); 169 if (js->avatar_hash)
170 xmlnode_insert_data(photo, js->avatar_hash, -1);
163 } 171 }
164 172
165 jabber_send(js, presence); 173 jabber_send(js, presence);
166 174
167 g_hash_table_foreach(js->chats, chats_send_presence_foreach, presence); 175 g_hash_table_foreach(js->chats, chats_send_presence_foreach, presence);

mercurial