changeset 23611:b2609fca4943

Use "EmailEnabled" from the MSN profile message to determine whether the email inbox can be opened. References #5762.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 28 Jul 2008 05:10:48 +0000
parents 8218a2c209f1
children 7f4b697c6947
files libpurple/protocols/msn/msn.c libpurple/protocols/msn/notification.c libpurple/protocols/msn/session.h
diffstat 3 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c	Mon Jul 28 01:51:11 2008 +0000
+++ b/libpurple/protocols/msn/msn.c	Mon Jul 28 05:10:48 2008 +0000
@@ -428,6 +428,12 @@
 	gc = (PurpleConnection *) action->context;
 	session = gc->proto_data;
 
+	if (!session->passport_info.email_enabled) {
+		purple_notify_error(gc, NULL,
+						  _("This account does not have email enabled."), NULL);
+		return;
+	}
+
 	/** apparently the correct value is 777, use 750 as a failsafe */ 
 	if (time (NULL) - session->passport_info.mail_timestamp >= 750) {
 		MsnTransaction *trans;
@@ -436,16 +442,12 @@
 		cmdproc = session->notification->cmdproc;
 
 		trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX");
-		msn_transaction_set_data(trans, GUINT_TO_POINTER (TRUE));
+		msn_transaction_set_data(trans, GUINT_TO_POINTER(TRUE));
 
 		msn_cmdproc_send_trans(cmdproc, trans);
 
 	} else if (session->passport_info.file != NULL) {
 		purple_notify_uri(gc, session->passport_info.file);
-
-	} else {
-		purple_notify_error(gc, NULL,
-						  _("This Hotmail account may not be active."), NULL);
 	}
 }
 
--- a/libpurple/protocols/msn/notification.c	Mon Jul 28 01:51:11 2008 +0000
+++ b/libpurple/protocols/msn/notification.c	Mon Jul 28 05:10:48 2008 +0000
@@ -1666,6 +1666,9 @@
 	if ((value = msn_message_get_attr(msg, "LoginTime")) != NULL)
 		session->passport_info.sl = atol(value);
 
+	if ((value = msn_message_get_attr(msg, "EmailEnabled")) != NULL)
+		session->passport_info.email_enabled = (gboolean)atol(value);
+
 	/*starting retrieve the contact list*/
 	clLastChange = purple_account_get_string(session->account, "CLLastChange", NULL);
 #ifdef MSN_PARTIAL_LISTS
--- a/libpurple/protocols/msn/session.h	Mon Jul 28 01:51:11 2008 +0000
+++ b/libpurple/protocols/msn/session.h	Mon Jul 28 05:10:48 2008 +0000
@@ -119,6 +119,7 @@
 		char *client_ip;
 		int client_port;
 		gulong mail_timestamp;
+		gboolean email_enabled;
 	} passport_info;
 
 	GHashTable *soap_table;