comparison libpurple/protocols/msn/contact.c @ 24515:f1936abe1616

Get the MSN buddy's network ID from the FindMembership response. References #6755.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 01 Dec 2008 05:21:39 +0000
parents e88f30b437ad
children ff275531cbf2
comparison
equal deleted inserted replaced
24514:e88f30b437ad 24515:f1936abe1616
221 { 221 {
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 226 xmlnode *annotation;
227 purple_debug_info("msn", "CL: %s name: %s, Type: %s, MembershipID: %s\n", 227 guint nid = MSN_NETWORK_PASSPORT;
228 node, passport, type, member_id == NULL ? "(null)" : member_id); 228
229 for (annotation = xmlnode_get_child(member, "Annotations/Annotation");
230 annotation;
231 annotation = xmlnode_get_next_twin(annotation)) {
232 char *name = xmlnode_get_data(xmlnode_get_child(annotation, "Name"));
233 if (name && !strcmp(name, "MSN.IM.BuddyType")) {
234 char *value = xmlnode_get_data(xmlnode_get_child(annotation, "Value"));
235 if (value != NULL)
236 nid = strtoul(value, NULL, 10);
237 g_free(value);
238 }
239 g_free(name);
240 }
241
242 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);
244
245 msn_user_set_network(user, nid);
229 246
230 if (member_id) { 247 if (member_id) {
231 user->membership_id[list] = atoi(member_id); 248 user->membership_id[list] = atoi(member_id);
232 } 249 }
233 250