pidgin: 0877e1f3: Support an empty <metadata/> element to ..

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Thu Dec 11 03:46:06 EST 2008


-----------------------------------------------------------------
Revision: 0877e1f3bc6b944c67c5b352a8f04fddcb6c54e1
Ancestor: 063764d30c073efa3d819ecf2d08c2ae793c2d5b
Author: paul at aurich.com
Date: 2008-12-11T07:38:20
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/0877e1f3bc6b944c67c5b352a8f04fddcb6c54e1

Modified files:
        ChangeLog libpurple/protocols/jabber/buddy.c

ChangeLog: 

Support an empty <metadata/> element to indicate that a user has no XEP-0084
User Avatar.  Refs #7732, which also has another patch needing further review.

-------------- next part --------------
============================================================
--- ChangeLog	1e8ee9d12b3588b0e797295c6fa9190d81d5254c
+++ ChangeLog	d941afc72172e82da8d50685b6f77b2a2076b737
@@ -44,6 +44,8 @@ version 2.5.3 (??/??/????):
 	* Send "client-accepts-full-bind-result" attribute during SASL login.
 	  This will fix Google Talk login failures if the user configures the
 	  wrong domain for his/her account.
+	* Support new <metadata/> element to indicate no XEP-0084 User Avatar
+	  (Paul Aurich)
 	
 	Zephyr:
 	* Enable auto-reply, to emulate 'zaway' (Toby Schaffer)
============================================================
--- libpurple/protocols/jabber/buddy.c	9744ae0ad1d6bf32f1b92a36b3097d7c06e1d17d
+++ libpurple/protocols/jabber/buddy.c	5c155be406acbc3fc604806bbd0cc5b02884f101
@@ -1525,9 +1525,12 @@ void jabber_buddy_avatar_update_metadata
 		purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL);
 	} else {
 		xmlnode *info, *goodinfo = NULL;
-		
+		gboolean has_children = FALSE;
+
 		/* iterate over all info nodes to get one we can use */
 		for(info = metadata->child; info; info = info->next) {
+			if(info->type == XMLNODE_TYPE_TAG)
+				has_children = TRUE;
 			if(info->type == XMLNODE_TYPE_TAG && !strcmp(info->name,"info")) {
 				const char *type = xmlnode_get_attrib(info,"type");
 				const char *id = xmlnode_get_attrib(info,"id");
@@ -1542,7 +1545,9 @@ void jabber_buddy_avatar_update_metadata
 					goodinfo = info;
 			}
 		}
-		if(goodinfo) {
+		if(has_children == FALSE) {
+			purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL);
+		} else if(goodinfo) {
 			const char *url = xmlnode_get_attrib(goodinfo, "url");
 			const char *id = xmlnode_get_attrib(goodinfo,"id");
 			


More information about the Commits mailing list