comparison 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
comparison
equal deleted inserted replaced
24721:bba38f03085d 24722:daabf16bd511
222 char *passport = xmlnode_get_data(xmlnode_get_child(member, node)); 222 char *passport = xmlnode_get_data(xmlnode_get_child(member, node));
223 char *type = xmlnode_get_data(xmlnode_get_child(member, "Type")); 223 char *type = xmlnode_get_data(xmlnode_get_child(member, "Type"));
224 char *member_id = xmlnode_get_data(xmlnode_get_child(member, "MembershipId")); 224 char *member_id = xmlnode_get_data(xmlnode_get_child(member, "MembershipId"));
225 MsnUser *user = msn_userlist_find_add_user(session->userlist, passport, NULL); 225 MsnUser *user = msn_userlist_find_add_user(session->userlist, passport, NULL);
226 xmlnode *annotation; 226 xmlnode *annotation;
227 guint nid = MSN_NETWORK_PASSPORT; 227 guint nid = MSN_NETWORK_UNKNOWN;
228 228
229 for (annotation = xmlnode_get_child(member, "Annotations/Annotation"); 229 /* For EmailMembers, the network must be found in the annotations. */
230 annotation; 230 if (!strcmp(node, "PassportName")) {
231 annotation = xmlnode_get_next_twin(annotation)) { 231 nid = MSN_NETWORK_PASSPORT;
232 char *name = xmlnode_get_data(xmlnode_get_child(annotation, "Name")); 232 } else {
233 if (name && !strcmp(name, "MSN.IM.BuddyType")) { 233 for (annotation = xmlnode_get_child(member, "Annotations/Annotation");
234 char *value = xmlnode_get_data(xmlnode_get_child(annotation, "Value")); 234 annotation;
235 if (value != NULL) 235 annotation = xmlnode_get_next_twin(annotation)) {
236 nid = strtoul(value, NULL, 10); 236 char *name = xmlnode_get_data(xmlnode_get_child(annotation, "Name"));
237 g_free(value); 237 if (name && !strcmp(name, "MSN.IM.BuddyType")) {
238 } 238 char *value = xmlnode_get_data(xmlnode_get_child(annotation, "Value"));
239 g_free(name); 239 if (value != NULL)
240 nid = strtoul(value, NULL, 10);
241 g_free(value);
242 }
243 g_free(name);
244 }
240 } 245 }
241 246
242 purple_debug_info("msn", "CL: %s name: %s, Type: %s, MembershipID: %s, NetworkID: %u\n", 247 purple_debug_info("msn", "CL: %s name: %s, Type: %s, MembershipID: %s, NetworkID: %u\n",
243 node, passport, type, member_id == NULL ? "(null)" : member_id, nid); 248 node, passport, type, member_id == NULL ? "(null)" : member_id, nid);
244 249