summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Aurich <darkrain42@pidgin.im>2009-02-14 03:57:22 +0000
committerPaul Aurich <darkrain42@pidgin.im>2009-02-14 03:57:22 +0000
commit1b7d5ccb9f055285ae750a90ff95f9d1f45c1e12 (patch)
tree8fe2cfcb91e52d8a4ae20c8547968d2c65ea9902
parent1ddcba8d5b62870d3ebedcf01225c90f5df6e8e6 (diff)
downloadpidgin-1b7d5ccb9f055285ae750a90ff95f9d1f45c1e12.tar.gz
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.)
-rw-r--r--libpurple/protocols/jabber/disco.c6
-rw-r--r--libpurple/protocols/jabber/presence.c16
2 files changed, 18 insertions, 4 deletions
diff --git a/libpurple/protocols/jabber/disco.c b/libpurple/protocols/jabber/disco.c
index ace22c9ced..fda08d9fbe 100644
--- a/libpurple/protocols/jabber/disco.c
+++ b/libpurple/protocols/jabber/disco.c
@@ -340,7 +340,13 @@ jabber_disco_finish_server_info_result_cb(JabberStream *js)
{
const char *ft_proxies;
+ /*
+ * This *should* happen only if the server supports vcard-temp, but there
+ * are apparently some servers that don't advertise it even though they
+ * support it.
+ */
jabber_vcard_fetch_mine(js);
+
if (js->pep)
jabber_avatar_fetch_mine(js);
diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c
index a30b9a8394..5d097b66ac 100644
--- a/libpurple/protocols/jabber/presence.c
+++ b/libpurple/protocols/jabber/presence.c
@@ -155,11 +155,19 @@ void jabber_presence_send(PurpleAccount *account, PurpleStatus *status)
presence = jabber_presence_create_js(js, state, stripped, priority);
- if(js->avatar_hash) {
- x = xmlnode_new_child(presence, "x");
- xmlnode_set_namespace(x, "vcard-temp:x:update");
+ /* Per XEP-0153 4.1, we must always send the <x> */
+ x = xmlnode_new_child(presence, "x");
+ xmlnode_set_namespace(x, "vcard-temp:x:update");
+ /*
+ * FIXME: Per XEP-0153 4.3.2 bullet 2, we must not publish our
+ * image hash if another resource has logged in and updated the
+ * vcard avatar. Requires changes in jabber_presence_parse.
+ */
+ if (js->vcard_fetched) {
+ /* Always publish a <photo>; it's empty if we have no image. */
photo = xmlnode_new_child(x, "photo");
- xmlnode_insert_data(photo, js->avatar_hash, -1);
+ if (js->avatar_hash)
+ xmlnode_insert_data(photo, js->avatar_hash, -1);
}
jabber_send(js, presence);