cpw.darkrain42.xmpp.avatars: 3ed150ce: Always publish a <photo/> element, even ..

paul at darkrain42.org paul at darkrain42.org
Fri Feb 13 23:00:39 EST 2009


-----------------------------------------------------------------
Revision: 3ed150ceb7b010c10dfec35dd0749540a4b0b74b
Ancestor: 16f1dd6ecf47976e09b61d1c1c7c71385c474e6a
Author: paul at darkrain42.org
Date: 2009-02-14T03:57:22
Branch: im.pidgin.cpw.darkrain42.xmpp.avatars
URL: http://d.pidgin.im/viewmtn/revision/info/3ed150ceb7b010c10dfec35dd0749540a4b0b74b

Modified files:
        libpurple/protocols/jabber/disco.c
        libpurple/protocols/jabber/presence.c

ChangeLog: 

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.)

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/disco.c	1b4fb320eab75766adc1065f181c914419739d07
+++ libpurple/protocols/jabber/disco.c	6d37db8dd9f18094e81b952bea70db55cde97bc5
@@ -340,7 +340,13 @@ jabber_disco_finish_server_info_result_c
 {
 	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);
 
============================================================
--- libpurple/protocols/jabber/presence.c	93c18869585feb24d9fae02c395caa6e839f8303
+++ libpurple/protocols/jabber/presence.c	3bdaa8e948e5833b47c39cc1d79de4f5e4defe6c
@@ -155,11 +155,19 @@ void jabber_presence_send(PurpleAccount 
 
 		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);


More information about the Commits mailing list