# HG changeset patch # User Elliott Sales de Andrade # Date 1222147984 0 # Node ID 384217df4ee77a360cacb791f471f52304d298dd # Parent b5210bb72273325cb948de11b62175fbfe6e30f7# Parent f5923e2e6513c3eedc1e7c09883c2b079fc4621c merge of '092bbcea7b768d21baff3362314e784b26b1ced7' and '83e6600ffffbfc65ace650330df3f1888e33cb97' diff -r b5210bb72273 -r 384217df4ee7 libpurple/protocols/msn/notification.c --- a/libpurple/protocols/msn/notification.c Tue Sep 23 02:50:36 2008 +0000 +++ b/libpurple/protocols/msn/notification.c Tue Sep 23 05:33:04 2008 +0000 @@ -613,16 +613,13 @@ xmlnode_set_attrib(adl_node, "l", "1"); /*get the userlist*/ - for (l = session->userlist->users; l != NULL; l = l->next) { + for (l = session->userlist->users; l != NULL; l = l->next){ user = l->data; /* skip RL & PL during initial dump */ if (!(user->list_op & MSN_LIST_OP_MASK)) continue; - if (!strcmp(user->passport, "messenger@microsoft.com")) - continue; - msn_add_contact_xml(session, adl_node, user->passport, user->list_op & MSN_LIST_OP_MASK, user->networkid); @@ -774,6 +771,53 @@ } static void +adl_241_error_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, + size_t len) +{ + /* khc: some googling suggests that error 241 means the buddy is somehow + in the local list, but not the server list, and that we should add + those buddies to the addressbook. For now I will just notify the user + about the raw payload, because I am lazy */ + MsnSession *session; + PurpleAccount *account; + PurpleConnection *gc; + xmlnode *adl; + xmlnode *domain; + GString *emails; + + session = cmdproc->session; + account = session->account; + gc = purple_account_get_connection(account); + + adl = xmlnode_from_str(payload, len); + emails = g_string_new(NULL); + + domain = xmlnode_get_child(adl, "d"); + while (domain) { + const char *domain_str = xmlnode_get_attrib(domain, "n"); + xmlnode *contact = xmlnode_get_child(domain, "c"); + while (contact) { + g_string_append_printf(emails, "%s@%s\n", + xmlnode_get_attrib(contact, "n"), domain_str); + contact = xmlnode_get_next_twin(contact); + } + domain = xmlnode_get_next_twin(domain); + } + + purple_notify_error(gc, NULL, + _("The following users are missing from your addressbook"), emails->str); + g_string_free(emails, TRUE); + xmlnode_free(adl); +} + +static void +adl_241_error_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) +{ + cmdproc->last_cmd->payload_cb = adl_241_error_cmd_post; + cmd->payload_len = atoi(cmd->params[1]); +} + +static void fqy_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) { @@ -1962,6 +2006,8 @@ msn_table_add_cmd(cbs_table, "fallback", "XFR", xfr_cmd); + msn_table_add_cmd(cbs_table, NULL, "241", adl_241_error_cmd); + msn_table_add_error(cbs_table, "ADD", add_error); msn_table_add_error(cbs_table, "ADL", adl_error); msn_table_add_error(cbs_table, "REG", reg_error);