comparison libpurple/protocols/msn/contact.c @ 31764:9eb5b85c7089

Don't request the AB if getting the contact list failed. Either there's no AB, so it'll be created first, or a partial update failed, and the contact list will be requested again.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 08 Aug 2011 21:43:19 +0000
parents 69094d578a45
children 10e5000326a5 e091c8ea292e
comparison
equal deleted inserted replaced
31763:f33200f71cc3 31764:9eb5b85c7089
472 g_free(type_str); 472 g_free(type_str);
473 } 473 }
474 } 474 }
475 475
476 /*parse contact list*/ 476 /*parse contact list*/
477 static void 477 static gboolean
478 msn_parse_contact_list(MsnSession *session, xmlnode *node) 478 msn_parse_contact_list(MsnSession *session, xmlnode *node)
479 { 479 {
480 xmlnode *fault, *faultnode; 480 xmlnode *fault, *faultnode;
481 481
482 /* we may get a response if our cache data is too old: 482 /* we may get a response if our cache data is too old:
497 char *errorcode = xmlnode_get_data(faultnode); 497 char *errorcode = xmlnode_get_data(faultnode);
498 498
499 if (g_str_equal(errorcode, "ABDoesNotExist")) { 499 if (g_str_equal(errorcode, "ABDoesNotExist")) {
500 msn_create_address_book(session); 500 msn_create_address_book(session);
501 g_free(errorcode); 501 g_free(errorcode);
502 return; 502 return FALSE;
503 } 503 }
504 504
505 g_free(errorcode); 505 g_free(errorcode);
506 } 506 }
507 507
508 msn_get_contact_list(session, MSN_PS_INITIAL, NULL); 508 msn_get_contact_list(session, MSN_PS_INITIAL, NULL);
509 return FALSE;
509 } else { 510 } else {
510 xmlnode *service; 511 xmlnode *service;
511 512
512 for (service = xmlnode_get_child(node, "Body/FindMembershipResponse/" 513 for (service = xmlnode_get_child(node, "Body/FindMembershipResponse/"
513 "FindMembershipResult/Services/Service"); 514 "FindMembershipResult/Services/Service");
514 service; service = xmlnode_get_next_twin(service)) { 515 service; service = xmlnode_get_next_twin(service)) {
515 msn_parse_each_service(session, service); 516 msn_parse_each_service(session, service);
516 } 517 }
518 return TRUE;
517 } 519 }
518 } 520 }
519 521
520 static void 522 static void
521 msn_get_contact_list_cb(MsnSoapMessage *req, MsnSoapMessage *resp, 523 msn_get_contact_list_cb(MsnSoapMessage *req, MsnSoapMessage *resp,
532 const char *dynamicItemLastChange; 534 const char *dynamicItemLastChange;
533 #endif 535 #endif
534 536
535 purple_debug_misc("msn", "Got the contact list!\n"); 537 purple_debug_misc("msn", "Got the contact list!\n");
536 538
537 msn_parse_contact_list(session, resp->xml); 539 if (msn_parse_contact_list(session, resp->xml)) {
538 #ifdef MSN_PARTIAL_LISTS 540 #ifdef MSN_PARTIAL_LISTS
539 abLastChange = purple_account_get_string(session->account, 541 abLastChange = purple_account_get_string(session->account,
540 "ablastChange", NULL); 542 "ablastChange", NULL);
541 dynamicItemLastChange = purple_account_get_string(session->account, 543 dynamicItemLastChange = purple_account_get_string(session->account,
542 "DynamicItemLastChanged", NULL); 544 "DynamicItemLastChanged", NULL);
543 #endif 545 #endif
544 546
545 if (state->partner_scenario == MSN_PS_INITIAL) { 547 if (state->partner_scenario == MSN_PS_INITIAL) {
546 #ifdef MSN_PARTIAL_LISTS 548 #ifdef MSN_PARTIAL_LISTS
547 /* XXX: this should be enabled when we can correctly do partial 549 /* XXX: this should be enabled when we can correctly do partial
548 syncs with the server. Currently we need to retrieve the whole 550 syncs with the server. Currently we need to retrieve the whole
549 list to detect sync issues */ 551 list to detect sync issues */
550 msn_get_address_book(session, MSN_PS_INITIAL, abLastChange, dynamicItemLastChange); 552 msn_get_address_book(session, MSN_PS_INITIAL, abLastChange, dynamicItemLastChange);
551 #else 553 #else
552 msn_get_address_book(session, MSN_PS_INITIAL, NULL, NULL); 554 msn_get_address_book(session, MSN_PS_INITIAL, NULL, NULL);
553 #endif 555 #endif
556 }
554 } 557 }
555 } 558 }
556 } 559 }
557 560
558 /*SOAP get contact list*/ 561 /*SOAP get contact list*/