diff libpurple/protocols/jabber/disco.c @ 27062:98ff7c538e48

propagate from branch 'im.pidgin.pidgin' (head 13ac492a493b4d31c8b29905174b43a533304300) to branch 'im.pidgin.cpw.malu.client_type' (head 2952ce355b5cc07c63a105af4819f176c4c5e9b8)
author Marcus Lundblad <ml@update.uu.se>
date Sat, 02 May 2009 06:38:20 +0000
parents 3912f55a1633 eea396f1583c
children 84325b6e3568
line wrap: on
line diff
--- a/libpurple/protocols/jabber/disco.c	Wed Apr 29 17:50:14 2009 +0000
+++ b/libpurple/protocols/jabber/disco.c	Sat May 02 06:38:20 2009 +0000
@@ -20,6 +20,7 @@
  */
 
 #include "internal.h"
+#include "core.h"
 #include "prefs.h"
 #include "debug.h"
 
@@ -117,11 +118,24 @@
 			xmlnode_set_attrib(query, "node", node);
 
 		if(!node || !strcmp(node, CAPS0115_NODE "#" VERSION)) {
+			GHashTable *ui_info = purple_core_get_ui_info();
+			const gchar *ui_type = g_hash_table_lookup(ui_info, "client_type");
+			const gchar *type = "pc"; /* default client type, if unknown or
+										unspecified */
+
+			if (ui_type) {
+				if (strcmp(ui_type, "pc") == 0 ||
+					strcmp(ui_type, "console") == 0 ||
+					strcmp(ui_type, "phone") == 0 ||
+					strcmp(ui_type, "handheld") == 0 ||
+					strcmp(ui_type, "web") == 0 ||
+					strcmp(ui_type, "bot") == 0) {
+					type = ui_type;
+				}
+			}
 			identity = xmlnode_new_child(query, "identity");
 			xmlnode_set_attrib(identity, "category", "client");
-			xmlnode_set_attrib(identity, "type", "pc"); /* XXX: bot, console,
-														 * handheld, pc, phone,
-														 * web */
+			xmlnode_set_attrib(identity, "type",  type);
 			xmlnode_set_attrib(identity, "name", PACKAGE);
 		}