Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/buddy.c @ 24640:915b1cafa3d1
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.
committer: John Bailey <rekkanoryo@rekkanoryo.org>
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Thu, 11 Dec 2008 07:38:20 +0000 |
parents | 5f597914cd01 |
children | 61e0924de04a |
comparison
equal
deleted
inserted
replaced
24639:0e397f185166 | 24640:915b1cafa3d1 |
---|---|
1523 /* check if we have received a stop */ | 1523 /* check if we have received a stop */ |
1524 if(xmlnode_get_child(metadata, "stop")) { | 1524 if(xmlnode_get_child(metadata, "stop")) { |
1525 purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL); | 1525 purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL); |
1526 } else { | 1526 } else { |
1527 xmlnode *info, *goodinfo = NULL; | 1527 xmlnode *info, *goodinfo = NULL; |
1528 | 1528 gboolean has_children = FALSE; |
1529 | |
1529 /* iterate over all info nodes to get one we can use */ | 1530 /* iterate over all info nodes to get one we can use */ |
1530 for(info = metadata->child; info; info = info->next) { | 1531 for(info = metadata->child; info; info = info->next) { |
1532 if(info->type == XMLNODE_TYPE_TAG) | |
1533 has_children = TRUE; | |
1531 if(info->type == XMLNODE_TYPE_TAG && !strcmp(info->name,"info")) { | 1534 if(info->type == XMLNODE_TYPE_TAG && !strcmp(info->name,"info")) { |
1532 const char *type = xmlnode_get_attrib(info,"type"); | 1535 const char *type = xmlnode_get_attrib(info,"type"); |
1533 const char *id = xmlnode_get_attrib(info,"id"); | 1536 const char *id = xmlnode_get_attrib(info,"id"); |
1534 | 1537 |
1535 if(checksum && id && !strcmp(id, checksum)) { | 1538 if(checksum && id && !strcmp(id, checksum)) { |
1540 /* We'll only pick the png one for now. It's a very nice image format anyways. */ | 1543 /* We'll only pick the png one for now. It's a very nice image format anyways. */ |
1541 if(type && id && !goodinfo && !strcmp(type, "image/png")) | 1544 if(type && id && !goodinfo && !strcmp(type, "image/png")) |
1542 goodinfo = info; | 1545 goodinfo = info; |
1543 } | 1546 } |
1544 } | 1547 } |
1545 if(goodinfo) { | 1548 if(has_children == FALSE) { |
1549 purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL); | |
1550 } else if(goodinfo) { | |
1546 const char *url = xmlnode_get_attrib(goodinfo, "url"); | 1551 const char *url = xmlnode_get_attrib(goodinfo, "url"); |
1547 const char *id = xmlnode_get_attrib(goodinfo,"id"); | 1552 const char *id = xmlnode_get_attrib(goodinfo,"id"); |
1548 | 1553 |
1549 /* the avatar might either be stored in a pep node, or on a HTTP/HTTPS URL */ | 1554 /* the avatar might either be stored in a pep node, or on a HTTP/HTTPS URL */ |
1550 if(!url) | 1555 if(!url) |