diff 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
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sun Apr 12 23:57:27 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Mon Apr 13 13:36:00 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;
 }