diff libpurple/protocols/msn/msn.c @ 23599:ab70eae012f5

Fixup MSN mailbox handling based on a patch from Felipe, plus various other things that I cleaned up in the URL command handler. Updates are now made after at least 750 seconds because Felipe found that to be the magic value, and updating every time we receive a QNG is totally unreliable. They aren't even received when using the HTTP method, for example. Opening the inbox is now always available. I'm not sure why it was limited to just @hotmail.com and @msn.com, but I certainly haven't been testing with either of those. I think the correct way to determine if an inbox exists is to just use the URL command and see, but I don't have one of those no-inbox accounts. The initial email notification is no longer called explicitly for @hotmail.com and @msn.com accounts. I, at least, get an initial mail notification, but the rest of Felipe's patch negates the need to do this, anyway. References #5762.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 17 Jul 2008 05:25:48 +0000
parents 25aec47d9671
children aade89b06762
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c	Thu Jul 17 04:52:32 2008 +0000
+++ b/libpurple/protocols/msn/msn.c	Thu Jul 17 05:25:48 2008 +0000
@@ -428,14 +428,25 @@
 	gc = (PurpleConnection *) action->context;
 	session = gc->proto_data;
 
-	if (session->passport_info.file == NULL)
-	{
+	/** apparently the correct value is 777, use 750 as a failsafe */ 
+	if (time (NULL) - session->passport_info.mail_timestamp >= 750) {
+		MsnTransaction *trans;
+		MsnCmdProc *cmdproc;
+
+		cmdproc = session->notification->cmdproc;
+
+		trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX");
+		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);
-		return;
 	}
-
-	purple_notify_uri(gc, session->passport_info.file);
 }
 
 static void
@@ -824,10 +835,6 @@
 static GList *
 msn_actions(PurplePlugin *plugin, gpointer context)
 {
-	PurpleConnection *gc = (PurpleConnection *)context;
-	PurpleAccount *account;
-	const char *user;
-
 	GList *m = NULL;
 	PurplePluginAction *act;
 
@@ -867,17 +874,10 @@
 	m = g_list_append(m, act);
 #endif
 
-	account = purple_connection_get_account(gc);
-	user = msn_normalize(account, purple_account_get_username(account));
-
-	if ((strstr(user, "@hotmail.") != NULL) ||
-		(strstr(user, "@msn.com") != NULL))
-	{
-		m = g_list_append(m, NULL);
-		act = purple_plugin_action_new(_("Open Hotmail Inbox"),
-				msn_show_hotmail_inbox);
-		m = g_list_append(m, act);
-	}
+	m = g_list_append(m, NULL);
+	act = purple_plugin_action_new(_("Open Hotmail Inbox"),
+			msn_show_hotmail_inbox);
+	m = g_list_append(m, act);
 
 	return m;
 }