changeset 15541:d74985add99f

This is my attempt at MSN mobile status, but I suspect MSN mobile status doesn't exist. If it's confirmed that it doesn't, I'll revert this. But I want to keep it for posterity, in case it does exist
author Sean Egan <seanegan@gmail.com>
date Sun, 04 Feb 2007 09:36:33 +0000
parents 16845e318249
children a1e0b153fc30
files libpurple/protocols/msn/msn.c libpurple/protocols/msn/user.c
diffstat 2 files changed, 26 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c	Sun Feb 04 08:25:43 2007 +0000
+++ b/libpurple/protocols/msn/msn.c	Sun Feb 04 09:36:33 2007 +0000
@@ -479,16 +479,6 @@
 	return "msn";
 }
 
-static const char* 
-msn_list_emblem(GaimBuddy *b)
-{
-	MsnUser *user;
-	user = b->proto_data;
-		if (user && user->mobile)
-			return "mobile";
-	return NULL;
-}
-
 static char *
 msn_status_text(GaimBuddy *buddy)
 {
@@ -576,7 +566,11 @@
 	status = gaim_status_type_new_full(GAIM_STATUS_OFFLINE,
 			NULL, NULL, FALSE, TRUE, FALSE);
 	types = g_list_append(types, status);
-
+	
+	status = gaim_status_type_new_full(GAIM_STATUS_MOBILE,
+			"mobile", NULL, FALSE, FALSE, TRUE);
+	types = g_list_append(types, status);
+	
 	return types;
 }
 
@@ -743,12 +737,23 @@
 			GaimMessageFlags flags)
 {
 	GaimAccount *account;
+	GaimBuddy *buddy = gaim_find_buddy(gc->account, who);
 	MsnMessage *msg;
 	char *msgformat;
 	char *msgtext;
 
 	account = gaim_connection_get_account(gc);
 
+	if (buddy) {
+	        GaimPresence *p = gaim_buddy_get_presence(buddy);
+        	if (gaim_presence_is_status_primitive_active(p, GAIM_STATUS_MOBILE)) {
+			char *text = gaim_markup_strip_html(message);
+			send_to_mobile(gc, who, text);
+			g_free(text);
+			return;
+		}
+	}
+
 	msn_import_html(message, &msgformat, &msgtext);
 
 	if (strlen(msgtext) + strlen(msgformat) + strlen(VERSION) > 1564)
@@ -1930,7 +1935,7 @@
 	NULL,					/* protocol_options */
 	{"png", 0, 0, 96, 96, 0, GAIM_ICON_SCALE_SEND},	/* icon_spec */
 	msn_list_icon,			/* list_icon */
-	msn_list_emblem,		/* list_emblems */
+	NULL,				/* list_emblems */
 	msn_status_text,		/* status_text */
 	msn_tooltip_text,		/* tooltip_text */
 	msn_status_types,		/* away_states */
--- a/libpurple/protocols/msn/user.c	Sun Feb 04 08:25:43 2007 +0000
+++ b/libpurple/protocols/msn/user.c	Sun Feb 04 09:36:33 2007 +0000
@@ -81,8 +81,15 @@
 
 	account = user->userlist->session->account;
 
-	if (user->status != NULL)
-		gaim_prpl_got_user_status(account, user->passport, user->status, NULL);
+	if (user->status != NULL) {
+		if (!strcmp(user->status, "offline") && user->mobile) {
+			gaim_prpl_got_user_status(account, user->passport, "available", NULL);
+			gaim_prpl_got_user_status(account, user->passport, "mobile", NULL);
+		} else {
+			gaim_prpl_got_user_status(account, user->passport, user->status, NULL);
+			gaim_prpl_got_user_status_deactive(account, user->passport, "mobile");
+		}
+	}
 
 	if (user->idle)
 		gaim_prpl_got_user_idle(account, user->passport, TRUE, -1);