changeset 31435:05b3fa3725a1

Read the MPOP setting from the AB. Refs #13017.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 02 Dec 2010 06:14:19 +0000
parents 7bf659dbacee
children 1546ad4f93b3
files libpurple/protocols/msn/contact.c libpurple/protocols/msn/msn.c
diffstat 2 files changed, 26 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Thu Dec 02 06:04:55 2010 +0000
+++ b/libpurple/protocols/msn/contact.c	Thu Dec 02 06:14:19 2010 +0000
@@ -710,8 +710,9 @@
 		uid = xmlnode_get_data(contactId);
 		type = xmlnode_get_data(contactType);
 
-		/*setup the Display Name*/
+		/* Find out our settings */
 		if (type && !strcmp(type, "Me")) {
+			/* setup the Display Name */
 			if (purple_connection_get_display_name(pc) == NULL) {
 				char *friendly = NULL;
 				if ((displayName = xmlnode_get_child(contactInfo, "displayName")))
@@ -720,6 +721,23 @@
 					friendly ? purple_url_decode(friendly) : NULL);
 				g_free(friendly);
 			}
+
+			for (annotation = xmlnode_get_child(contactInfo, "annotations/Annotation");
+			     annotation;
+			     annotation = xmlnode_get_next_twin(annotation)) {
+				char *name, *value;
+				name = xmlnode_get_data(xmlnode_get_child(annotation, "Name"));
+				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);
+					else
+						purple_account_set_bool(session->account, "mpop", FALSE);
+				}
+				g_free(name);
+				g_free(value);
+			}
+
 			continue; /* Not adding own account as buddy to buddylist */
 		}
 
--- a/libpurple/protocols/msn/msn.c	Thu Dec 02 06:04:55 2010 +0000
+++ b/libpurple/protocols/msn/msn.c	Thu Dec 02 06:14:19 2010 +0000
@@ -1201,7 +1201,8 @@
 	m = g_list_append(m, act);
 	m = g_list_append(m, NULL);
 
-	if (session->protocol_ver >= 16)
+	if (purple_account_get_bool(session->account, "mpop", TRUE)
+	 && session->protocol_ver >= 16)
 	{
 		act = purple_plugin_action_new(_("View Locations..."),
 		                               msn_show_locations);
@@ -3085,6 +3086,11 @@
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
 											   option);
 
+	option = purple_account_option_bool_new(_("Allow connecting from multiple locations"),
+										  "mpop", TRUE);
+	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
+											   option);
+
 	purple_cmd_register("nudge", "", PURPLE_CMD_P_PRPL,
 	                  PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY,
 	                 "prpl-msn", msn_cmd_nudge,