diff libpurple/protocols/jabber/jabber.c @ 25836:1d3274111180

Set a value "type" in the ui_info hash table Set client type in resonse to an XMPP XEP-0115 request (client type). Makes Pidgin report itself as "pc", Finch as "console" Display emblems on XMPP buddies corresponding to their client type (if available). Currently there is no emblem for "console"
author Marcus Lundblad <ml@update.uu.se>
date Mon, 09 Feb 2009 21:21:18 +0000
parents 256fbe98f6be
children 3a0c2526364f
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sun Feb 08 10:34:31 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Mon Feb 09 21:21:18 2009 +0000
@@ -1620,7 +1620,7 @@
 {
 	JabberStream *js;
 	JabberBuddy *jb = NULL;
-
+	
 	if(!b->account->gc)
 		return NULL;
 
@@ -1633,6 +1633,28 @@
 					!(jb->subscription & JABBER_SUB_TO)))
 			return "not-authorized";
 	}
+	
+	if (jb) {
+		JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, NULL);
+		if (jbr) {
+			const gchar *client_type = 
+				jabber_resource_get_identity_category_type(jbr, "client");
+		
+			if (client_type) {
+				if (strcmp(client_type, "phone") == 0) {
+					return "mobile";
+				} else if (strcmp(client_type, "web") == 0) {
+					return "external";
+				} else if (strcmp(client_type, "handheld") == 0) {
+					return "hiptop";
+				} else if (strcmp(client_type, "bot") == 0) {
+					return "bot";
+				}
+				/* the default value "pc" falls through and has no emblem */
+			}
+		}
+	}
+		
 	return NULL;
 }