Mercurial > pidgin.yaz
comparison libpurple/protocols/msn/contact.c @ 23523:31b5a1334e7e
Modifications to the MSN code for some stuff I'll be doing in later
commits.
* Rename MsnUserType to MsnNetwork, because it's a really a Network
ID. Updated the list of networks based on msnpiki.
* Updated list of Client capabilities based on ZoRoNaX' blog:
http://zoronax.spaces.live.com/blog/cns!4A0B813054895814!156.entry
* Save the clientid of contacts.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 15 Jun 2008 08:08:22 +0000 |
parents | 70de4e2246ec |
children | 711773577380 |
comparison
equal
deleted
inserted
replaced
23522:fd124c21ebb7 | 23523:31b5a1334e7e |
---|---|
174 return MSN_LIST_PL; | 174 return MSN_LIST_PL; |
175 } | 175 } |
176 return 0; | 176 return 0; |
177 } | 177 } |
178 | 178 |
179 /*get User Type*/ | 179 /* get Network */ |
180 static int | 180 /* QuLogic: These names don't really refer to the MsnNetwork, |
181 msn_get_user_type(char *type) | 181 * but I haven't yet written the code to properly use them. |
182 */ | |
183 static MsnNetwork | |
184 msn_get_network(char *type) | |
182 { | 185 { |
183 g_return_val_if_fail(type != NULL, 0); | 186 g_return_val_if_fail(type != NULL, 0); |
184 | 187 |
185 if (!strcmp(type,"Regular")) { | 188 if (!strcmp(type,"Regular")) { |
186 return MSN_USER_TYPE_PASSPORT; | 189 return MSN_NETWORK_PASSPORT; |
187 } | 190 } |
188 if (!strcmp(type,"Live")) { | 191 if (!strcmp(type,"Live")) { |
189 return MSN_USER_TYPE_PASSPORT; | 192 return MSN_NETWORK_PASSPORT; |
190 } | 193 } |
191 if (!strcmp(type,"LivePending")) { | 194 if (!strcmp(type,"LivePending")) { |
192 return MSN_USER_TYPE_PASSPORT; | 195 return MSN_NETWORK_PASSPORT; |
193 } | 196 } |
194 | 197 |
195 return MSN_USER_TYPE_UNKNOWN; | 198 return MSN_NETWORK_UNKNOWN; |
196 } | 199 } |
197 | 200 |
198 /* Create the AddressBook in the server, if we don't have one */ | 201 /* Create the AddressBook in the server, if we don't have one */ |
199 static void | 202 static void |
200 msn_create_address_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) | 203 msn_create_address_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) |
517 for(contactNode = xmlnode_get_child(node, "Contact"); contactNode; | 520 for(contactNode = xmlnode_get_child(node, "Contact"); contactNode; |
518 contactNode = xmlnode_get_next_twin(contactNode)) { | 521 contactNode = xmlnode_get_next_twin(contactNode)) { |
519 xmlnode *contactId, *contactInfo, *contactType, *passportName, *displayName, *guid, *groupIds, *messenger_user; | 522 xmlnode *contactId, *contactInfo, *contactType, *passportName, *displayName, *guid, *groupIds, *messenger_user; |
520 xmlnode *annotation; | 523 xmlnode *annotation; |
521 MsnUser *user; | 524 MsnUser *user; |
522 MsnUserType usertype; | 525 MsnNetwork networkId; |
523 | 526 |
524 if (!(contactId = xmlnode_get_child(contactNode,"contactId")) | 527 if (!(contactId = xmlnode_get_child(contactNode,"contactId")) |
525 || !(contactInfo = xmlnode_get_child(contactNode, "contactInfo")) | 528 || !(contactInfo = xmlnode_get_child(contactNode, "contactInfo")) |
526 || !(contactType = xmlnode_get_child(contactInfo, "contactType"))) | 529 || !(contactType = xmlnode_get_child(contactInfo, "contactType"))) |
527 continue; | 530 continue; |
558 } | 561 } |
559 | 562 |
560 g_free(is_messenger_user); | 563 g_free(is_messenger_user); |
561 } | 564 } |
562 | 565 |
563 usertype = msn_get_user_type(type); | 566 networkId = msn_get_network(type); |
564 passportName = xmlnode_get_child(contactInfo, "passportName"); | 567 passportName = xmlnode_get_child(contactInfo, "passportName"); |
565 if (passportName == NULL) { | 568 if (passportName == NULL) { |
566 xmlnode *emailsNode, *contactEmailNode, *emailNode; | 569 xmlnode *emailsNode, *contactEmailNode, *emailNode; |
567 xmlnode *messengerEnabledNode; | 570 xmlnode *messengerEnabledNode; |
568 char *msnEnabled; | 571 char *msnEnabled; |
589 } | 592 } |
590 | 593 |
591 if(msnEnabled && !strcmp(msnEnabled, "true")) { | 594 if(msnEnabled && !strcmp(msnEnabled, "true")) { |
592 /*Messenger enabled, Get the Passport*/ | 595 /*Messenger enabled, Get the Passport*/ |
593 purple_debug_info("MsnAB", "Yahoo User %s\n", passport ? passport : "(null)"); | 596 purple_debug_info("MsnAB", "Yahoo User %s\n", passport ? passport : "(null)"); |
594 usertype = MSN_USER_TYPE_YAHOO; | 597 networkId = MSN_NETWORK_YAHOO; |
595 g_free(msnEnabled); | 598 g_free(msnEnabled); |
596 break; | 599 break; |
597 } else { | 600 } else { |
598 /*TODO maybe we can just ignore it in Purple?*/ | 601 /*TODO maybe we can just ignore it in Purple?*/ |
599 purple_debug_info("MSNAB", "Other type user\n"); | 602 purple_debug_info("MSNAB", "Other type user\n"); |
628 passport, uid ? uid : "(null)", Name ? Name : "(null)", alias ? alias : "(null)", | 631 passport, uid ? uid : "(null)", Name ? Name : "(null)", alias ? alias : "(null)", |
629 mobile ? "true" : "false", mobile_number ? mobile_number : "(null)"); | 632 mobile ? "true" : "false", mobile_number ? mobile_number : "(null)"); |
630 | 633 |
631 user = msn_userlist_find_add_user(session->userlist, passport, Name); | 634 user = msn_userlist_find_add_user(session->userlist, passport, Name); |
632 msn_user_set_uid(user, uid); | 635 msn_user_set_uid(user, uid); |
633 msn_user_set_type(user, usertype); | 636 msn_user_set_network(user, networkId); |
634 msn_user_set_mobile_phone(user, mobile_number); | 637 msn_user_set_mobile_phone(user, mobile_number); |
635 | 638 |
636 groupIds = xmlnode_get_child(contactInfo, "groupIds"); | 639 groupIds = xmlnode_get_child(contactInfo, "groupIds"); |
637 if (groupIds) { | 640 if (groupIds) { |
638 for (guid = xmlnode_get_child(groupIds, "guid"); guid; | 641 for (guid = xmlnode_get_child(groupIds, "guid"); guid; |