changeset 31453:388ca4797d7b

Replace the mpop account setting with a session boolean, because I can't get a good signal for when the user changes an account setting.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 05 Dec 2010 08:13:13 +0000
parents e9afcbec8f20
children c1a162c0f4e5
files libpurple/protocols/msn/contact.c libpurple/protocols/msn/msn.c libpurple/protocols/msn/notification.c libpurple/protocols/msn/session.c libpurple/protocols/msn/session.h
diffstat 5 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Sun Dec 05 03:09:52 2010 +0000
+++ b/libpurple/protocols/msn/contact.c	Sun Dec 05 08:13:13 2010 +0000
@@ -732,9 +732,9 @@
 				value = xmlnode_get_data(xmlnode_get_child(annotation, "Value"));
 				if (!strcmp(name, "MSN.IM.MPOP")) {
 					if (!value || atoi(value) != 0)
-						purple_account_set_bool(session->account, "mpop", TRUE);
+						session->enable_mpop = TRUE;
 					else
-						purple_account_set_bool(session->account, "mpop", FALSE);
+						session->enable_mpop = FALSE;
 				}
 				g_free(name);
 				g_free(value);
--- a/libpurple/protocols/msn/msn.c	Sun Dec 05 03:09:52 2010 +0000
+++ b/libpurple/protocols/msn/msn.c	Sun Dec 05 08:13:13 2010 +0000
@@ -1173,8 +1173,7 @@
 	m = g_list_append(m, act);
 	m = g_list_append(m, NULL);
 
-	if (purple_account_get_bool(session->account, "mpop", TRUE)
-	 && session->protocol_ver >= 16)
+	if (session->enable_mpop && session->protocol_ver >= 16)
 	{
 		act = purple_plugin_action_new(_("View Locations..."),
 		                               msn_show_locations);
--- a/libpurple/protocols/msn/notification.c	Sun Dec 05 03:09:52 2010 +0000
+++ b/libpurple/protocols/msn/notification.c	Sun Dec 05 08:13:13 2010 +0000
@@ -1572,7 +1572,7 @@
 
 		/* Disconnect others, if MPOP is disabled */
 		if (is_me
-		 && !purple_account_get_bool(session->account, "mpop", TRUE)
+		 && !session->enable_mpop
 		 && strncasecmp(id + 1, session->guid, 36) != 0) {
 			purple_debug_info("msn", "Disconnecting Endpoint %s\n", id);
 
@@ -1599,7 +1599,7 @@
 		}
 	}
 
-	if (is_me && purple_account_get_bool(session->account, "mpop", TRUE)) {
+	if (is_me && session->enable_mpop) {
 		for (epNode = xmlnode_get_child(payloadNode, "PrivateEndpointData");
 		     epNode;
 		     epNode = xmlnode_get_next_twin(epNode)) {
--- a/libpurple/protocols/msn/session.c	Sun Dec 05 03:09:52 2010 +0000
+++ b/libpurple/protocols/msn/session.c	Sun Dec 05 08:13:13 2010 +0000
@@ -49,6 +49,7 @@
 	session->oim = msn_oim_new(session);
 
 	session->protocol_ver = 0;
+	session->enable_mpop = TRUE; /* Default only */
 
 	session->guid = rand_guid();
 
--- a/libpurple/protocols/msn/session.h	Sun Dec 05 03:09:52 2010 +0000
+++ b/libpurple/protocols/msn/session.h	Sun Dec 05 08:13:13 2010 +0000
@@ -83,6 +83,7 @@
 	gboolean logged_in:1; /**< A temporal flag to ignore local buddy list adds. */
 	gboolean destroying:1; /**< A flag that states if the session is being destroyed. */
 	gboolean http_method:1;
+	gboolean enable_mpop:1; /**< Use Multiple Points of Presence? */
 	int      adl_fqy; /**< A count of ADL/FQY so status is only changed once. */
 	guint    login_timeout; /**< Timeout to force status change if ADL/FQY fail. */