comparison libpurple/protocols/jabber/jabber.c @ 26586:608493e51182

propagate from branch 'im.pidgin.pidgin' (head 580055bb22fea0076d3a90d9df9346abd1789bab) to branch 'im.pidgin.cpw.malu.client_type' (head ca6f339669ed597f2e930f0bfed45861ab81ef36)
author Marcus Lundblad <ml@update.uu.se>
date Mon, 13 Apr 2009 13:36:00 +0000
parents df9042312063 eea396f1583c
children 74dcea0f8457
comparison
equal deleted inserted replaced
26566:8c3b1a059ecc 26586:608493e51182
1651 const char* jabber_list_emblem(PurpleBuddy *b) 1651 const char* jabber_list_emblem(PurpleBuddy *b)
1652 { 1652 {
1653 JabberStream *js; 1653 JabberStream *js;
1654 JabberBuddy *jb = NULL; 1654 JabberBuddy *jb = NULL;
1655 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(b)); 1655 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(b));
1656 1656
1657 if(!gc) 1657 if(!gc)
1658 return NULL; 1658 return NULL;
1659 1659
1660 js = gc->proto_data; 1660 js = gc->proto_data;
1661 if(js) 1661 if(js)
1664 if(!PURPLE_BUDDY_IS_ONLINE(b)) { 1664 if(!PURPLE_BUDDY_IS_ONLINE(b)) {
1665 if(jb && (jb->subscription & JABBER_SUB_PENDING || 1665 if(jb && (jb->subscription & JABBER_SUB_PENDING ||
1666 !(jb->subscription & JABBER_SUB_TO))) 1666 !(jb->subscription & JABBER_SUB_TO)))
1667 return "not-authorized"; 1667 return "not-authorized";
1668 } 1668 }
1669
1670 if (jb) {
1671 JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, NULL);
1672 if (jbr) {
1673 const gchar *client_type =
1674 jabber_resource_get_identity_category_type(jbr, "client");
1675
1676 if (client_type) {
1677 if (strcmp(client_type, "phone") == 0) {
1678 return "mobile";
1679 } else if (strcmp(client_type, "web") == 0) {
1680 return "external";
1681 } else if (strcmp(client_type, "handheld") == 0) {
1682 return "hiptop";
1683 } else if (strcmp(client_type, "bot") == 0) {
1684 return "bot";
1685 }
1686 /* the default value "pc" falls through and has no emblem */
1687 }
1688 }
1689 }
1690
1669 return NULL; 1691 return NULL;
1670 } 1692 }
1671 1693
1672 char *jabber_status_text(PurpleBuddy *b) 1694 char *jabber_status_text(PurpleBuddy *b)
1673 { 1695 {