diff libpurple/protocols/msn/contact.c @ 24722:daabf16bd511

When getting the privacy lists, set the default network to unknown. If the buddy is a PassportMember, then the network is Passport, otherwise it is obtained from the MSN.IM.BuddyType annotation. Next change fixes the case where there is no annotation (if the buddy was added with older version of Pidgin, perhaps). References #3322. References #6755.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 14 Dec 2008 05:22:52 +0000
parents 98afd76647bd
children b4b76f6a2b27
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Sun Dec 14 04:09:23 2008 +0000
+++ b/libpurple/protocols/msn/contact.c	Sun Dec 14 05:22:52 2008 +0000
@@ -224,19 +224,24 @@
 	char *member_id = xmlnode_get_data(xmlnode_get_child(member, "MembershipId"));
 	MsnUser *user = msn_userlist_find_add_user(session->userlist, passport, NULL);
 	xmlnode *annotation;
-	guint nid = MSN_NETWORK_PASSPORT;
+	guint nid = MSN_NETWORK_UNKNOWN;
 
-	for (annotation = xmlnode_get_child(member, "Annotations/Annotation");
-	     annotation;
-	     annotation = xmlnode_get_next_twin(annotation)) {
-		char *name = xmlnode_get_data(xmlnode_get_child(annotation, "Name"));
-		if (name && !strcmp(name, "MSN.IM.BuddyType")) {
-			char *value = xmlnode_get_data(xmlnode_get_child(annotation, "Value"));
-			if (value != NULL)
-				nid = strtoul(value, NULL, 10);
-			g_free(value);
+	/* For EmailMembers, the network must be found in the annotations. */
+	if (!strcmp(node, "PassportName")) {
+		nid = MSN_NETWORK_PASSPORT;
+	} else {
+		for (annotation = xmlnode_get_child(member, "Annotations/Annotation");
+		     annotation;
+		     annotation = xmlnode_get_next_twin(annotation)) {
+			char *name = xmlnode_get_data(xmlnode_get_child(annotation, "Name"));
+			if (name && !strcmp(name, "MSN.IM.BuddyType")) {
+				char *value = xmlnode_get_data(xmlnode_get_child(annotation, "Value"));
+				if (value != NULL)
+					nid = strtoul(value, NULL, 10);
+				g_free(value);
+			}
+			g_free(name);
 		}
-		g_free(name);
 	}
  
 	purple_debug_info("msn", "CL: %s name: %s, Type: %s, MembershipID: %s, NetworkID: %u\n",