comparison libpurple/protocols/msn/notification.c @ 26785:bbb89d322034

Decrement the ADL/FQY count when we receive an error about a FQY for a user so that we can continue to login even with bogus email addresses. References #8588.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 02 May 2009 23:01:32 +0000
parents 0c077a605b8a
children 25d802c76536
comparison
equal deleted inserted replaced
26784:0c077a605b8a 26785:bbb89d322034
610 } 610 }
611 611
612 static void 612 static void
613 update_contact_network(MsnSession *session, const char *passport, MsnNetwork network) 613 update_contact_network(MsnSession *session, const char *passport, MsnNetwork network)
614 { 614 {
615 MsnUser *user = msn_userlist_find_user(session->userlist, passport); 615 MsnUser *user;
616
617 if (network == MSN_NETWORK_UNKNOWN)
618 {
619 purple_debug_warning("msn",
620 "Ignoring user %s about which server knows nothing.\n",
621 passport);
622 session->adl_fqy--;
623 return;
624 }
625
616 /* TODO: Also figure out how to update membership lists */ 626 /* TODO: Also figure out how to update membership lists */
627 user = msn_userlist_find_user(session->userlist, passport);
617 if (user) { 628 if (user) {
618 xmlnode *adl_node; 629 xmlnode *adl_node;
619 char *payload; 630 char *payload;
620 int payload_len; 631 int payload_len;
621 632
912 cmdproc->last_cmd->payload_cb = adl_241_error_cmd_post; 923 cmdproc->last_cmd->payload_cb = adl_241_error_cmd_post;
913 cmd->payload_len = atoi(cmd->params[1]); 924 cmd->payload_len = atoi(cmd->params[1]);
914 } 925 }
915 926
916 static void 927 static void
917 fqy_error_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len)
918 {
919 purple_debug_warning("msn", "FQY error %d: %s\n",
920 GPOINTER_TO_INT(cmd->payload_cbdata), payload);
921 }
922
923 static void
924 fqy_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error)
925 {
926 MsnCommand *cmd = cmdproc->last_cmd;
927
928 purple_debug_error("msn", "FQY error %d\n", error);
929 if (cmd->param_count > 1) {
930 cmd->payload_cb = fqy_error_parse;
931 cmd->payload_len = atoi(cmd->params[1]);
932 cmd->payload_cbdata = GINT_TO_POINTER(error);
933 }
934 }
935
936 static void
937 fqy_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, 928 fqy_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
938 size_t len) 929 size_t len)
939 { 930 {
940 MsnSession *session; 931 MsnSession *session;
941 xmlnode *ml, *d, *c; 932 xmlnode *ml, *d, *c;
960 local = xmlnode_get_attrib(c, "n"); 951 local = xmlnode_get_attrib(c, "n");
961 type = xmlnode_get_attrib(c, "t"); 952 type = xmlnode_get_attrib(c, "t");
962 953
963 passport = g_strdup_printf("%s@%s", local, domain); 954 passport = g_strdup_printf("%s@%s", local, domain);
964 955
965 if (type != NULL) 956 if (!g_ascii_isdigit(cmd->command[0]) && type != NULL)
966 network = (MsnNetwork)strtoul(type, NULL, 10); 957 network = (MsnNetwork)strtoul(type, NULL, 10);
967 else 958 else
968 network = MSN_NETWORK_PASSPORT; 959 network = MSN_NETWORK_UNKNOWN;
969 960
970 purple_debug_info("msn", "FQY response says %s is from network %d\n", 961 purple_debug_info("msn", "FQY response says %s is from network %d\n",
971 passport, network); 962 passport, network);
972 if (cmd->trans->data) 963 if (cmd->trans->data)
973 ((MsnFqyCb)cmd->trans->data)(session, passport, network); 964 ((MsnFqyCb)cmd->trans->data)(session, passport, network);
975 g_free(passport); 966 g_free(passport);
976 } 967 }
977 } 968 }
978 969
979 xmlnode_free(ml); 970 xmlnode_free(ml);
971 }
972
973 static void
974 fqy_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error)
975 {
976 MsnCommand *cmd = cmdproc->last_cmd;
977
978 purple_debug_warning("msn", "FQY error %d\n", error);
979 if (cmd->param_count > 1) {
980 cmd->payload_cb = fqy_cmd_post;
981 cmd->payload_len = atoi(cmd->params[1]);
982 cmd->payload_cbdata = GINT_TO_POINTER(error);
983 }
984 #if 0
985 /* If the server didn't send us a corresponding email address for this
986 FQY error, it's probably going to disconnect us. So it isn't necessary
987 to tell the handler about it. */
988 else if (trans->data)
989 ((MsnFqyCb)trans->data)(session, NULL, MSN_NETWORK_UNKNOWN); */
990 #endif
980 } 991 }
981 992
982 static void 993 static void
983 fqy_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) 994 fqy_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
984 { 995 {