changeset 5372:fa0217bec87e

[gaim-migrate @ 5748] The mobile state should now reflect the server under all cases. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 14 May 2003 07:50:26 +0000
parents daaeaf4696a1
children 0436e39c70cf
files src/protocols/msn/msn.c src/protocols/msn/notification.c src/protocols/msn/state.h src/protocols/msn/user.h
diffstat 4 files changed, 35 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/msn.c	Wed May 14 07:24:56 2003 +0000
+++ b/src/protocols/msn/msn.c	Wed May 14 07:50:26 2003 +0000
@@ -255,10 +255,13 @@
 msn_list_emblems(struct buddy *b, char **se, char **sw,
 				 char **nw, char **ne)
 {
+	MsnUser *user;
 	char *emblems[4] = { NULL, NULL, NULL, NULL };
 	int away_type = MSN_AWAY_TYPE(b->uc);
 	int i = 0;
 
+	user = b->proto_data;
+
 	if (b->present == GAIM_BUDDY_OFFLINE)
 		emblems[i++] = "offline";
 	else if (away_type == MSN_BUSY || away_type == MSN_PHONE)
@@ -266,7 +269,7 @@
 	else if (away_type != 0)
 		emblems[i++] = "away";
 
-	if (MSN_MOBILE(b->uc))
+	if (user->mobile)
 		emblems[i++] = "wireless";
 
 	*se = emblems[0];
@@ -368,13 +371,15 @@
 static GList *
 msn_buddy_menu(struct gaim_connection *gc, const char *who)
 {
+	MsnUser *user;
 	struct proto_buddy_menu *pbm;
 	struct buddy *b;
 	GList *m = NULL;
 
 	b = gaim_find_buddy(gc->account, who);
+	user = b->proto_data;
 
-	if (MSN_MOBILE(b->uc)) {
+	if (user->mobile) {
 		pbm = g_new0(struct proto_buddy_menu, 1);
 		pbm->label    = _("Send to Mobile");
 		pbm->callback = __show_send_to_mobile_cb;
--- a/src/protocols/msn/notification.c	Wed May 14 07:24:56 2003 +0000
+++ b/src/protocols/msn/notification.c	Wed May 14 07:50:26 2003 +0000
@@ -433,9 +433,7 @@
 {
 	MsnSession *session = servconn->session;
 	struct gaim_connection *gc = session->account->gc;
-	struct buddy *b;
 	const char *passport, *type, *value;
-	int status = 0;
 	MsnUser *user;
 
 	passport = params[1];
@@ -445,18 +443,10 @@
 	user = msn_users_find_with_passport(session->users, passport);
 
 	if (value != NULL) {
-		if (!strcmp(type, "MOB")) {
-			if ((b = gaim_find_buddy(gc->account, passport)) != NULL) {
-				if (GAIM_BUDDY_IS_ONLINE(b)) {
-					if (!strcmp(value, "Y"))
-						status = (b->uc | (1 << 5));
-					else if (!strcmp(value, "N"))
-						status = (b->uc ^ (1 << 5));
-
-					serv_got_update(gc, (char *)passport, 1, 0, 0, 0, status);
-				}
-			}
-		}
+		if (!strcmp(type, "MOB"))
+			user->mobile = (!strcmp(value, "Y"));
+		else if (!strcmp(type, "MBE"))
+			user->allow_pages = (!strcmp(value, "Y"));
 		else if (!strcmp(type, "PHH"))
 			msn_user_set_home_phone(user, msn_url_decode(value));
 		else if (!strcmp(type, "PHW"))
@@ -465,6 +455,15 @@
 			msn_user_set_mobile_phone(user, msn_url_decode(value));
 	}
 
+	if (!strcmp(type, "MOB") || !strcmp(type, "MBE")) {
+		struct buddy *b;
+
+		if ((b = gaim_find_buddy(gc->account, passport)) != NULL) {
+			if (GAIM_BUDDY_IS_ONLINE(b))
+				serv_got_update(gc, (char *)passport, 1, 0, 0, 0, b->uc);
+		}
+	}
+
 	return TRUE;
 }
 
@@ -669,7 +668,7 @@
 		while (session->lists.forward != NULL) {
 			MsnUser *user = session->lists.forward->data;
 			struct buddy *b;
-			
+
 			b = gaim_find_buddy(gc->account, msn_user_get_passport(user));
 
 			session->lists.forward = g_slist_remove(session->lists.forward,
@@ -709,11 +708,11 @@
 				b = gaim_buddy_new(gc->account,
 								   msn_user_get_passport(user), NULL);
 
-				b->proto_data = user;
-
 				gaim_blist_add_buddy(b, g, NULL);
 			}
 
+			b->proto_data = user;
+
 			serv_got_alias(gc, (char *)msn_user_get_passport(user),
 						   (char *)msn_user_get_name(user));
 		}
--- a/src/protocols/msn/state.h	Wed May 14 07:24:56 2003 +0000
+++ b/src/protocols/msn/state.h	Wed May 14 07:50:26 2003 +0000
@@ -39,15 +39,7 @@
 
 } MsnAwayType;
 
-/*
- * 0 0 0 0 0 0 0 0
- *     | `--_--'
- *     |    +----- Away state
- *     |
- *     +--- Mobile flag
- */
 #define MSN_AWAY_TYPE(x)   (((x) >> 1) & 0x0F)
-#define MSN_MOBILE(x)      (((x) >> 5) & 0x01)
 
 /**
  * Returns the string representation of an away type.
--- a/src/protocols/msn/user.h	Wed May 14 07:24:56 2003 +0000
+++ b/src/protocols/msn/user.h	Wed May 14 07:50:26 2003 +0000
@@ -32,24 +32,27 @@
  */
 struct _MsnUser
 {
-	MsnSession *session;    /**< The MSN session.        */
+	MsnSession *session;    /**< The MSN session.           */
 
-	char *passport;         /**< The passport account.   */
-	char *name;             /**< The friendly name.      */
+	char *passport;         /**< The passport account.      */
+	char *name;             /**< The friendly name.         */
 
 	struct
 	{
-		char *home;         /**< Home phone number.      */
-		char *work;         /**< Work phone number.      */
-		char *mobile;       /**< Mobile phone number.    */
+		char *home;         /**< Home phone number.         */
+		char *work;         /**< Work phone number.         */
+		char *mobile;       /**< Mobile phone number.       */
 
 	} phone;
 
-	int group_id;           /**< The group ID.           */
+	gboolean allow_pages;   /**< Allows mobile messages.    */
+	gboolean mobile;        /**< Signed up with MSN Mobile. */
 
-	size_t ref_count;       /**< The reference count.    */
+	int group_id;           /**< The group ID.              */
 
-	GHashTable *clientinfo; /**< The client information. */
+	size_t ref_count;       /**< The reference count.       */
+
+	GHashTable *clientinfo; /**< The client information.    */
 };
 
 /**