diff libpurple/protocols/jabber/jabber.c @ 25978:ae2b4394fbe2

propagate from branch 'im.pidgin.pidgin' (head 431618de0f30a6938f7e14d2d61ee5d7738acd59) to branch 'im.pidgin.cpw.malu.client_type' (head a9b32a46f44ffe217f92a67f05d9f80dd21f6a9e)
author Marcus Lundblad <ml@update.uu.se>
date Mon, 02 Mar 2009 21:25:59 +0000
parents 5f9a24d1c25e 3a0c2526364f
children 00eb738116ae
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Mon Mar 02 16:34:05 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Mon Mar 02 21:25:59 2009 +0000
@@ -1634,7 +1634,7 @@
 	JabberStream *js;
 	JabberBuddy *jb = NULL;
 	PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(b));
-
+	
 	if(!gc)
 		return NULL;
 
@@ -1647,6 +1647,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;
 }