diff libpurple/protocols/jabber/jabber.c @ 26635:74dcea0f8457

propagate from branch 'im.pidgin.pidgin' (head 6a70c2c1325aeb644bff8476f94c5a25f83044fb) to branch 'im.pidgin.cpw.malu.client_type' (head 7c96aa78766153d2bb38bed68a658b3c86d90845)
author Marcus Lundblad <ml@update.uu.se>
date Wed, 22 Apr 2009 07:53:27 +0000
parents d00a8111e479 608493e51182
children bbf174c5d331
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Tue Apr 21 22:17:18 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Wed Apr 22 07:53:27 2009 +0000
@@ -1653,7 +1653,7 @@
 	JabberStream *js;
 	JabberBuddy *jb = NULL;
 	PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(b));
-
+	
 	if(!gc)
 		return NULL;
 
@@ -1666,6 +1666,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;
 }