comparison src/protocols/msn/contact.c @ 19836:b821d5551c30

[gaim-migrate @ 17182] change to fix the process of Phone Member TODO: need to support Phone user later committed by MaYuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Thu, 07 Sep 2006 17:32:25 +0000
parents 2fe6a673f12a
children 2b36697b05ea
comparison
equal deleted inserted replaced
19835:d99e36279d41 19836:b821d5551c30
132 char *lastchange; 132 char *lastchange;
133 133
134 session = contact->session; 134 session = contact->session;
135 gaim_debug_misc("xml","parse contact list:{%s}\nsize:%d\n",contact->soapconn->body,contact->soapconn->body_len); 135 gaim_debug_misc("xml","parse contact list:{%s}\nsize:%d\n",contact->soapconn->body,contact->soapconn->body_len);
136 node = xmlnode_from_str(contact->soapconn->body, contact->soapconn->body_len); 136 node = xmlnode_from_str(contact->soapconn->body, contact->soapconn->body_len);
137 // node = xmlnode_from_str(contact->soapconn->body, -1);
138 137
139 if(node == NULL){ 138 if(node == NULL){
140 gaim_debug_misc("xml","parse from str err!\n"); 139 gaim_debug_misc("xml","parse contact from str err!\n");
141 return; 140 return;
142 } 141 }
143 gaim_debug_misc("xml","node{%p},name:%s,child:%s,last:%s\n",node,node->name,node->child->name,node->lastchild->name); 142 gaim_debug_misc("xml","node{%p},name:%s,child:%s,last:%s\n",node,node->name,node->child->name,node->lastchild->name);
144 body = xmlnode_get_child(node,"Body"); 143 body = xmlnode_get_child(node,"Body");
145 gaim_debug_misc("xml","body{%p},name:%s\n",body,body->name); 144 gaim_debug_misc("xml","body{%p},name:%s\n",body,body->name);
331 } 330 }
332 g_free(group_name); 331 g_free(group_name);
333 g_free(group_id); 332 g_free(group_id);
334 333
335 /*Process contact List*/ 334 /*Process contact List*/
335 gaim_debug_info("MSNAB","process contact list...\n");
336 contacts =xmlnode_get_child(result,"contacts"); 336 contacts =xmlnode_get_child(result,"contacts");
337 for(contactNode = xmlnode_get_child(contacts, "Contact"); contactNode; 337 for(contactNode = xmlnode_get_child(contacts, "Contact"); contactNode;
338 contactNode = xmlnode_get_next_twin(contactNode)){ 338 contactNode = xmlnode_get_next_twin(contactNode)){
339 MsnUser *user; 339 MsnUser *user;
340 char *passport,*Name,*uid,*type; 340 char *passport,*Name,*uid,*type;
363 char *msnEnabled; 363 char *msnEnabled;
364 364
365 /*TODO: add it to the none-instant Messenger group and recognize as email Membership*/ 365 /*TODO: add it to the none-instant Messenger group and recognize as email Membership*/
366 /*Yahoo User?*/ 366 /*Yahoo User?*/
367 emailsNode = xmlnode_get_child(contactInfo,"emails"); 367 emailsNode = xmlnode_get_child(contactInfo,"emails");
368 if(emailsNode == NULL){
369 /*TODO: need to support the Mobile type*/
370 continue;
371 }
368 for(contactEmailNode = xmlnode_get_child(emailsNode,"ContactEmail");contactEmailNode; 372 for(contactEmailNode = xmlnode_get_child(emailsNode,"ContactEmail");contactEmailNode;
369 contactEmailNode = xmlnode_get_next_twin(contactEmailNode) ){ 373 contactEmailNode = xmlnode_get_next_twin(contactEmailNode) ){
370 messengerEnabledNode = xmlnode_get_child(contactEmailNode,"isMessengerEnabled"); 374 messengerEnabledNode = xmlnode_get_child(contactEmailNode,"isMessengerEnabled");
371 if(messengerEnabledNode == NULL){ 375 if(messengerEnabledNode == NULL){
372 break; 376 break;
406 410
407 user = msn_userlist_find_add_user(session->userlist, passport,Name); 411 user = msn_userlist_find_add_user(session->userlist, passport,Name);
408 msn_user_set_uid(user,uid); 412 msn_user_set_uid(user,uid);
409 msn_user_set_type(user,msn_get_user_type(type)); 413 msn_user_set_type(user,msn_get_user_type(type));
410 user->list_op |= MSN_LIST_FL_OP; 414 user->list_op |= MSN_LIST_FL_OP;
411 gaim_debug_info("MsnAB","prepare to free Name...\n");
412 g_free(Name); 415 g_free(Name);
413 gaim_debug_info("MsnAB","prepare to free passport...\n");
414 g_free(passport); 416 g_free(passport);
415 gaim_debug_info("MsnAB","prepare to free uid...\n");
416 g_free(uid); 417 g_free(uid);
417 gaim_debug_info("MsnAB","prepare to free type...\n");
418 g_free(type); 418 g_free(type);
419 419
420 gaim_debug_misc("MsnAB","prepare for guid parse...\n"); 420 gaim_debug_misc("MsnAB","parse guid...\n");
421 groupIds = xmlnode_get_child(contactInfo,"groupIds"); 421 groupIds = xmlnode_get_child(contactInfo,"groupIds");
422 if(groupIds){ 422 if(groupIds){
423 for(guid = xmlnode_get_child(groupIds, "guid");guid; 423 for(guid = xmlnode_get_child(groupIds, "guid");guid;
424 guid = xmlnode_get_next_twin(guid)){ 424 guid = xmlnode_get_next_twin(guid)){
425 group_id = xmlnode_get_data(guid); 425 group_id = xmlnode_get_data(guid);
437 437
438 abNode =xmlnode_get_child(result,"ab"); 438 abNode =xmlnode_get_child(result,"ab");
439 if(abNode != NULL){ 439 if(abNode != NULL){
440 LastChangeNode = xmlnode_get_child(abNode,"lastChange"); 440 LastChangeNode = xmlnode_get_child(abNode,"lastChange");
441 lastchange = xmlnode_get_data(LastChangeNode); 441 lastchange = xmlnode_get_data(LastChangeNode);
442 gaim_debug_info("MsnAB"," lastchange:{%s}\n",lastchange); 442 gaim_debug_info("MsnAB"," lastchanged Time:{%s}\n",lastchange);
443 } 443 }
444 444
445 xmlnode_free(node); 445 xmlnode_free(node);
446 msn_soap_free_read_buf(contact->soapconn); 446 msn_soap_free_read_buf(contact->soapconn);
447 } 447 }