summaryrefslogtreecommitdiff
path: root/protocols/MSN/src/msn_mail.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/MSN/src/msn_mail.cpp')
-rw-r--r--protocols/MSN/src/msn_mail.cpp54
1 files changed, 28 insertions, 26 deletions
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp
index c5e0b593d1..0c36aa4c65 100644
--- a/protocols/MSN/src/msn_mail.cpp
+++ b/protocols/MSN/src/msn_mail.cpp
@@ -1,5 +1,7 @@
/*
Plugin of Miranda IM for communicating with users of the MSN Messenger protocol.
+
+Copyright (c) 2012-2013 Miranda NG Team
Copyright (c) 2007-2012 Boris Krasnovskiy.
This program is free software; you can redistribute it and/or
@@ -20,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "msn_proto.h"
static const char oimRecvUrl[] = "https://rsi.hotmail.com/rsi/rsi.asmx";
-static const char mailReqHdr[] =
+static const char mailReqHdr[] =
"SOAPAction: \"http://www.hotmail.msn.com/ws/2004/09/oim/rsi/%s\"\r\n";
ezxml_t CMsnProto::oimRecvHdr(const char* service, ezxml_t& tbdy, char*& httphdr)
@@ -29,7 +31,7 @@ ezxml_t CMsnProto::oimRecvHdr(const char* service, ezxml_t& tbdy, char*& httphdr
ezxml_set_attr(xmlp, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
ezxml_set_attr(xmlp, "xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
ezxml_set_attr(xmlp, "xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
-
+
ezxml_t hdr = ezxml_add_child(xmlp, "soap:Header", 0);
ezxml_t cook = ezxml_add_child(hdr, "PassportCookie", 0);
ezxml_set_attr(cook, "xmlns", "http://www.hotmail.msn.com/ws/2004/09/oim/rsi");
@@ -39,7 +41,7 @@ ezxml_t CMsnProto::oimRecvHdr(const char* service, ezxml_t& tbdy, char*& httphdr
ezxml_set_txt(pcook, pAuthToken ? pAuthToken : "");
ezxml_t bdy = ezxml_add_child(xmlp, "soap:Body", 0);
-
+
tbdy = ezxml_add_child(bdy, service, 0);
ezxml_set_attr(tbdy, "xmlns", "http://www.hotmail.msn.com/ws/2004/09/oim/rsi");
@@ -102,8 +104,8 @@ void CMsnProto::getOIMs(ezxml_t xmli)
txtParseParam(arrTime, "FILETIME", "[", "]", szTime, sizeof(szTime));
unsigned filetimeLo = strtoul(szTime, &p, 16);
- if (*p == ':')
- {
+ if (*p == ':')
+ {
unsigned __int64 filetime = strtoul(p+1, &p, 16);
filetime <<= 32;
filetime |= filetimeLo;
@@ -126,7 +128,7 @@ void CMsnProto::getOIMs(ezxml_t xmli)
ezxml_t delmid = ezxml_add_child(delmids, "messageId", 0);
ezxml_set_txt(delmid, szId);
-
+
ezxml_free(xmlm);
}
mir_free(tResult);
@@ -134,11 +136,11 @@ void CMsnProto::getOIMs(ezxml_t xmli)
}
ezxml_free(xmlreq);
mir_free(getReqHdr);
-
+
if (ezxml_child(delmids, "messageId") != NULL)
{
char* szData = ezxml_toxml(xmldel, true);
-
+
unsigned status;
char* url = (char*)mir_strdup(oimRecvUrl);
@@ -231,7 +233,7 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial)
const char* DestFolder = tFileInfo["Dest-Folder"];
const char* InboxUnread = tFileInfo["Inbox-Unread"];
const char* FoldersUnread = tFileInfo["Folders-Unread"];
-
+
if (InboxUnread != NULL)
mUnreadMessages = atol(InboxUnread);
if (FoldersUnread != NULL)
@@ -253,9 +255,9 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial)
if (mUnreadMessages < 0) mUnreadMessages = 0;
}
- if (From != NULL && Subject != NULL && Fromaddr != NULL)
+ if (From != NULL && Subject != NULL && Fromaddr != NULL)
{
- if (DestFolder != NULL && SrcFolder == NULL)
+ if (DestFolder != NULL && SrcFolder == NULL)
{
mUnreadMessages += strcmp(DestFolder, "ACTIVE") == 0;
mUnreadJunkEmails += strcmp(DestFolder, "HM_BuLkMail_") == 0;
@@ -277,7 +279,7 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial)
mir_free(mimeSubjectW);
ShowPopUp = true;
}
- else
+ else
{
const char* MailData = tFileInfo["Mail-Data"];
if (MailData != NULL) processMailData((char*)MailData);
@@ -331,12 +333,12 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial)
}
else
msgurl = "inbox";
-
+
char szUrl[256];
mir_snprintf(szUrl, sizeof(szUrl), "http://mail.live.com?rru=%s", msgurl);
- MSN_ShowPopup(tBuffer, tBuffer2,
- MSN_ALLOW_ENTER | MSN_ALLOW_MSGBOX | MSN_HOTMAIL_POPUP,
+ MSN_ShowPopup(tBuffer, tBuffer2,
+ MSN_ALLOW_ENTER | MSN_ALLOW_MSGBOX | MSN_HOTMAIL_POPUP,
szUrl);
}
@@ -344,22 +346,22 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial)
return;
char mailerpath[MAX_PATH];
- if (!getStaticString(NULL, "MailerPath", mailerpath, sizeof(mailerpath)))
+ if (!getStaticString(NULL, "MailerPath", mailerpath, sizeof(mailerpath)))
{
- if (mailerpath[0])
+ if (mailerpath[0])
{
char* tParams = NULL;
char* tCmd = mailerpath;
- if (*tCmd == '\"')
+ if (*tCmd == '\"')
{
- ++tCmd;
+ ++tCmd;
char* tEndPtr = strchr(tCmd, '\"');
- if (tEndPtr != NULL)
+ if (tEndPtr != NULL)
{
*tEndPtr = 0;
tParams = tEndPtr+1;
- }
+ }
}
if (tParams == NULL)
@@ -373,7 +375,7 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial)
MSN_DebugLog("Running mailer \"%s\" with params \"%s\"", tCmd, tParams);
ShellExecuteA(NULL, "open", tCmd, tParams, NULL, TRUE);
}
- }
+ }
}
static void TruncUtf8(char *str, size_t sz)
@@ -385,12 +387,12 @@ static void TruncUtf8(char *str, size_t sz)
for (;;)
{
unsigned char p = (unsigned char)str[cnt];
-
+
if (p >= 0xE0) cnt += 3;
else if (p >= 0xC0) cnt += 2;
else if (p != 0) ++cnt;
else break;
-
+
if (cnt <= sz) cntl = cnt;
else break;
}
@@ -409,12 +411,12 @@ void CMsnProto::displayEmailCount(HANDLE hContact)
{
ch = _tcschr(ch+1, '[');
}
- while (ch && !_istdigit(ch[1]));
+ while (ch && !_istdigit(ch[1]));
if (ch) *ch = 0;
trtrim(name);
TCHAR szNick[128];
- mir_sntprintf(szNick, SIZEOF(szNick),
+ mir_sntprintf(szNick, SIZEOF(szNick),
getByte("DisableHotmailJunk", 0) ? _T("%s [%d]") : _T("%s [%d][%d]"), name, mUnreadMessages, mUnreadJunkEmails);
nickChg = true;