cpw.malu.client_type: 5c51de85: S?tt client type on MSN.

malu at pidgin.im malu at pidgin.im
Tue Feb 10 15:30:40 EST 2009


-----------------------------------------------------------------
Revision: 5c51de850198f962f69b002e0750d918deb8bcfe
Ancestor: 9213b5f683680ad5a42aaf46e0b77b78262eed7a
Author: malu at pidgin.im
Date: 2009-02-10T20:27:21
Branch: im.pidgin.cpw.malu.client_type
URL: http://d.pidgin.im/viewmtn/revision/info/5c51de850198f962f69b002e0750d918deb8bcfe

Modified files:
        libpurple/protocols/msn/state.c

ChangeLog: 

S?tt client type on MSN.
Have currently tested the "mobile" type. It is reported correctly to other
libpurple clients and the official WLM client.
Haven't tested other statuses yet...

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/state.c	20d101ad1027026e1c2339e6d591a5ece38399f0
+++ libpurple/protocols/msn/state.c	19a4b77159b80018d1d4574a4416ebb2df3f9e55
@@ -21,6 +21,10 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
+
+#include "internal.h"
+#include "core.h"
+
 #include "msn.h"
 #include "state.h"
 
@@ -288,10 +292,29 @@ msn_change_status(MsnSession *session)
 	MsnUser *user;
 	MsnObject *msnobj;
 	const char *state_text;
-
+	GHashTable *ui_info = purple_core_get_ui_info();
+	MsnClientCaps caps = MSN_CLIENT_ID;
+	
 	g_return_if_fail(session != NULL);
 	g_return_if_fail(session->notification != NULL);
 
+	/* set client caps based on what the UI tells us it is... */
+	if (ui_info) {
+		const gchar *client_type = g_hash_table_lookup(ui_info, "client_type");
+		if (client_type) {
+			if (strcmp(client_type, "phone") == 0 ||
+				strcmp(client_type, "handheld") == 0) {
+				caps |= MSN_CLIENT_CAP_WIN_MOBILE;
+			} else if (strcmp(client_type, "web")) {
+				caps |= MSN_CLIENT_CAP_WEBMSGR;
+			} else if (strcmp(client_type, "bot")) {
+				caps |= MSN_CLIENT_CAP_BOT;
+			}
+			/* MSN doesn't a "console" type... 
+			 What, they have no ncurses UI? :-) */
+		}
+	}
+	
 	account = session->account;
 	cmdproc = session->notification->cmdproc;
 	user = session->user;
@@ -307,8 +330,7 @@ msn_change_status(MsnSession *session)
 
 	if (msnobj == NULL)
 	{
-		msn_cmdproc_send(cmdproc, "CHG", "%s %d", state_text,
-						 MSN_CLIENT_ID);
+		msn_cmdproc_send(cmdproc, "CHG", "%s %d", state_text, caps);
 	}
 	else
 	{
@@ -317,7 +339,7 @@ msn_change_status(MsnSession *session)
 		msnobj_str = msn_object_to_string(msnobj);
 
 		msn_cmdproc_send(cmdproc, "CHG", "%s %d %s", state_text,
-						 MSN_CLIENT_ID, purple_url_encode(msnobj_str));
+						 caps, purple_url_encode(msnobj_str));
 
 		g_free(msnobj_str);
 	}


More information about the Commits mailing list