comparison libpurple/protocols/jabber/presence.c @ 25831:0fa91206cf5a

Always publish a <photo/> element, even if we have an empty buddy icon. XEP-0153 requires we always publish the <x/> element, even if we have no avatar set, so do that, too. I'd also make the whole set of vcard stuff dependent on the server advertising support, but SOME servers out there don't. References #5082 (I suspect this fixes that.)
author Paul Aurich <paul@darkrain42.org>
date Sat, 14 Feb 2009 03:57:22 +0000
parents bba38f03085d
children 7e020fbe2cdb
comparison
equal deleted inserted replaced
25830:b3dbc9e8b6ef 25831:0fa91206cf5a
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);