Mercurial > pidgin
changeset 23560:aade89b06762
merge of '5e33eda76b698c04377f5ad6cdd3ad1ec87d2eff'
and 'e935afc929a5049cfa89072e6e9dd8e3ab0afa54'
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Thu, 17 Jul 2008 05:26:47 +0000 |
parents | ab70eae012f5 (diff) 3ba2cddc49f0 (current diff) |
children | bdb38a8bf721 a97c1628c803 |
files | libpurple/protocols/msn/msn.c |
diffstat | 6 files changed, 58 insertions(+), 83 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/cmdproc.c Thu Jul 17 04:53:32 2008 +0000 +++ b/libpurple/protocols/msn/cmdproc.c Thu Jul 17 05:26:47 2008 +0000 @@ -263,7 +263,7 @@ MsnTransaction *trans = NULL; if (cmd->trId) - trans = msn_history_find(cmdproc->history, cmd->trId); + cmd->trans = trans = msn_history_find(cmdproc->history, cmd->trId); if (trans != NULL) if (trans->timer) { @@ -309,8 +309,6 @@ if (cb == NULL && trans != NULL) { - cmd->trans = trans; - if (trans->callbacks != NULL) cb = g_hash_table_lookup(trans->callbacks, cmd->command); }
--- a/libpurple/protocols/msn/msn.c Thu Jul 17 04:53:32 2008 +0000 +++ b/libpurple/protocols/msn/msn.c Thu Jul 17 05:26:47 2008 +0000 @@ -428,14 +428,25 @@ gc = (PurpleConnection *) action->context; session = gc->proto_data; - if (session->passport_info.file == NULL) - { + /** apparently the correct value is 777, use 750 as a failsafe */ + if (time (NULL) - session->passport_info.mail_timestamp >= 750) { + MsnTransaction *trans; + MsnCmdProc *cmdproc; + + cmdproc = session->notification->cmdproc; + + trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX"); + msn_transaction_set_data(trans, GUINT_TO_POINTER (TRUE)); + + msn_cmdproc_send_trans(cmdproc, trans); + + } else if (session->passport_info.file != NULL) { + purple_notify_uri(gc, session->passport_info.file); + + } else { purple_notify_error(gc, NULL, _("This Hotmail account may not be active."), NULL); - return; } - - purple_notify_uri(gc, session->passport_info.file); } static void @@ -824,10 +835,6 @@ static GList * msn_actions(PurplePlugin *plugin, gpointer context) { - PurpleConnection *gc = (PurpleConnection *)context; - PurpleAccount *account; - const char *user; - GList *m = NULL; PurplePluginAction *act; @@ -867,17 +874,10 @@ m = g_list_append(m, act); #endif - account = purple_connection_get_account(gc); - user = msn_normalize(account, purple_account_get_username(account)); - - if ((strstr(user, "@hotmail.") != NULL) || - (strstr(user, "@msn.com") != NULL)) - { - m = g_list_append(m, NULL); - act = purple_plugin_action_new(_("Open Hotmail Inbox"), - msn_show_hotmail_inbox); - m = g_list_append(m, act); - } + m = g_list_append(m, NULL); + act = purple_plugin_action_new(_("Open Hotmail Inbox"), + msn_show_hotmail_inbox); + m = g_list_append(m, act); return m; }
--- a/libpurple/protocols/msn/notification.c Thu Jul 17 04:53:32 2008 +0000 +++ b/libpurple/protocols/msn/notification.c Thu Jul 17 05:26:47 2008 +0000 @@ -918,29 +918,7 @@ static void qng_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { - MsnSession *session; - static int count = 0; - const char *passport; - PurpleAccount *account; - - session = cmdproc->session; - account = session->account; - - if (session->passport_info.file == NULL) - return; - - passport = purple_normalize(account, purple_account_get_username(account)); - - if ((strstr(passport, "@hotmail.") == NULL) && - (strstr(passport, "@live.com") == NULL) && - (strstr(passport, "@msn.com") == NULL)) - return; - - if (count++ < 26) - return; - - count = 0; - msn_cmdproc_send(cmdproc, "URL", "%s", "INBOX"); + /* TODO: Call PNG after the timeout specified. */ } @@ -1273,46 +1251,39 @@ url_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { MsnSession *session; + PurpleConnection *gc; PurpleAccount *account; const char *rru; const char *url; - PurpleCipher *cipher; - PurpleCipherContext *context; - guchar digest[16]; + PurpleCipherContext *cipher; + gchar digest[33]; FILE *fd; char *buf; - char buf2[3]; - char sendbuf[64]; - int i; + + gulong tmp_timestamp; session = cmdproc->session; account = session->account; + gc = account->gc; rru = cmd->params[1]; url = cmd->params[2]; + session->passport_info.mail_timestamp = time(NULL); + tmp_timestamp = session->passport_info.mail_timestamp - session->passport_info.sl; + buf = g_strdup_printf("%s%lu%s", session->passport_info.mspauth ? session->passport_info.mspauth : "BOGUS", - time(NULL) - session->passport_info.sl, - purple_connection_get_password(account->gc)); + tmp_timestamp, + purple_connection_get_password(gc)); - cipher = purple_ciphers_find_cipher("md5"); - context = purple_cipher_context_new(cipher, NULL); - - purple_cipher_context_append(context, (const guchar *)buf, strlen(buf)); - purple_cipher_context_digest(context, sizeof(digest), digest, NULL); - purple_cipher_context_destroy(context); + cipher = purple_cipher_context_new_by_name("md5", NULL); + purple_cipher_context_append(cipher, (const guchar *)buf, strlen(buf)); + purple_cipher_context_digest_to_str(cipher, sizeof(digest), digest, NULL); + purple_cipher_context_destroy(cipher); g_free(buf); - memset(sendbuf, 0, sizeof(sendbuf)); - - for (i = 0; i < 16; i++) - { - g_snprintf(buf2, sizeof(buf2), "%02x", digest[i]); - strcat(sendbuf, buf2); - } - if (session->passport_info.file != NULL) { g_unlink(session->passport_info.file); @@ -1324,6 +1295,11 @@ purple_debug_error("msn", "Error opening temp passport file: %s\n", g_strerror(errno)); + /* The user wanted to check his or her email */ + if (cmd->trans && cmd->trans->data) + /* TODO: This error might be a bit technical... */ + purple_notify_error(gc, NULL, + _("Error opening temporary passport file."), NULL); } else { @@ -1355,14 +1331,14 @@ session->passport_info.kv); fprintf(fd, "<input type=\"hidden\" name=\"id\" value=\"2\">\n"); fprintf(fd, "<input type=\"hidden\" name=\"sl\" value=\"%ld\">\n", - time(NULL) - session->passport_info.sl); + tmp_timestamp); fprintf(fd, "<input type=\"hidden\" name=\"rru\" value=\"%s\">\n", rru); if (session->passport_info.mspauth != NULL) fprintf(fd, "<input type=\"hidden\" name=\"auth\" value=\"%s\">\n", session->passport_info.mspauth); fprintf(fd, "<input type=\"hidden\" name=\"creds\" value=\"%s\">\n", - sendbuf); /* TODO Digest me (huh? -- ChipX86) */ + digest); /* TODO Digest me (huh? -- ChipX86) */ fprintf(fd, "<input type=\"hidden\" name=\"svc\" value=\"mail\">\n"); fprintf(fd, "<input type=\"hidden\" name=\"js\" value=\"yes\">\n"); fprintf(fd, "</form></body>\n"); @@ -1374,6 +1350,12 @@ "Error closing temp passport file: %s\n", g_strerror(errno)); + /* The user wanted to check his or her email */ + if (cmd->trans && cmd->trans->data) + /* TODO: This error might be a bit technical... */ + purple_notify_error(gc, NULL, + _("Error closing temporary passport file."), NULL); + g_unlink(session->passport_info.file); g_free(session->passport_info.file); session->passport_info.file = NULL; @@ -1402,6 +1384,10 @@ } } #endif + + /* The user wants to check his or her email */ + if (cmd->trans && cmd->trans->data) + purple_notify_uri(purple_account_get_connection(account), session->passport_info.file); } } /**************************************************************************
--- a/libpurple/protocols/msn/oim.c Thu Jul 17 04:53:32 2008 +0000 +++ b/libpurple/protocols/msn/oim.c Thu Jul 17 05:26:47 2008 +0000 @@ -138,6 +138,9 @@ xmlnode *fault = NULL; xmlnode *faultcode = NULL; + if (response == NULL) + return; + fault = xmlnode_get_child(response->xml, "Body/Fault"); if (fault) faultcode = xmlnode_get_child(fault, "faultcode");
--- a/libpurple/protocols/msn/session.c Thu Jul 17 04:53:32 2008 +0000 +++ b/libpurple/protocols/msn/session.c Thu Jul 17 05:26:47 2008 +0000 @@ -454,7 +454,6 @@ PurpleAccount *account; PurpleConnection *gc; PurpleStoredImage *img; - const char *passport; if (session->logged_in) return; @@ -474,17 +473,5 @@ /* Sync users */ msn_session_sync_users(session); - /* It seems that some accounts that haven't accessed hotmail for a while - * and @msn.com accounts don't automatically get the initial email - * notification so we always request it on login - */ - - passport = purple_normalize(account, purple_account_get_username(account)); - - if ((strstr(passport, "@hotmail.") != NULL) || - (strstr(passport, "@msn.com") != NULL)) - { - msn_cmdproc_send(session->notification->cmdproc, "URL", "%s", "INBOX"); - } }