diff libpurple/protocols/jabber/disco.c @ 26431:cec679e45332

propagate from branch 'im.pidgin.pidgin' (head 1890ad1259c93f5ad18ceb3365717ebc43b30198) to branch 'im.pidgin.cpw.malu.client_type' (head b6ea0287ea89cd8de944b91d6226ef3329704d6c)
author Marcus Lundblad <ml@update.uu.se>
date Sat, 04 Apr 2009 11:18:39 +0000
parents e23a74d7c97c ae2b4394fbe2
children eea396f1583c
line wrap: on
line diff
--- a/libpurple/protocols/jabber/disco.c	Fri Apr 03 20:46:31 2009 +0000
+++ b/libpurple/protocols/jabber/disco.c	Sat Apr 04 11:18:39 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);
 
 			SUPPORT_FEATURE("jabber:iq:last")