diff libpurple/protocols/msn/notification.c @ 31124:c1e44e9a1110

Support sending different client types in PrivateEndpointData.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Tue, 15 Dec 2009 04:32:49 +0000
parents dd430f788bdc
children 4c8bd8efacb8
line wrap: on
line diff
--- a/libpurple/protocols/msn/notification.c	Tue Dec 15 03:58:03 2009 +0000
+++ b/libpurple/protocols/msn/notification.c	Tue Dec 15 04:32:49 2009 +0000
@@ -22,6 +22,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
 #include "msn.h"
+#include "core.h"
 #include "notification.h"
 #include "contact.h"
 #include "state.h"
@@ -1847,6 +1848,8 @@
 	const char *name;
 	xmlnode *epname;
 	xmlnode *idle;
+	GHashTable *ui_info;
+	const gchar *ui_type;
 	xmlnode *client_type;
 	xmlnode *state;
 	char *payload;
@@ -1861,7 +1864,6 @@
 	idle = xmlnode_new_child(private, "Idle");
 	xmlnode_insert_data(idle, "false", -1);
 
-	/* TODO: support different client types */
 	/* ClientType info (from amsn guys):
 		0: None
 		1: Computer
@@ -1872,7 +1874,22 @@
 		32: Email member, currently Yahoo!
 	*/
 	client_type = xmlnode_new_child(private, "ClientType");
-	xmlnode_insert_data(client_type, "1", -1);
+	ui_info = purple_core_get_ui_info();
+	ui_type = ui_info ? g_hash_table_lookup(ui_info, "client_type") : NULL;
+	if (ui_type) {
+		if (strcmp(ui_type, "pc") == 0)
+			xmlnode_insert_data(client_type, "1", -1);
+		else if (strcmp(ui_type, "web") == 0)
+			xmlnode_insert_data(client_type, "2", -1);
+		else if (strcmp(ui_type, "phone") == 0)
+			xmlnode_insert_data(client_type, "3", -1);
+		else if (strcmp(ui_type, "handheld") == 0)
+			xmlnode_insert_data(client_type, "3", -1);
+		else
+			xmlnode_insert_data(client_type, "1", -1);
+	}
+	else
+		xmlnode_insert_data(client_type, "1", -1);
 
 	state = xmlnode_new_child(private, "State");
 	xmlnode_insert_data(state, msn_state_get_text(msn_state_from_account(session->account)), -1);