pidgin: e5b07531: Handle the InvalidPassportUser response ...
qulogic at pidgin.im
qulogic at pidgin.im
Wed Dec 10 01:56:34 EST 2008
-----------------------------------------------------------------
Revision: e5b0753145f1d3c56ef6da9fa5dcf398a67b01da
Ancestor: 374aef47944a3580ae746fb9ebb726bbff9b4eb4
Author: qulogic at pidgin.im
Date: 2008-12-08T00:14:46
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e5b0753145f1d3c56ef6da9fa5dcf398a67b01da
Modified files:
libpurple/protocols/msn/contact.c
ChangeLog:
Handle the InvalidPassportUser response when adding buddies and report it to
the user. The buddy is also dropped from the userlist to avoid sync errors at
next login.
Also handle InvalidPassportUser and EmailDomainIsFederated in the "add contact
to group" response (in addition to plain "add contact").
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/contact.c 1df4ce9be34f8cc10743e7c665e863394989ca73
+++ libpurple/protocols/msn/contact.c cc55867c07da8a09252f00bb8797522909d7f148
@@ -948,29 +948,38 @@ msn_add_contact_read_cb(MsnSoapMessage *
xmlnode *fault;
+ g_return_if_fail(session != NULL);
+ userlist = session->userlist;
+
fault = xmlnode_get_child(resp->xml, "Body/Fault");
if (fault != NULL) {
char *errorcode = xmlnode_get_data(xmlnode_get_child(fault, "detail/errorcode"));
- char *fault_str;
if (errorcode && !strcmp(errorcode, "EmailDomainIsFederated")) {
/* Do something special! */
purple_debug_error("msn", "Contact is from a federated domain, but don't know what to do yet!\n");
- }
- /* We don't know how to respond to this faultcode, so log it */
- fault_str = xmlnode_to_str(fault, NULL);
- if (fault_str != NULL) {
- purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n",
- msn_contact_operation_str(state->action), fault_str);
- g_free(fault_str);
- return;
+ } else if (errorcode && !strcmp(errorcode, "InvalidPassportUser")) {
+ PurpleBuddy *buddy = purple_find_buddy(session->account, state->who);
+ char *str = g_strdup_printf(_("Unable to add \"%s\"."), state->who);
+ purple_notify_error(state->session, _("Buddy Add error"), str,
+ _("The username specified does not exist."));
+ g_free(str);
+ msn_userlist_rem_buddy(userlist, state->who);
+ if (buddy != NULL)
+ purple_blist_remove_buddy(buddy);
+
+ } else {
+ /* We don't know how to respond to this faultcode, so log it */
+ char *fault_str = xmlnode_to_str(fault, NULL);
+ if (fault_str != NULL) {
+ purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n",
+ msn_contact_operation_str(state->action), fault_str);
+ g_free(fault_str);
+ }
}
+ return;
}
- g_return_if_fail(session != NULL);
-
- userlist = session->userlist;
-
purple_debug_info("msn", "Contact added successfully\n");
/* the code this block is replacing didn't send ADL for yahoo contacts,
@@ -1033,21 +1042,42 @@ msn_add_contact_to_group_read_cb(MsnSoap
gpointer data)
{
MsnCallbackState *state = data;
+ MsnSession *session = state->session;
MsnUserList *userlist;
xmlnode *fault;
- /* We don't know how to respond to this faultcode, so log it */
+ g_return_if_fail(session != NULL);
+ userlist = session->userlist;
+
fault = xmlnode_get_child(resp->xml, "Body/Fault");
if (fault != NULL) {
- char *fault_str = xmlnode_to_str(fault, NULL);
- purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n",
- msn_contact_operation_str(state->action), fault_str);
- g_free(fault_str);
+ char *errorcode = xmlnode_get_data(xmlnode_get_child(fault, "detail/errorcode"));
+ if (errorcode && !strcmp(errorcode, "EmailDomainIsFederated")) {
+ /* Do something special! */
+ purple_debug_error("msn", "Contact is from a federated domain, but don't know what to do yet!\n");
+
+ } else if (errorcode && !strcmp(errorcode, "InvalidPassportUser")) {
+ PurpleBuddy *buddy = purple_find_buddy(session->account, state->who);
+ char *str = g_strdup_printf(_("Unable to add \"%s\"."), state->who);
+ purple_notify_error(session, _("Buddy Add error"), str,
+ _("The username specified does not exist."));
+ g_free(str);
+ msn_userlist_rem_buddy(userlist, state->who);
+ if (buddy != NULL)
+ purple_blist_remove_buddy(buddy);
+
+ } else {
+ /* We don't know how to respond to this faultcode, so log it */
+ char *fault_str = xmlnode_to_str(fault, NULL);
+ if (fault_str != NULL) {
+ purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n",
+ msn_contact_operation_str(state->action), fault_str);
+ g_free(fault_str);
+ }
+ }
return;
}
- userlist = state->session->userlist;
-
if (msn_userlist_add_buddy_to_group(userlist, state->who,
state->new_group_name)) {
purple_debug_info("msn", "Contact %s added to group %s successfully!\n", state->who, state->new_group_name);
More information about the Commits
mailing list