diff options
Diffstat (limited to 'protocols/MSN')
37 files changed, 872 insertions, 801 deletions
diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp index 0212259279..2dee47d58e 100644 --- a/protocols/MSN/src/msn.cpp +++ b/protocols/MSN/src/msn.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -51,7 +53,7 @@ static const PLUGININFOEX pluginInfo = "borkra@miranda-im.org",
"© 2001-2012 Richard Hughes, George Hazan, Boris Krasnovskiy",
"http://miranda-ng.org/",
- UNICODE_AWARE,
+ UNICODE_AWARE,
// {97724AF9-F3FB-47d3-A3BF-EAA935C74E6D}
{0x97724af9, 0xf3fb, 0x47d3, {0xa3, 0xbf, 0xea, 0xa9, 0x35, 0xc7, 0x4e, 0x6d}}
};
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index 32bbe01e0d..9b99df7a53 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.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
@@ -25,14 +27,14 @@ static const char defaultPassportUrl[] = "https://login.live.com/RST2.srf"; static const char authPacket[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<s:Envelope"
- " xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\""
- " xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\""
- " xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\""
+ " xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\""
+ " xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\""
+ " xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\""
" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\""
- " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\""
+ " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\""
" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\""
- " xmlns:wssc=\"http://schemas.xmlsoap.org/ws/2005/02/sc\""
- " xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\">"
+ " xmlns:wssc=\"http://schemas.xmlsoap.org/ws/2005/02/sc\""
+ " xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\">"
"<s:Header>"
"<wsa:Action s:mustUnderstand=\"1\">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</wsa:Action>"
"<wsa:To s:mustUnderstand=\"1\">HTTPS://login.live.com:443//RST2.srf</wsa:To>"
@@ -166,38 +168,38 @@ int CMsnProto::MSN_GetPassportAuth(void) unsigned status;
tResult = getSslResult(&szPassportHost, szAuthInfo, NULL, status);
- if (tResult == NULL)
+ if (tResult == NULL)
{
- if (defaultUrlAllow)
+ if (defaultUrlAllow)
{
strcpy(szPassportHost, defaultPassportUrl);
defaultUrlAllow = false;
continue;
}
- else
+ else
{
retVal = 4;
break;
- }
+ }
}
switch (status)
{
- case 200:
+ case 200:
{
- const char *errurl = NULL;
+ const char *errurl = NULL;
ezxml_t xml = ezxml_parse_str(tResult, strlen(tResult));
- ezxml_t tokr = ezxml_get(xml, "S:Body", 0,
+ ezxml_t tokr = ezxml_get(xml, "S:Body", 0,
"wst:RequestSecurityTokenResponseCollection", 0,
"wst:RequestSecurityTokenResponse", -1);
-
+
while (tokr != NULL)
{
- ezxml_t toks = ezxml_get(tokr, "wst:RequestedSecurityToken", 0,
+ ezxml_t toks = ezxml_get(tokr, "wst:RequestedSecurityToken", 0,
"wsse:BinarySecurityToken", -1);
-
- const char* addr = ezxml_txt(ezxml_get(tokr, "wsp:AppliesTo", 0,
+
+ const char* addr = ezxml_txt(ezxml_get(tokr, "wsp:AppliesTo", 0,
"wsa:EndpointReference", 0, "wsa:Address", -1));
if (strcmp(addr, "http://Passport.NET/tb") == 0)
@@ -205,18 +207,18 @@ int CMsnProto::MSN_GetPassportAuth(void) ezxml_t node = ezxml_get(tokr, "wst:RequestedSecurityToken", 0, "EncryptedData", -1);
free(hotAuthToken);
hotAuthToken = ezxml_toxml(node, 0);
-
+
node = ezxml_get(tokr, "wst:RequestedProofToken", 0, "wst:BinarySecret", -1);
replaceStr(hotSecretToken, ezxml_txt(node));
}
else if (strcmp(addr, "messengerclear.live.com") == 0)
{
- ezxml_t node = ezxml_get(tokr, "wst:RequestedProofToken", 0,
+ ezxml_t node = ezxml_get(tokr, "wst:RequestedProofToken", 0,
"wst:BinarySecret", -1);
if (toks)
{
replaceStr(authStrToken, ezxml_txt(toks));
- replaceStr(authSecretToken, ezxml_txt(node));
+ replaceStr(authSecretToken, ezxml_txt(node));
retVal = 0;
}
else
@@ -246,7 +248,7 @@ int CMsnProto::MSN_GetPassportAuth(void) replaceStr(authStorageToken, ezxml_txt(toks));
}
- tokr = ezxml_next(tokr);
+ tokr = ezxml_next(tokr);
}
if (retVal != 0)
@@ -287,18 +289,18 @@ int CMsnProto::MSN_GetPassportAuth(void) break;
}
default:
- if (defaultUrlAllow)
+ if (defaultUrlAllow)
{
strcpy(szPassportHost, defaultPassportUrl);
defaultUrlAllow = false;
}
- else
+ else
retVal = 6;
}
mir_free(tResult);
}
- if (retVal != 0)
+ if (retVal != 0)
{
if (!Miranda_Terminated())
{
@@ -335,7 +337,7 @@ void hmac_sha1 (mir_sha1_byte_t *md, mir_sha1_byte_t *key, size_t keylen, mir_sh unsigned char k_ipad[SHA_BLOCKSIZE], k_opad[SHA_BLOCKSIZE];
mir_sha1_ctx ctx;
- if (keylen > SHA_BLOCKSIZE)
+ if (keylen > SHA_BLOCKSIZE)
{
mir_sha1_init(&ctx);
mir_sha1_append(&ctx, key, (int)keylen);
@@ -349,7 +351,7 @@ void hmac_sha1 (mir_sha1_byte_t *md, mir_sha1_byte_t *key, size_t keylen, mir_sh memset(k_ipad+keylen, 0x36, SHA_BLOCKSIZE - keylen);
memset(k_opad+keylen, 0x5c, SHA_BLOCKSIZE - keylen);
- for (unsigned i = 0; i < keylen; i++)
+ for (unsigned i = 0; i < keylen; i++)
{
k_ipad[i] ^= 0x36;
k_opad[i] ^= 0x5c;
@@ -403,8 +405,8 @@ typedef struct tag_MsgrUsrKeyHdr unsigned long cipherLen;
} MsgrUsrKeyHdr;
-static const MsgrUsrKeyHdr userKeyHdr =
-{
+static const MsgrUsrKeyHdr userKeyHdr =
+{
sizeof(MsgrUsrKeyHdr),
1, // CRYPT_MODE_CBC
0x6603, // CALG_3DES
@@ -429,7 +431,7 @@ static unsigned char* PKCS5_Padding(char* in, size_t &len) }
-char* CMsnProto::GenerateLoginBlob(char* challenge)
+char* CMsnProto::GenerateLoginBlob(char* challenge)
{
const size_t keylen = strlen(authSecretToken);
size_t key1len = Netlib_GetBase64DecodedBufferSize(keylen);
@@ -437,7 +439,7 @@ char* CMsnProto::GenerateLoginBlob(char* challenge) NETLIBBASE64 nlb = { authSecretToken, (int)keylen, key1, (int)key1len };
CallService(MS_NETLIB_BASE64DECODE, 0, LPARAM(&nlb));
- key1len = nlb.cbDecoded;
+ key1len = nlb.cbDecoded;
mir_sha1_byte_t key2[MIR_SHA1_HASH_SIZE+4];
mir_sha1_byte_t key3[MIR_SHA1_HASH_SIZE+4];
@@ -500,7 +502,7 @@ char* CMsnProto::HotmailLogin(const char* url) NETLIBBASE64 nlb = { hotSecretToken, (int)hotSecretlen, key1, (int)key1len };
CallService(MS_NETLIB_BASE64DECODE, 0, LPARAM(&nlb));
- key1len = nlb.cbDecoded;
+ key1len = nlb.cbDecoded;
static const unsigned char encdata[] = "WS-SecureConversation";
const size_t data1len = sizeof(nonce) + sizeof(encdata) - 1;
@@ -549,7 +551,7 @@ void CMsnProto::FreeAuthTokens(void) mir_free(tAuthToken);
mir_free(oimSendToken);
mir_free(authStrToken);
- mir_free(authSecretToken);
+ mir_free(authSecretToken);
mir_free(authContactToken);
mir_free(authStorageToken);
mir_free(hotSecretToken);
diff --git a/protocols/MSN/src/msn_avatar.cpp b/protocols/MSN/src/msn_avatar.cpp index bd27529c1f..eda6d98072 100644 --- a/protocols/MSN/src/msn_avatar.cpp +++ b/protocols/MSN/src/msn_avatar.cpp @@ -1,5 +1,7 @@ /*
Plugin for Miranda NG for communicating with users of the MSN Messenger protocol.
+
+Copyright (c) 2012-2013 Miranda NG Team
Copyright (c) 2013 Miranda NG Team
This program is free software; you can redistribute it and/or
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index cdeb14d969..fc738af20d 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -27,14 +29,14 @@ HANDLE CMsnProto::MSN_GetChatInernalHandle(HANDLE hContact) {
HANDLE result = hContact;
int type = getByte(hContact, "ChatRoom", 0);
- if (type != 0)
+ if (type != 0)
{
DBVARIANT dbv;
if (getString(hContact, "ChatRoomID", &dbv) == 0)
{
result = (HANDLE)(-atol(dbv.pszVal));
MSN_FreeVariant(&dbv);
- }
+ }
}
return result;
}
@@ -45,7 +47,7 @@ int CMsnProto::MSN_ChatInit(ThreadData *info) _ltot(sttChatID, info->mChatID, 10);
TCHAR szName[512];
- mir_sntprintf(szName, SIZEOF(szName), _T("%s %s%s"),
+ mir_sntprintf(szName, SIZEOF(szName), _T("%s %s%s"),
m_tszUserName, TranslateT("Chat #"), info->mChatID);
GCSESSION gcw = {0};
@@ -107,7 +109,7 @@ void CMsnProto::MSN_ChatStart(ThreadData* info) gce.time = time(NULL);
gce.bIsMe = FALSE;
- for (int j=0; j < info->mJoinedContactsWLID.getCount(); j++)
+ for (int j=0; j < info->mJoinedContactsWLID.getCount(); j++)
{
HANDLE hContact = MSN_HContactFromEmail(info->mJoinedContactsWLID[j]);
TCHAR *wlid = mir_a2t(info->mJoinedContactsWLID[j]);
@@ -117,7 +119,7 @@ void CMsnProto::MSN_ChatStart(ThreadData* info) CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
mir_free(wlid);
- }
+ }
}
void CMsnProto::MSN_KillChatSession(TCHAR* id)
@@ -132,13 +134,13 @@ void CMsnProto::MSN_KillChatSession(TCHAR* id) CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
}
-static void ChatInviteUser(ThreadData* info, const char* email)
+static void ChatInviteUser(ThreadData* info, const char* email)
{
if (info->mJoinedContactsWLID.getCount())
{
- for (int j=0; j < info->mJoinedContactsWLID.getCount(); j++)
+ for (int j=0; j < info->mJoinedContactsWLID.getCount(); j++)
{
- if (_stricmp(info->mJoinedContactsWLID[j], email) == 0)
+ if (_stricmp(info->mJoinedContactsWLID[j], email) == 0)
return;
}
@@ -152,7 +154,7 @@ static void ChatInviteSend(HANDLE hItem, HWND hwndList, STRLIST &str, CMsnProto if (hItem == NULL)
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
- while (hItem)
+ while (hItem)
{
if (IsHContactGroup(hItem))
{
@@ -171,7 +173,7 @@ static void ChatInviteSend(HANDLE hItem, HWND hwndList, STRLIST &str, CMsnProto if (buf[0]) str.insert(mir_t2a(buf));
}
- else
+ else
{
MsnContact *msc = ppro->Lists_Get(hItem);
if (msc) str.insertn(msc->email);
@@ -185,7 +187,7 @@ static void ChatInviteSend(HANDLE hItem, HWND hwndList, STRLIST &str, CMsnProto static void ChatValidateContact(HANDLE hItem, HWND hwndList, CMsnProto* ppro)
{
- if (!ppro->MSN_IsMyContact(hItem) || ppro->getByte(hItem, "ChatRoom", 0) || ppro->MSN_IsMeByContact(hItem))
+ if (!ppro->MSN_IsMyContact(hItem) || ppro->getByte(hItem, "ChatRoom", 0) || ppro->MSN_IsMeByContact(hItem))
SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0);
}
@@ -194,7 +196,7 @@ static void ChatPrepare(HANDLE hItem, HWND hwndList, CMsnProto* ppro) if (hItem == NULL)
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
- while (hItem)
+ while (hItem)
{
HANDLE hItemN = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
@@ -214,7 +216,7 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l {
InviteChatParam* param = (InviteChatParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg)
+ switch (msg)
{
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
@@ -239,17 +241,17 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l NMCLISTCONTROL* nmc = (NMCLISTCONTROL*)lParam;
if (nmc->hdr.idFrom == IDC_CCLIST)
{
- switch (nmc->hdr.code)
+ switch (nmc->hdr.code)
{
case CLN_NEWCONTACT:
- if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0)
+ if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0)
ChatValidateContact(nmc->hItem, nmc->hdr.hwndFrom, param->ppro);
break;
case CLN_LISTREBUILT:
- if (param)
+ if (param)
ChatPrepare(NULL, nmc->hdr.hwndFrom, param->ppro);
- break;
+ break;
}
}
}
@@ -257,7 +259,7 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case WM_COMMAND:
{
- switch (LOWORD(wParam))
+ switch (LOWORD(wParam))
{
case IDC_ADDSCR:
if (param->ppro->msnLoggedIn)
@@ -297,7 +299,7 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l ChatInviteUser(info, (*cont)[i]);
delete cont;
}
- else
+ else
{
if (tEmail[0]) cont->insertn(tEmail);
param->ppro->MsgQueue_Add("chat", 'X', NULL, 0, NULL, 0, cont);
@@ -319,7 +321,7 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l return FALSE;
}
-int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
+int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
{
GCHOOK *gch = (GCHOOK*) lParam;
if (!gch)
@@ -327,18 +329,18 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) if (_stricmp(gch->pDest->pszModule, m_szModuleName)) return 0;
- switch (gch->pDest->iType)
+ switch (gch->pDest->iType)
{
- case GC_SESSION_TERMINATE:
+ case GC_SESSION_TERMINATE:
{
ThreadData* thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
- if (thread != NULL)
+ if (thread != NULL)
thread->sendTerminate();
break;
}
case GC_USER_MESSAGE:
- if (gch->ptszText && gch->ptszText[0])
+ if (gch->ptszText && gch->ptszText[0])
{
ThreadData* thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
if (thread)
@@ -371,12 +373,12 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) }
break;
- case GC_USER_CHANMGR:
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
+ case GC_USER_CHANMGR:
+ DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
LPARAM(new InviteChatParam(gch->pDest->ptszID, NULL, this)));
break;
- case GC_USER_PRIVMESS:
+ case GC_USER_PRIVMESS:
{
char *email = mir_t2a(gch->ptszUID);
HANDLE hContact = MSN_HContactFromEmail(email);
@@ -386,10 +388,10 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) }
case GC_USER_LOGMENU:
- switch(gch->dwData)
+ switch(gch->dwData)
{
- case 10:
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
+ case 10:
+ DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
LPARAM(new InviteChatParam(gch->pDest->ptszID, NULL, this)));
break;
@@ -399,13 +401,13 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) }
break;
- case GC_USER_NICKLISTMENU:
+ case GC_USER_NICKLISTMENU:
{
char *email = mir_t2a(gch->ptszUID);
HANDLE hContact = MSN_HContactFromEmail(email);
mir_free(email);
- switch(gch->dwData)
+ switch(gch->dwData)
{
case 10:
CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0);
@@ -422,11 +424,11 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) break;
}
/* haven't implemented in chat.dll
- case GC_USER_TYPNOTIFY:
+ case GC_USER_TYPNOTIFY:
{
int chatID = atoi(p);
ThreadData* thread = MSN_GetThreadByContact((HANDLE)-chatID);
- for (int j=0; j < thread->mJoinedCount; j++)
+ for (int j=0; j < thread->mJoinedCount; j++)
{
if ((long)thread->mJoinedContacts[j] > 0)
CallService(MS_PROTO_SELFISTYPING, (WPARAM) thread->mJoinedContacts[j], (LPARAM) PROTOTYPE_SELFTYPING_ON);
@@ -439,15 +441,15 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) return 0;
}
-int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam)
+int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam)
{
GCMENUITEMS *gcmi= (GCMENUITEMS*) lParam;
if (gcmi == NULL || _stricmp(gcmi->pszModule, m_szModuleName)) return 0;
- if (gcmi->Type == MENU_ON_LOG)
+ if (gcmi->Type == MENU_ON_LOG)
{
- static const struct gc_item Items[] =
+ static const struct gc_item Items[] =
{
{ LPGENT("&Invite user..."), 10, MENU_ITEM, FALSE },
{ LPGENT("&Leave chat session"), 20, MENU_ITEM, FALSE }
@@ -455,12 +457,12 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) gcmi->nItems = SIZEOF(Items);
gcmi->Item = (gc_item*)Items;
}
- else if (gcmi->Type == MENU_ON_NICKLIST)
+ else if (gcmi->Type == MENU_ON_NICKLIST)
{
char* email = mir_t2a(gcmi->pszUID);
- if (!_stricmp(MyOptions.szEmail, email))
+ if (!_stricmp(MyOptions.szEmail, email))
{
- static const struct gc_item Items[] =
+ static const struct gc_item Items[] =
{
{ LPGENT("User &details"), 10, MENU_ITEM, FALSE },
{ LPGENT("User &history"), 20, MENU_ITEM, FALSE },
@@ -470,9 +472,9 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) gcmi->nItems = SIZEOF(Items);
gcmi->Item = (gc_item*)Items;
}
- else
+ else
{
- static const struct gc_item Items[] =
+ static const struct gc_item Items[] =
{
{ LPGENT("User &details"), 10, MENU_ITEM, FALSE },
{ LPGENT("User &history"), 20, MENU_ITEM, FALSE }
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 825f0bf456..e3da3c541b 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
diff --git a/protocols/MSN/src/msn_contact.cpp b/protocols/MSN/src/msn_contact.cpp index 086bf6b3ed..d860b1d8e5 100644 --- a/protocols/MSN/src/msn_contact.cpp +++ b/protocols/MSN/src/msn_contact.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -60,7 +62,7 @@ void CMsnProto::MSN_SetContactDb(HANDLE hContact, const char *szEmail) DBDeleteContactSetting(hContact, "CList", "Hidden");
}
- if (listId & (LIST_BL | LIST_AL))
+ if (listId & (LIST_BL | LIST_AL))
{
WORD tApparentMode = getWord(hContact, "ApparentMode", 0);
if ((listId & LIST_BL) && tApparentMode == 0)
@@ -129,9 +131,9 @@ bool CMsnProto::MSN_AddUser(HANDLE hContact, const char* email, int netId, int f bool res = false;
- if (flags == LIST_FL)
+ if (flags == LIST_FL)
{
- if (needRemove)
+ if (needRemove)
{
if (hContact == NULL)
{
@@ -140,7 +142,7 @@ bool CMsnProto::MSN_AddUser(HANDLE hContact, const char* email, int netId, int f }
char id[MSN_GUID_LEN];
- if (!getStaticString(hContact, "ID", id, sizeof(id)))
+ if (!getStaticString(hContact, "ID", id, sizeof(id)))
{
int netId = Lists_GetNetId(email);
if (leaveHotmail)
@@ -154,7 +156,7 @@ bool CMsnProto::MSN_AddUser(HANDLE hContact, const char* email, int netId, int f MSN_RemoveEmptyGroups();
}
}
- else
+ else
{
DBVARIANT dbv = {0};
if (!strcmp(email, MyOptions.szEmail))
@@ -183,7 +185,7 @@ bool CMsnProto::MSN_AddUser(HANDLE hContact, const char* email, int netId, int f if (res)
{
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(hContact, "CList", "Group", &dbv))
+ if (!DBGetContactSettingStringUtf(hContact, "CList", "Group", &dbv))
{
MSN_MoveContactToGroup(hContact, dbv.pszVal);
MSN_FreeVariant(&dbv);
@@ -208,16 +210,16 @@ bool CMsnProto::MSN_AddUser(HANDLE hContact, const char* email, int netId, int f }
else if (flags == LIST_LL)
{
- if (needRemove)
+ if (needRemove)
Lists_Remove(LIST_LL, email);
else
Lists_Add(LIST_LL, NETID_MSN, email);
}
- else
+ else
{
if (netId == 0) netId = Lists_GetNetId(email);
res = MSN_SharingAddDelMember(email, flags, netId, needRemove ? "DeleteMember" : "AddMember");
-// if (res || (flags & LIST_RL))
+// if (res || (flags & LIST_RL))
AddDelUserContList(email, flags, netId, needRemove);
if ((flags & LIST_BL) && !needRemove)
{
diff --git a/protocols/MSN/src/msn_errors.cpp b/protocols/MSN/src/msn_errors.cpp index d2c5558927..c468c7d645 100644 --- a/protocols/MSN/src/msn_errors.cpp +++ b/protocols/MSN/src/msn_errors.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -56,12 +58,12 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString) case ERR_LIST_UNAVAILABLE:
char* tWords[3];
if (sttDivideWords(cmdString, 3, tWords) == 3)
- HReadBuffer(info, 0).surelyRead(atol(tWords[2]));
+ HReadBuffer(info, 0).surelyRead(atol(tWords[2]));
return 0;
case ERR_NOT_ONLINE:
if (info->mInitialContactWLID)
- SendBroadcast(MSN_HContactFromEmail(info->mInitialContactWLID), ACKTYPE_MESSAGE, ACKRESULT_FAILED,
+ SendBroadcast(MSN_HContactFromEmail(info->mInitialContactWLID), ACKTYPE_MESSAGE, ACKRESULT_FAILED,
(HANDLE)999999, (LPARAM)MSN_Translate("User not online"));
else
MSN_ShowError("User not online");
@@ -73,7 +75,7 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString) return 0;
case ERR_AUTHENTICATION_FAILED:
- if (info->mType != SERVER_SWITCHBOARD)
+ if (info->mType != SERVER_SWITCHBOARD)
{
MSN_ShowError("Your username or password is incorrect");
SendBroadcast(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
diff --git a/protocols/MSN/src/msn_ftold.cpp b/protocols/MSN/src/msn_ftold.cpp index 6ed5ce08af..a204f7ded5 100644 --- a/protocols/MSN/src/msn_ftold.cpp +++ b/protocols/MSN/src/msn_ftold.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -54,7 +56,7 @@ void CMsnProto::msnftp_invite(filetransfer *ft) {
bool isOffline;
ThreadData* thread = MSN_StartSB(ft->p2p_dest, isOffline);
- if (isOffline) return;
+ if (isOffline) return;
if (thread != NULL) thread->mMsnFtp = ft;
TCHAR* pszFiles = _tcsrchr(ft->std.ptszFiles[0], '\\');
@@ -118,7 +120,7 @@ int CMsnProto::MSN_HandleMSNFTP(ThreadData *info, char *cmdString) while (ft->std.currentFileProgress < ft->std.currentFileSize)
{
- if (ft->bCanceled)
+ if (ft->bCanceled)
{
sendpacket[0] = 0x01;
sendpacket[1] = 0x00;
@@ -179,7 +181,7 @@ LBL_InvalidCommand: {
MSN_DebugLog("Another side requested the unknown protocol (%s), closing thread", params);
return 1;
- }
+ }
}
if (info->mCaller == 0) //receive
@@ -208,7 +210,7 @@ LBL_InvalidCommand: }
BYTE* p = tBuf.surelyRead(3);
- if (p == NULL)
+ if (p == NULL)
{
LBL_Error:
ft->close();
@@ -220,7 +222,7 @@ LBL_Error: WORD dataLen = *p++;
dataLen |= (*p++ << 8);
- if (tIsTransitionFinished)
+ if (tIsTransitionFinished)
{
LBL_Success:
static const char sttCommand[] = "BYE 16777989\r\n";
@@ -238,13 +240,13 @@ LBL_Success: SendBroadcast(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM)&ft->std);
- if (ft->std.currentFileProgress == ft->std.totalBytes)
+ if (ft->std.currentFileProgress == ft->std.totalBytes)
{
ft->complete();
goto LBL_Success;
- }
- }
- }
+ }
+ }
+ }
}
return 0;
@@ -259,7 +261,7 @@ void __cdecl CMsnProto::msnftp_sendFileThread(void* arg) MSN_DebugLog("Waiting for an incoming connection to '%s'...", info->mServer);
- switch(WaitForSingleObject(info->hWaitEvent, 60000))
+ switch(WaitForSingleObject(info->hWaitEvent, 60000))
{
case WAIT_TIMEOUT:
case WAIT_FAILED:
@@ -269,7 +271,7 @@ void __cdecl CMsnProto::msnftp_sendFileThread(void* arg) info->mBytesInData = 0;
- for (;;)
+ for (;;)
{
int recvResult = info->recv(info->mData+info->mBytesInData, 1000 - info->mBytesInData);
if (recvResult == SOCKET_ERROR || !recvResult)
@@ -278,14 +280,14 @@ void __cdecl CMsnProto::msnftp_sendFileThread(void* arg) info->mBytesInData += recvResult;
//pull off each line for parsing
- if (info->mCaller == 3 && info->mType == SERVER_FILETRANS)
+ if (info->mCaller == 3 && info->mType == SERVER_FILETRANS)
{
if (MSN_HandleMSNFTP(info, info->mData))
break;
}
else // info->mType!=SERVER_FILETRANS
{
- for (;;)
+ for (;;)
{
char* peol = strchr(info->mData,'\r');
if (peol == NULL)
@@ -306,7 +308,7 @@ void __cdecl CMsnProto::msnftp_sendFileThread(void* arg) MSN_DebugLog("RECV:%s", msg);
- if (!isalnum(msg[0]) || !isalnum(msg[1]) || !isalnum(msg[2]) || (msg[3] && msg[3]!=' '))
+ if (!isalnum(msg[0]) || !isalnum(msg[1]) || !isalnum(msg[2]) || (msg[3] && msg[3]!=' '))
{
MSN_DebugLog("Invalid command name");
continue;
@@ -314,14 +316,14 @@ void __cdecl CMsnProto::msnftp_sendFileThread(void* arg) if (MSN_HandleMSNFTP(info, msg))
break;
- }
+ }
}
- if (info->mBytesInData == sizeof(info->mData))
+ if (info->mBytesInData == sizeof(info->mData))
{
MSN_DebugLog("sizeof(data) is too small: the longest line won't fit");
break;
- }
+ }
}
MSN_DebugLog("Closing file transfer thread");
@@ -336,7 +338,7 @@ void CMsnProto::msnftp_startFileSend(ThreadData* info, const char* Invcommand, c HANDLE sb = NULL;
filetransfer* ft = info->mMsnFtp; info->mMsnFtp = NULL;
- if (ft != NULL && MyConnection.extIP)
+ if (ft != NULL && MyConnection.extIP)
{
nlb.cbSize = sizeof(nlb);
nlb.pfnNewConnectionV2 = MSN_ConnectionProc;
@@ -372,13 +374,13 @@ void CMsnProto::msnftp_startFileSend(ThreadData* info, const char* Invcommand, c "Launch-Application: FALSE\r\n"
"Request-Data: IP-Address:\r\n\r\n",
sb && MyConnection.extIP ? "ACCEPT" : "CANCEL",
- Invcookie, MyConnection.GetMyExtIPStr(), hostname,
+ Invcookie, MyConnection.GetMyExtIPStr(), hostname,
nlb.wExPort, nlb.wExPort ^ 0x3141, nlb.wPort ^ 0x3141,
MSN_GenRandom());
info->sendPacket("MSG", "N %d\r\n%s", nBytes, command);
- if (sb)
+ if (sb)
{
ThreadData* newThread = new ThreadData;
newThread->mType = SERVER_FILETRANS;
diff --git a/protocols/MSN/src/msn_global.h b/protocols/MSN/src/msn_global.h index d3349f219f..5df5eff0da 100644 --- a/protocols/MSN/src/msn_global.h +++ b/protocols/MSN/src/msn_global.h @@ -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) 2006-2011 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
diff --git a/protocols/MSN/src/msn_http.cpp b/protocols/MSN/src/msn_http.cpp index a53f9401fb..a01a78adbf 100644 --- a/protocols/MSN/src/msn_http.cpp +++ b/protocols/MSN/src/msn_http.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -108,13 +110,13 @@ PBYTE msn_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST* nlhr, PBYTE buf, int len, int T->sessionClosed |= isSessionClosed;
if (isSessionClosed && buf == NULL)
- {
+ {
*outBufLen = 0;
buf = (PBYTE)mir_alloc(1);
*buf = 0;
}
else if (buf == NULL && len == 0)
- {
+ {
*outBufLen = 1;
buf = (PBYTE)mir_alloc(1);
*buf = 0;
diff --git a/protocols/MSN/src/msn_libstr.cpp b/protocols/MSN/src/msn_libstr.cpp index 4eb7a1c220..8067341faa 100644 --- a/protocols/MSN/src/msn_libstr.cpp +++ b/protocols/MSN/src/msn_libstr.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -56,13 +58,13 @@ char* arrayToHex(BYTE* data, size_t datasz) }
*resptr = '\0';
return res;
-}
+}
bool txtParseParam (const char* szData, const char* presearch, const char* start, const char* finish, char* param, const int size)
{
const char *cp, *cp1;
int len;
-
+
if (szData == NULL) return false;
if (presearch != NULL)
@@ -92,7 +94,7 @@ bool txtParseParam (const char* szData, const char* presearch, const char* start param[len] = 0;
return true;
-}
+}
void parseWLID(char* wlid, char** net, char** email, char** inst)
{
@@ -140,19 +142,19 @@ template <class chartype> void UrlDecode(chartype* str) while(*s)
{
- if (*s == '%')
+ if (*s == '%')
{
int digit1 = SingleHexToDecimal(s[1]);
- if (digit1 != -1)
+ if (digit1 != -1)
{
int digit2 = SingleHexToDecimal(s[2]);
- if (digit2 != -1)
+ if (digit2 != -1)
{
s += 3;
*d++ = (char)((digit1 << 4) | digit2);
continue;
- }
- }
+ }
+ }
}
*d++ = *s++;
}
@@ -167,9 +169,9 @@ void HtmlDecode(char* str) if (str == NULL)
return;
- for (p=q=str; *p!='\0'; p++,q++)
+ for (p=q=str; *p!='\0'; p++,q++)
{
- if (*p == '&')
+ if (*p == '&')
{
if (!strncmp(p, "&", 5)) { *q = '&'; p += 4; }
else if (!strncmp(p, "'", 6)) { *q = '\''; p += 5; }
@@ -178,7 +180,7 @@ void HtmlDecode(char* str) else if (!strncmp(p, """, 6)) { *q = '"'; p += 5; }
else { *q = *p; }
}
- else
+ else
{
*q = *p;
}
@@ -194,9 +196,9 @@ char* HtmlEncode(const char* str) if (str == NULL)
return NULL;
- for (c=0,p=(char*)str; *p!='\0'; p++)
+ for (c=0,p=(char*)str; *p!='\0'; p++)
{
- switch (*p)
+ switch (*p)
{
case '&': c += 5; break;
case '\'': c += 6; break;
@@ -206,11 +208,11 @@ char* HtmlEncode(const char* str) default: c++; break;
}
}
- if ((s=(char*)mir_alloc(c+1)) != NULL)
+ if ((s=(char*)mir_alloc(c+1)) != NULL)
{
- for (p=(char*)str,q=s; *p!='\0'; p++)
+ for (p=(char*)str,q=s; *p!='\0'; p++)
{
- switch (*p)
+ switch (*p)
{
case '&': strcpy(q, "&"); q += 5; break;
case '\'': strcpy(q, "'"); q += 6; break;
@@ -234,7 +236,7 @@ void UrlEncode(const char* src, char* dest, size_t cbDest) unsigned char* d = (unsigned char*)dest;
size_t i = 0;
- for (const unsigned char* s = (unsigned char*)src; *s; s++)
+ for (const unsigned char* s = (unsigned char*)src; *s; s++)
{
if ((*s <= '/' && *s != '.' && *s != '-') ||
(*s >= ':' && *s <= '?') ||
@@ -259,13 +261,13 @@ void UrlEncode(const char* src, char* dest, size_t cbDest) void stripBBCode(char* src)
{
- bool tag = false;
+ bool tag = false;
char* ps = src;
char* pd = src;
while (*ps != 0)
{
- if (!tag && *ps == '[')
+ if (!tag && *ps == '[')
{
char ch = ps[1];
if (ch == '/') ch = ps[2];
@@ -387,4 +389,3 @@ char* getNewUuid(void) RpcStringFreeA(&p);
return result;
}
-
diff --git a/protocols/MSN/src/msn_links.cpp b/protocols/MSN/src/msn_links.cpp index 1d54afd64c..57f84e2e06 100644 --- a/protocols/MSN/src/msn_links.cpp +++ b/protocols/MSN/src/msn_links.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) 2008-2012 Boris Krasnovskiy.
This program is free software; you can redistribute it and/or
@@ -28,7 +30,7 @@ static HANDLE hServiceParseLink; static HANDLE GetContact(TCHAR *arg, TCHAR **pemail, CMsnProto *proto)
{
TCHAR* email = NULL;
- do
+ do
{
TCHAR *tok = _tcschr(arg, '&'); /* next token */
if (tok != NULL) *tok++ = '\0';
@@ -40,7 +42,7 @@ static HANDLE GetContact(TCHAR *arg, TCHAR **pemail, CMsnProto *proto) email = arg;
}
arg = tok;
- }
+ }
while(arg != NULL);
if (email == NULL || email[0] == '\0')
@@ -53,7 +55,7 @@ static HANDLE GetContact(TCHAR *arg, TCHAR **pemail, CMsnProto *proto) return hContact;
}
-/*
+/*
add user: msnim:add?contact=netpassport@emailaddress.com
send message: msnim:chat?contact=netpassport@emailaddress.com
voice chat: msnim:voice?contact=netpassport@emailaddress.com
@@ -89,8 +91,8 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) /* add a contact to the list */
- if(_tcsnicmp(arg, _T("add?"), 4) == 0)
- {
+ if(_tcsnicmp(arg, _T("add?"), 4) == 0)
+ {
arg += 4;
TCHAR *email;
@@ -98,7 +100,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) if (email == NULL) return 1;
/* does not yet check if email is current user */
- if (hContact == NULL)
+ if (hContact == NULL)
{
ADDCONTACTSTRUCT acs = {0};
PROTOSEARCHRESULT psr = {0};
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index c0db8ca166..97f632a870 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -43,7 +45,7 @@ void CMsnProto::Lists_Wipe(void) bool CMsnProto::Lists_IsInList(int list, const char* email)
{
EnterCriticalSection(&csLists);
-
+
MsnContact* p = contList.find((MsnContact*)&email);
bool res = p != NULL;
if (res && list != -1)
@@ -168,9 +170,9 @@ unsigned CMsnProto::p2p_getMsgId(const char* wlid, int inc) EnterCriticalSection(&csLists);
MsnPlace* p = Lists_GetPlace(wlid);
- unsigned res = p && p->p2pMsgId ? p->p2pMsgId : MSN_GenRandom();
+ unsigned res = p && p->p2pMsgId ? p->p2pMsgId : MSN_GenRandom();
if (p) p->p2pMsgId = res + inc;
-
+
LeaveCriticalSection(&csLists);
return res;
}
@@ -222,12 +224,12 @@ void CMsnProto::Lists_Remove(int list, const char* email) {
EnterCriticalSection(&csLists);
int i = contList.getIndex((MsnContact*)&email);
- if (i != -1)
+ if (i != -1)
{
MsnContact& p = contList[i];
p.list &= ~list;
if (list & LIST_PL) { mir_free(p.invite); p.invite = NULL; }
- if (p.list == 0 && p.hContact == NULL)
+ if (p.list == 0 && p.hContact == NULL)
contList.remove(i);
}
LeaveCriticalSection(&csLists);
@@ -240,7 +242,7 @@ void CMsnProto::Lists_Populate(void) while (hContact != NULL)
{
HANDLE hContactN = db_find_next(hContact);
- if (MSN_IsMyContact(hContact))
+ if (MSN_IsMyContact(hContact))
{
char szEmail[MSN_MAX_EMAIL_LEN] = "";;
if (getStaticString(hContact, "wlid", szEmail, sizeof(szEmail)))
@@ -249,7 +251,7 @@ void CMsnProto::Lists_Populate(void) if (szEmail[0])
{
bool localList = getByte(hContact, "LocalList", 0) != 0;
- if (localList)
+ if (localList)
Lists_Add(LIST_LL, NETID_MSN, szEmail, hContact);
else
Lists_Add(0, NETID_UNKNOWN, szEmail, hContact);
@@ -284,17 +286,17 @@ void CMsnProto::MSN_CleanupLists(void) if (p.hContact && !(p.list & (LIST_LL | LIST_FL | LIST_PL)) && p.list != LIST_RL)
{
int count = CallService(MS_DB_EVENT_GETCOUNT, (WPARAM)p.hContact, 0);
- if (count)
+ if (count)
{
TCHAR text[256];
TCHAR* sze = mir_a2t(p.email);
mir_sntprintf(text, SIZEOF(text), TranslateT("Contact %s has been removed from the server.\nWould you like to keep it as \"Local Only\" contact to preserve history?"), sze);
mir_free(sze);
-
+
TCHAR title[128];
mir_sntprintf(title, SIZEOF(title), TranslateT("%s protocol"), m_tszUserName);
- if (MessageBox(NULL, text, title, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES)
+ if (MessageBox(NULL, text, title, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES)
{
MSN_AddUser(p.hContact, p.email, 0, LIST_LL);
setByte(p.hContact, "LocalList", 1);
@@ -309,7 +311,7 @@ void CMsnProto::MSN_CleanupLists(void) }
}
-
+
if (p.list & (LIST_LL | LIST_FL) && p.hContact)
{
TCHAR path[MAX_PATH];
@@ -333,11 +335,11 @@ void CMsnProto::MSN_CreateContList(void) {
bool *used = (bool*)mir_calloc(contList.getCount()*sizeof(bool));
- char cxml[8192];
+ char cxml[8192];
size_t sz;
sz = mir_snprintf(cxml , sizeof(cxml), "<ml l=\"1\">");
-
+
EnterCriticalSection(&csLists);
for (int i=0; i < contList.getCount(); i++)
@@ -350,9 +352,9 @@ void CMsnProto::MSN_CreateContList(void) for (int j=0; j < contList.getCount(); j++)
{
if (used[j]) continue;
-
+
const MsnContact& C = contList[j];
-
+
if (C.list == LIST_RL || C.list == LIST_PL || C.list == LIST_LL)
{
used[j] = true;
@@ -388,7 +390,7 @@ void CMsnProto::MSN_CreateContList(void) }
if (used[j] && sz > 7400)
- {
+ {
sz += mir_snprintf(cxml+sz, sizeof(cxml)-sz, "</%c></ml>", lastds ? 'd' : 't');
msnNsThread->sendPacket("ADL", "%d\r\n%s", sz, cxml);
sz = 0;
@@ -399,7 +401,7 @@ void CMsnProto::MSN_CreateContList(void) }
LeaveCriticalSection(&csLists);
- if (sz)
+ if (sz)
{
sz += mir_snprintf(cxml+sz, sizeof(cxml)-sz, "</ml>");
msnNsThread->sendPacket("ADL", "%d\r\n%s", sz, cxml);
@@ -419,11 +421,11 @@ static void AddPrivacyListEntries(HWND hwndList, CMsnProto *proto) // Delete old info
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
- while (hItem)
+ while (hItem)
{
HANDLE hItemNext = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
- if (IsHContactInfo(hItem))
+ if (IsHContactInfo(hItem))
SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0);
hItem = hItemNext;
@@ -485,7 +487,7 @@ static void SetAllContactIcons(HANDLE hItem, HWND hwndList, CMsnProto* proto) if (hItem == NULL)
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
- while (hItem)
+ while (hItem)
{
HANDLE hItemN = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
@@ -528,7 +530,7 @@ static void SaveSettings(HANDLE hItem, HWND hwndList, CMsnProto* proto) if (hItem == NULL)
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
- while (hItem)
+ while (hItem)
{
if (IsHContactGroup(hItem))
{
@@ -573,7 +575,7 @@ static void SaveSettings(HANDLE hItem, HWND hwndList, CMsnProto* proto) {
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hItem, 0);
MsnContact* msc = proto->Lists_Get(szEmail);
- if (msc) msc->hContact = NULL;
+ if (msc) msc->hContact = NULL;
}
}
}
@@ -583,7 +585,7 @@ static void SaveSettings(HANDLE hItem, HWND hwndList, CMsnProto* proto) INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
+ switch(msg)
{
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
@@ -622,7 +624,7 @@ INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SendMessage(hwndList, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml);
SendMessage(hwndList, CLM_SETEXTRACOLUMNS, 5, 0);
-
+
ResetListOptions(hwndList);
EnableWindow(hwndList, ((CMsnProto*)lParam)->msnLoggedIn);
}
@@ -633,7 +635,7 @@ INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR // break;
case WM_COMMAND:
- if (LOWORD(wParam) == IDC_LISTREFRESH)
+ if (LOWORD(wParam) == IDC_LISTREFRESH)
{
HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST);
SendMessage(hwndList, CLM_AUTOREBUILD, 0, 0);
@@ -657,10 +659,10 @@ INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
else if (nmc->hdr.idFrom == IDC_LIST)
{
- switch (nmc->hdr.code)
+ switch (nmc->hdr.code)
{
case CLN_NEWCONTACT:
- if ((nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0)
+ if ((nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0)
SetContactIcons(nmc->hItem, nmc->hdr.hwndFrom, proto);
break;
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;
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index 25ffe6447f..ddc2e1c4cc 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -22,11 +24,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "msn_proto.h"
static HANDLE hPrebuildMenuHook;
-static HGENMENU
- hBlockMenuItem,
- hLiveSpaceMenuItem,
- hNetmeetingMenuItem,
- hChatInviteMenuItem,
+static HGENMENU
+ hBlockMenuItem,
+ hLiveSpaceMenuItem,
+ hNetmeetingMenuItem,
+ hChatInviteMenuItem,
hOpenInboxMenuItem;
HANDLE hNetMeeting, hBlockCom, hSendHotMail, hInviteChat, hViewProfile;
@@ -35,7 +37,7 @@ HANDLE hNetMeeting, hBlockCom, hSendHotMail, hInviteChat, hViewProfile; INT_PTR CMsnProto::MsnBlockCommand(WPARAM wParam, LPARAM)
{
- if (msnLoggedIn)
+ if (msnLoggedIn)
{
const HANDLE hContact = (HANDLE)wParam;
@@ -100,7 +102,7 @@ INT_PTR CMsnProto::MsnViewProfile(WPARAM wParam, LPARAM) if (hContact == NULL)
cid = mycid;
- else
+ else
{
cid = buf;
if (getStaticString(hContact, "CID", buf, 30))
@@ -127,7 +129,7 @@ INT_PTR CMsnProto::MsnEditProfile(WPARAM, LPARAM) INT_PTR CMsnProto::MsnInviteCommand(WPARAM, LPARAM)
{
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
+ DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
LPARAM(new InviteChatParam(NULL, NULL, this)));
return 0;
}
@@ -146,7 +148,7 @@ int CMsnProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) bool isMe = MSN_IsMeByContact(hContact, szEmail);
if (szEmail[0]) {
int listId = Lists_GetMask(szEmail);
-
+
bool noChat = !(listId & LIST_FL) || isMe || getByte(hContact, "ChatRoom", 0);
CLISTMENUITEM mi = { sizeof(mi) };
@@ -173,7 +175,7 @@ int CMsnProto::OnContactDoubleClicked(WPARAM wParam, LPARAM) {
const HANDLE hContact = (HANDLE)wParam;
- if (emailEnabled && MSN_IsMeByContact(hContact))
+ if (emailEnabled && MSN_IsMeByContact(hContact))
{
MsnSendHotmail(wParam, 0);
return 1;
@@ -244,10 +246,10 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam case WM_COMMAND:
switch(wParam)
{
- case IDOK:
+ case IDOK:
{
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (proto->msnLoggedIn)
+ if (proto->msnLoggedIn)
{
TCHAR str[130];
GetDlgItemText(hwndDlg, IDC_NICKNAME, str, SIZEOF(str));
@@ -275,7 +277,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam INT_PTR CMsnProto::SetNicknameUI(WPARAM, LPARAM)
{
- HWND hwndSetNickname = CreateDialogParam (hInst, MAKEINTRESOURCE(IDD_SETNICKNAME),
+ HWND hwndSetNickname = CreateDialogParam (hInst, MAKEINTRESOURCE(IDD_SETNICKNAME),
NULL, DlgProcSetNickname, (LPARAM)this);
SetForegroundWindow(hwndSetNickname);
@@ -353,7 +355,7 @@ void CMsnProto::MsnInitMainMenu(void) void CMsnProto::MsnRemoveMainMenus(void)
{
- if (mainMenuRoot)
+ if (mainMenuRoot)
CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)mainMenuRoot, 0);
}
diff --git a/protocols/MSN/src/msn_mime.cpp b/protocols/MSN/src/msn_mime.cpp index b925e101bb..6ce94286da 100644 --- a/protocols/MSN/src/msn_mime.cpp +++ b/protocols/MSN/src/msn_mime.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -45,7 +47,7 @@ MimeHeaders::~MimeHeaders() void MimeHeaders::clear(void)
{
- for (unsigned i=0; i < mCount; i++)
+ for (unsigned i=0; i < mCount; i++)
{
MimeHeader& H = mVals[i];
if (H.flags & 1) mir_free((void*)H.name);
@@ -56,12 +58,12 @@ void MimeHeaders::clear(void) unsigned MimeHeaders::allocSlot(void)
{
- if (++mCount >= mAllocCount)
+ if (++mCount >= mAllocCount)
{
mAllocCount += 10;
mVals = (MimeHeader*)mir_realloc(mVals, sizeof(MimeHeader) * mAllocCount);
}
- return mCount - 1;
+ return mCount - 1;
}
@@ -72,10 +74,10 @@ unsigned MimeHeaders::allocSlot(void) void MimeHeaders::addString(const char* name, const char* szValue, unsigned flags)
{
if (szValue == NULL) return;
-
+
MimeHeader& H = mVals[allocSlot()];
H.name = name;
- H.value = szValue;
+ H.value = szValue;
H.flags = flags;
}
@@ -86,7 +88,7 @@ void MimeHeaders::addLong(const char* name, long lValue, unsigned flags) char szBuffer[20];
_ltoa(lValue, szBuffer, 10);
- H.value = mir_strdup(szBuffer);
+ H.value = mir_strdup(szBuffer);
H.flags = 2 | flags;
}
@@ -97,7 +99,7 @@ void MimeHeaders::addULong(const char* name, unsigned lValue) char szBuffer[20];
_ultoa(lValue, szBuffer, 10);
- H.value = mir_strdup(szBuffer);
+ H.value = mir_strdup(szBuffer);
H.flags = 2;
}
@@ -105,7 +107,7 @@ void MimeHeaders::addBool(const char* name, bool lValue) {
MimeHeader& H = mVals[allocSlot()];
H.name = name;
- H.value = lValue ? "true" : "false";
+ H.value = lValue ? "true" : "false";
H.flags = 0;
}
@@ -116,7 +118,7 @@ char* MimeHeaders::flipStr(const char* src, size_t len, char* dest) if (src == dest)
{
const unsigned b = (unsigned)len-- / 2;
- for (unsigned i = 0; i < b; i++)
+ for (unsigned i = 0; i < b; i++)
{
const char c = dest[i];
dest[i] = dest[len - i];
@@ -126,7 +128,7 @@ char* MimeHeaders::flipStr(const char* src, size_t len, char* dest) }
else
{
- for (unsigned i = 0; i < len; i++)
+ for (unsigned i = 0; i < len; i++)
dest[i] = src[len - 1 - i];
dest[len] = 0;
}
@@ -151,7 +153,7 @@ size_t MimeHeaders::getLength(void) char* MimeHeaders::writeToBuffer(char* dest)
{
- for (unsigned i=0; i < mCount; i++)
+ for (unsigned i=0; i < mCount; i++)
{
MimeHeader& H = mVals[i];
if (H.flags & 4)
@@ -188,7 +190,7 @@ char* MimeHeaders::readFromBuffer(char* src) {
clear();
- while (*src)
+ while (*src)
{
char* peol = strchr(src, '\n');
@@ -202,7 +204,7 @@ char* MimeHeaders::readFromBuffer(char* src) *peol = 0;
char* delim = strchr(src, ':');
- if (delim)
+ if (delim)
{
*delim = 0;
@@ -222,7 +224,7 @@ char* MimeHeaders::readFromBuffer(char* src) const char* MimeHeaders::find(const char* szFieldName)
{
size_t i;
- for (i = 0; i < mCount; i++)
+ for (i = 0; i < mCount; i++)
{
MimeHeader& MH = mVals[i];
if (_stricmp(MH.name, szFieldName) == 0)
@@ -233,7 +235,7 @@ const char* MimeHeaders::find(const char* szFieldName) char* szFieldNameR = (char*)alloca(len + 1);
flipStr(szFieldName, len, szFieldNameR);
- for (i = 0; i < mCount; i++)
+ for (i = 0; i < mCount; i++)
{
MimeHeader& MH = mVals[i];
if (_stricmp(MH.name, szFieldNameR) == 0 && (MH.flags & 3) == 0)
@@ -259,92 +261,92 @@ static const struct _tag_cpltbl { 708, "ASMO-708" }, // Arabic (ASMO 708)
{ 720, "DOS-720" }, // Arabic (Transparent ASMO); Arabic (DOS)
{ 737, "ibm737" }, // OEM Greek (formerly 437G); Greek (DOS)
- { 775, "ibm775" }, // OEM Baltic; Baltic (DOS)
- { 850, "ibm850" }, // OEM Multilingual Latin 1; Western European (DOS)
- { 852, "ibm852" }, // OEM Latin 2; Central European (DOS)
- { 855, "IBM855" }, // OEM Cyrillic (primarily Russian)
- { 857, "ibm857" }, // OEM Turkish; Turkish (DOS)
- { 858, "IBM00858" }, // OEM Multilingual Latin 1 + Euro symbol
- { 860, "IBM860" }, // OEM Portuguese; Portuguese (DOS)
- { 861, "ibm861" }, // OEM Icelandic; Icelandic (DOS)
- { 862, "DOS-862" }, // OEM Hebrew; Hebrew (DOS)
- { 863, "IBM863" }, // OEM French Canadian; French Canadian (DOS)
- { 864, "IBM864" }, // OEM Arabic; Arabic (864)
- { 865, "IBM865" }, // OEM Nordic; Nordic (DOS)
- { 866, "cp866" }, // OEM Russian; Cyrillic (DOS)
- { 869, "ibm869" }, // OEM Modern Greek; Greek, Modern (DOS)
- { 870, "IBM870" }, // IBM EBCDIC Multilingual/ROECE (Latin 2); IBM EBCDIC Multilingual Latin 2
- { 874, "windows-874" }, // ANSI/OEM Thai (same as 28605, ISO 8859-15); Thai (Windows)
- { 875, "cp875" }, // IBM EBCDIC Greek Modern
- { 932, "shift_jis" }, // ANSI/OEM Japanese; Japanese (Shift-JIS)
- { 936, "gb2312" }, // ANSI/OEM Simplified Chinese (PRC, Singapore); Chinese Simplified (GB2312)
- { 949, "ks_c_5601-1987" }, // ANSI/OEM Korean (Unified Hangul Code)
- { 950, "big5" }, // ANSI/OEM Traditional Chinese (Taiwan; Hong Kong SAR, PRC); Chinese Traditional (Big5)
- { 1026, "IBM1026" }, // IBM EBCDIC Turkish (Latin 5)
- { 1047, "IBM01047" }, // IBM EBCDIC Latin 1/Open System
- { 1140, "IBM01140" }, // IBM EBCDIC US-Canada (037 + Euro symbol); IBM EBCDIC (US-Canada-Euro)
- { 1141, "IBM01141" }, // IBM EBCDIC Germany (20273 + Euro symbol); IBM EBCDIC (Germany-Euro)
- { 1142, "IBM01142" }, // IBM EBCDIC Denmark-Norway (20277 + Euro symbol); IBM EBCDIC (Denmark-Norway-Euro)
- { 1143, "IBM01143" }, // IBM EBCDIC Finland-Sweden (20278 + Euro symbol); IBM EBCDIC (Finland-Sweden-Euro)
- { 1144, "IBM01144" }, // IBM EBCDIC Italy (20280 + Euro symbol); IBM EBCDIC (Italy-Euro)
- { 1145, "IBM01145" }, // IBM EBCDIC Latin America-Spain (20284 + Euro symbol); IBM EBCDIC (Spain-Euro)
- { 1146, "IBM01146" }, // IBM EBCDIC United Kingdom (20285 + Euro symbol); IBM EBCDIC (UK-Euro)
- { 1147, "IBM01147" }, // IBM EBCDIC France (20297 + Euro symbol); IBM EBCDIC (France-Euro)
- { 1148, "IBM01148" }, // IBM EBCDIC International (500 + Euro symbol); IBM EBCDIC (International-Euro)
- { 1149, "IBM01149" }, // IBM EBCDIC Icelandic (20871 + Euro symbol); IBM EBCDIC (Icelandic-Euro)
- { 1250, "windows-1250" }, // ANSI Central European; Central European (Windows)
- { 1251, "windows-1251" }, // ANSI Cyrillic; Cyrillic (Windows)
- { 1252, "windows-1252" }, // ANSI Latin 1; Western European (Windows)
- { 1253, "windows-1253" }, // ANSI Greek; Greek (Windows)
- { 1254, "windows-1254" }, // ANSI Turkish; Turkish (Windows)
- { 1255, "windows-1255" }, // ANSI Hebrew; Hebrew (Windows)
- { 1256, "windows-1256" }, // ANSI Arabic; Arabic (Windows)
- { 1257, "windows-1257" }, // ANSI Baltic; Baltic (Windows)
- { 1258, "windows-1258" }, // ANSI/OEM Vietnamese; Vietnamese (Windows)
- { 20127, "us-ascii" }, // US-ASCII (7-bit)
- { 20273, "IBM273" }, // IBM EBCDIC Germany
- { 20277, "IBM277" }, // IBM EBCDIC Denmark-Norway
- { 20278, "IBM278" }, // IBM EBCDIC Finland-Sweden
- { 20280, "IBM280" }, // IBM EBCDIC Italy
- { 20284, "IBM284" }, // IBM EBCDIC Latin America-Spain
- { 20285, "IBM285" }, // IBM EBCDIC United Kingdom
- { 20290, "IBM290" }, // IBM EBCDIC Japanese Katakana Extended
- { 20297, "IBM297" }, // IBM EBCDIC France
- { 20420, "IBM420" }, // IBM EBCDIC Arabic
- { 20423, "IBM423" }, // IBM EBCDIC Greek
- { 20424, "IBM424" }, // IBM EBCDIC Hebrew
- { 20838, "IBM-Thai" }, // IBM EBCDIC Thai
- { 20866, "koi8-r" }, // Russian (KOI8-R); Cyrillic (KOI8-R)
- { 20871, "IBM871" }, // IBM EBCDIC Icelandic
- { 20880, "IBM880" }, // IBM EBCDIC Cyrillic Russian
- { 20905, "IBM905" }, // IBM EBCDIC Turkish
- { 20924, "IBM00924" }, // IBM EBCDIC Latin 1/Open System (1047 + Euro symbol)
- { 20932, "EUC-JP" }, // Japanese (JIS 0208-1990 and 0121-1990)
- { 21025, "cp1025" }, // IBM EBCDIC Cyrillic Serbian-Bulgarian
- { 21866, "koi8-u" }, // Ukrainian (KOI8-U); Cyrillic (KOI8-U)
- { 28591, "iso-8859-1" }, // ISO 8859-1 Latin 1; Western European (ISO)
- { 28592, "iso-8859-2" }, // ISO 8859-2 Central European; Central European (ISO)
- { 28593, "iso-8859-3" }, // ISO 8859-3 Latin 3
- { 28594, "iso-8859-4" }, // ISO 8859-4 Baltic
- { 28595, "iso-8859-5" }, // ISO 8859-5 Cyrillic
- { 28596, "iso-8859-6" }, // ISO 8859-6 Arabic
- { 28597, "iso-8859-7" }, // ISO 8859-7 Greek
- { 28598, "iso-8859-8" }, // ISO 8859-8 Hebrew; Hebrew (ISO-Visual)
- { 28599, "iso-8859-9" }, // ISO 8859-9 Turkish
- { 28603, "iso-8859-13" }, // ISO 8859-13 Estonian
- { 28605, "iso-8859-15" }, // ISO 8859-15 Latin 9
- { 38598, "iso-8859-8-i" }, // ISO 8859-8 Hebrew; Hebrew (ISO-Logical)
- { 50220, "iso-2022-jp" }, // ISO 2022 Japanese with no halfwidth Katakana; Japanese (JIS)
- { 50221, "csISO2022JP" }, // ISO 2022 Japanese with halfwidth Katakana; Japanese (JIS-Allow 1 byte Kana)
- { 50222, "iso-2022-jp" }, // ISO 2022 Japanese JIS X 0201-1989; Japanese (JIS-Allow 1 byte Kana - SO/SI)
- { 50225, "iso-2022-kr" }, // ISO 2022 Korean
- { 50227, "ISO-2022-CN" }, // ISO 2022 Simplified Chinese; Chinese Simplified (ISO 2022)
- { 50229, "ISO-2022-CN-EXT" }, // ISO 2022 Traditional Chinese
- { 51932, "euc-jp" }, // EUC Japanese
- { 51936, "EUC-CN" }, // EUC Simplified Chinese; Chinese Simplified (EUC)
- { 51949, "euc-kr" }, // EUC Korean
- { 52936, "hz-gb-2312" }, // HZ-GB2312 Simplified Chinese; Chinese Simplified (HZ)
- { 54936, "GB18030" }, // Windows XP and later: GB18030 Simplified Chinese (4 byte); Chinese Simplified (GB18030)
+ { 775, "ibm775" }, // OEM Baltic; Baltic (DOS)
+ { 850, "ibm850" }, // OEM Multilingual Latin 1; Western European (DOS)
+ { 852, "ibm852" }, // OEM Latin 2; Central European (DOS)
+ { 855, "IBM855" }, // OEM Cyrillic (primarily Russian)
+ { 857, "ibm857" }, // OEM Turkish; Turkish (DOS)
+ { 858, "IBM00858" }, // OEM Multilingual Latin 1 + Euro symbol
+ { 860, "IBM860" }, // OEM Portuguese; Portuguese (DOS)
+ { 861, "ibm861" }, // OEM Icelandic; Icelandic (DOS)
+ { 862, "DOS-862" }, // OEM Hebrew; Hebrew (DOS)
+ { 863, "IBM863" }, // OEM French Canadian; French Canadian (DOS)
+ { 864, "IBM864" }, // OEM Arabic; Arabic (864)
+ { 865, "IBM865" }, // OEM Nordic; Nordic (DOS)
+ { 866, "cp866" }, // OEM Russian; Cyrillic (DOS)
+ { 869, "ibm869" }, // OEM Modern Greek; Greek, Modern (DOS)
+ { 870, "IBM870" }, // IBM EBCDIC Multilingual/ROECE (Latin 2); IBM EBCDIC Multilingual Latin 2
+ { 874, "windows-874" }, // ANSI/OEM Thai (same as 28605, ISO 8859-15); Thai (Windows)
+ { 875, "cp875" }, // IBM EBCDIC Greek Modern
+ { 932, "shift_jis" }, // ANSI/OEM Japanese; Japanese (Shift-JIS)
+ { 936, "gb2312" }, // ANSI/OEM Simplified Chinese (PRC, Singapore); Chinese Simplified (GB2312)
+ { 949, "ks_c_5601-1987" }, // ANSI/OEM Korean (Unified Hangul Code)
+ { 950, "big5" }, // ANSI/OEM Traditional Chinese (Taiwan; Hong Kong SAR, PRC); Chinese Traditional (Big5)
+ { 1026, "IBM1026" }, // IBM EBCDIC Turkish (Latin 5)
+ { 1047, "IBM01047" }, // IBM EBCDIC Latin 1/Open System
+ { 1140, "IBM01140" }, // IBM EBCDIC US-Canada (037 + Euro symbol); IBM EBCDIC (US-Canada-Euro)
+ { 1141, "IBM01141" }, // IBM EBCDIC Germany (20273 + Euro symbol); IBM EBCDIC (Germany-Euro)
+ { 1142, "IBM01142" }, // IBM EBCDIC Denmark-Norway (20277 + Euro symbol); IBM EBCDIC (Denmark-Norway-Euro)
+ { 1143, "IBM01143" }, // IBM EBCDIC Finland-Sweden (20278 + Euro symbol); IBM EBCDIC (Finland-Sweden-Euro)
+ { 1144, "IBM01144" }, // IBM EBCDIC Italy (20280 + Euro symbol); IBM EBCDIC (Italy-Euro)
+ { 1145, "IBM01145" }, // IBM EBCDIC Latin America-Spain (20284 + Euro symbol); IBM EBCDIC (Spain-Euro)
+ { 1146, "IBM01146" }, // IBM EBCDIC United Kingdom (20285 + Euro symbol); IBM EBCDIC (UK-Euro)
+ { 1147, "IBM01147" }, // IBM EBCDIC France (20297 + Euro symbol); IBM EBCDIC (France-Euro)
+ { 1148, "IBM01148" }, // IBM EBCDIC International (500 + Euro symbol); IBM EBCDIC (International-Euro)
+ { 1149, "IBM01149" }, // IBM EBCDIC Icelandic (20871 + Euro symbol); IBM EBCDIC (Icelandic-Euro)
+ { 1250, "windows-1250" }, // ANSI Central European; Central European (Windows)
+ { 1251, "windows-1251" }, // ANSI Cyrillic; Cyrillic (Windows)
+ { 1252, "windows-1252" }, // ANSI Latin 1; Western European (Windows)
+ { 1253, "windows-1253" }, // ANSI Greek; Greek (Windows)
+ { 1254, "windows-1254" }, // ANSI Turkish; Turkish (Windows)
+ { 1255, "windows-1255" }, // ANSI Hebrew; Hebrew (Windows)
+ { 1256, "windows-1256" }, // ANSI Arabic; Arabic (Windows)
+ { 1257, "windows-1257" }, // ANSI Baltic; Baltic (Windows)
+ { 1258, "windows-1258" }, // ANSI/OEM Vietnamese; Vietnamese (Windows)
+ { 20127, "us-ascii" }, // US-ASCII (7-bit)
+ { 20273, "IBM273" }, // IBM EBCDIC Germany
+ { 20277, "IBM277" }, // IBM EBCDIC Denmark-Norway
+ { 20278, "IBM278" }, // IBM EBCDIC Finland-Sweden
+ { 20280, "IBM280" }, // IBM EBCDIC Italy
+ { 20284, "IBM284" }, // IBM EBCDIC Latin America-Spain
+ { 20285, "IBM285" }, // IBM EBCDIC United Kingdom
+ { 20290, "IBM290" }, // IBM EBCDIC Japanese Katakana Extended
+ { 20297, "IBM297" }, // IBM EBCDIC France
+ { 20420, "IBM420" }, // IBM EBCDIC Arabic
+ { 20423, "IBM423" }, // IBM EBCDIC Greek
+ { 20424, "IBM424" }, // IBM EBCDIC Hebrew
+ { 20838, "IBM-Thai" }, // IBM EBCDIC Thai
+ { 20866, "koi8-r" }, // Russian (KOI8-R); Cyrillic (KOI8-R)
+ { 20871, "IBM871" }, // IBM EBCDIC Icelandic
+ { 20880, "IBM880" }, // IBM EBCDIC Cyrillic Russian
+ { 20905, "IBM905" }, // IBM EBCDIC Turkish
+ { 20924, "IBM00924" }, // IBM EBCDIC Latin 1/Open System (1047 + Euro symbol)
+ { 20932, "EUC-JP" }, // Japanese (JIS 0208-1990 and 0121-1990)
+ { 21025, "cp1025" }, // IBM EBCDIC Cyrillic Serbian-Bulgarian
+ { 21866, "koi8-u" }, // Ukrainian (KOI8-U); Cyrillic (KOI8-U)
+ { 28591, "iso-8859-1" }, // ISO 8859-1 Latin 1; Western European (ISO)
+ { 28592, "iso-8859-2" }, // ISO 8859-2 Central European; Central European (ISO)
+ { 28593, "iso-8859-3" }, // ISO 8859-3 Latin 3
+ { 28594, "iso-8859-4" }, // ISO 8859-4 Baltic
+ { 28595, "iso-8859-5" }, // ISO 8859-5 Cyrillic
+ { 28596, "iso-8859-6" }, // ISO 8859-6 Arabic
+ { 28597, "iso-8859-7" }, // ISO 8859-7 Greek
+ { 28598, "iso-8859-8" }, // ISO 8859-8 Hebrew; Hebrew (ISO-Visual)
+ { 28599, "iso-8859-9" }, // ISO 8859-9 Turkish
+ { 28603, "iso-8859-13" }, // ISO 8859-13 Estonian
+ { 28605, "iso-8859-15" }, // ISO 8859-15 Latin 9
+ { 38598, "iso-8859-8-i" }, // ISO 8859-8 Hebrew; Hebrew (ISO-Logical)
+ { 50220, "iso-2022-jp" }, // ISO 2022 Japanese with no halfwidth Katakana; Japanese (JIS)
+ { 50221, "csISO2022JP" }, // ISO 2022 Japanese with halfwidth Katakana; Japanese (JIS-Allow 1 byte Kana)
+ { 50222, "iso-2022-jp" }, // ISO 2022 Japanese JIS X 0201-1989; Japanese (JIS-Allow 1 byte Kana - SO/SI)
+ { 50225, "iso-2022-kr" }, // ISO 2022 Korean
+ { 50227, "ISO-2022-CN" }, // ISO 2022 Simplified Chinese; Chinese Simplified (ISO 2022)
+ { 50229, "ISO-2022-CN-EXT" }, // ISO 2022 Traditional Chinese
+ { 51932, "euc-jp" }, // EUC Japanese
+ { 51936, "EUC-CN" }, // EUC Simplified Chinese; Chinese Simplified (EUC)
+ { 51949, "euc-kr" }, // EUC Korean
+ { 52936, "hz-gb-2312" }, // HZ-GB2312 Simplified Chinese; Chinese Simplified (HZ)
+ { 54936, "GB18030" }, // Windows XP and later: GB18030 Simplified Chinese (4 byte); Chinese Simplified (GB18030)
};
@@ -361,7 +363,7 @@ static unsigned FindCP(const char* mimecp) }
return cp;
}
-
+
static int SingleHexToDecimal(char c)
{
@@ -379,17 +381,17 @@ static void PQDecode(char* str) {
switch (*s)
{
- case '=':
+ case '=':
{
int digit1 = SingleHexToDecimal(s[1]);
- if (digit1 != -1)
+ if (digit1 != -1)
{
int digit2 = SingleHexToDecimal(s[2]);
- if (digit2 != -1)
+ if (digit2 != -1)
{
s += 3;
*d++ = (char)((digit1 << 4) | digit2);
- }
+ }
}
break;
}
@@ -433,8 +435,8 @@ wchar_t* MimeHeaders::decode(const char* val) *cp = 0;
size_t sz = utf8toutf16(p, resp);
- ssz -= sz; resp += sz;
- cp += 2;
+ ssz -= sz; resp += sz;
+ cp += 2;
char *enc = strchr(cp, '?');
if (enc == NULL) break;
@@ -464,7 +466,7 @@ wchar_t* MimeHeaders::decode(const char* val) PQDecode(fld);
break;
}
-
+
if (_stricmp(cp, "UTF-8") == 0)
{
sz = utf8toutf16(fld, resp);
@@ -480,7 +482,7 @@ wchar_t* MimeHeaders::decode(const char* val) p = pe + 2;
}
- utf8toutf16(p, resp);
+ utf8toutf16(p, resp);
return res;
}
@@ -509,12 +511,12 @@ char* MimeHeaders::decodeMailBody(char* msgBody) }
return res;
}
-
+
int sttDivideWords(char* parBuffer, int parMinItems, char** parDest)
{
int i;
- for (i=0; i < parMinItems; i++)
+ for (i=0; i < parMinItems; i++)
{
parDest[i] = parBuffer;
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 94ba22c19f..7c52fb5b9c 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -44,7 +46,7 @@ const char* CMsnProto::MirandaStatusToMSN(int status) WORD CMsnProto::MSNStatusToMiranda(const char *status)
{
- switch((*(PDWORD)status&0x00FFFFFF) | 0x20000000)
+ switch((*(PDWORD)status&0x00FFFFFF) | 0x20000000)
{
case ' LDI': return ID_STATUS_IDLE;
case ' NLN': return ID_STATUS_ONLINE;
@@ -55,25 +57,25 @@ WORD CMsnProto::MSNStatusToMiranda(const char *status) case ' YSB': return ID_STATUS_OCCUPIED;
case ' NDH': return ID_STATUS_INVISIBLE;
default: return ID_STATUS_OFFLINE;
- }
+ }
}
char** CMsnProto::GetStatusMsgLoc(int status)
{
- static const int modes[MSN_NUM_MODES] =
+ static const int modes[MSN_NUM_MODES] =
{
ID_STATUS_ONLINE,
ID_STATUS_AWAY,
- ID_STATUS_DND,
+ ID_STATUS_DND,
ID_STATUS_NA,
ID_STATUS_OCCUPIED,
ID_STATUS_FREECHAT,
ID_STATUS_INVISIBLE,
ID_STATUS_ONTHEPHONE,
- ID_STATUS_OUTTOLUNCH,
+ ID_STATUS_OUTTOLUNCH,
};
- for (int i=0; i < MSN_NUM_MODES; i++)
+ for (int i=0; i < MSN_NUM_MODES; i++)
if (modes[i] == status) return &msnModeMsgs[i];
return NULL;
@@ -134,7 +136,7 @@ void CMsnProto::MSN_DebugLog(const char *fmt, ...) void CMsnProto::InitCustomFolders(void)
{
- if (InitCstFldRan) return;
+ if (InitCstFldRan) return;
TCHAR folder[MAX_PATH];
TCHAR *tszModuleName = mir_a2t(m_szModuleName);
@@ -188,7 +190,7 @@ char* MSN_GetAvatarHash(char* szContext, char** pszUrl) break;
}
}
- }
+ }
}
ezxml_free(xmli);
@@ -272,19 +274,19 @@ void CMsnProto::MSN_GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t c int MSN_GetImageFormat(void* buf, const TCHAR** ext)
{
if (*(unsigned short*)buf == 0xd8ff) {
- *ext = _T("jpg");
+ *ext = _T("jpg");
return PA_FORMAT_JPEG;
}
if (*(unsigned short*)buf == 0x4d42) {
- *ext = _T("bmp");
+ *ext = _T("bmp");
return PA_FORMAT_BMP;
}
if (*(unsigned*)buf == 0x474e5089) {
- *ext = _T("png");
+ *ext = _T("png");
return PA_FORMAT_PNG;
}
if (*(unsigned*)buf == 0x38464947) {
- *ext = _T("gif");
+ *ext = _T("gif");
return PA_FORMAT_GIF;
}
@@ -295,7 +297,7 @@ int MSN_GetImageFormat(void* buf, const TCHAR** ext) int MSN_GetImageFormat(const TCHAR* file)
{
const TCHAR *ext = _tcsrchr(file, '.');
- if (ext == NULL)
+ if (ext == NULL)
return PA_FORMAT_UNKNOWN;
if (_tcsicmp(ext, _T(".gif")) == 0)
return PA_FORMAT_GIF;
@@ -422,7 +424,7 @@ void CMsnProto::MSN_GetCustomSmileyFileName(HANDLE hContact, TCHAR* pszDest, si tPathLen = _tcslen(pszDest);
}
- if (hContact != NULL)
+ if (hContact != NULL)
{
DBVARIANT dbv = {0};
if (getTString(hContact, "e-mail", &dbv))
@@ -481,7 +483,7 @@ void CMsnProto::MSN_GoOffline(void) clearCachedMsg();
if (!Miranda_Terminated()) {
- int msnOldStatus = m_iStatus; m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
+ int msnOldStatus = m_iStatus; m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
SendBroadcast(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)msnOldStatus, ID_STATUS_OFFLINE);
isIdle = false;
@@ -526,7 +528,7 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha if (*p == 0) {
UrlEncode(dbv.pszVal, tFontName, sizeof(tFontName));
MSN_FreeVariant(&dbv);
- }
+ }
}
int tStyle = DBGetContactSettingByte(NULL, "SRMsg", "Font0Sty", 0);
@@ -542,7 +544,7 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha tFontStyle[0] = 0;
}
- if (parFlags & MSG_OFFLINE)
+ if (parFlags & MSG_OFFLINE)
off += mir_snprintf(buf + off, sizeof(buf) - off, "Dest-Agent: client\r\n");
off += mir_snprintf(buf + off, sizeof(buf) - off, "Content-Type: text/plain; charset=UTF-8\r\n");
@@ -552,10 +554,10 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha int seq;
if (netId == NETID_YAHOO || netId == NETID_MOB || (parFlags & MSG_OFFLINE))
- seq = sendPacket("UUM", "%s %d %c %d\r\n%s%s", email, netId, msgType,
+ seq = sendPacket("UUM", "%s %d %c %d\r\n%s%s", email, netId, msgType,
strlen(parMsg)+off, buf, parMsg);
else
- seq = sendPacket("MSG", "%c %d\r\n%s%s", msgType,
+ seq = sendPacket("MSG", "%c %d\r\n%s%s", msgType,
strlen(parMsg)+off, buf, parMsg);
return seq;
@@ -627,14 +629,14 @@ static ThreadData* FindThreadTimer(UINT timerId) return res;
}
-static VOID CALLBACK TypingTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
+static VOID CALLBACK TypingTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
ThreadData* T = FindThreadTimer(idEvent);
if (T != NULL)
T->proto->MSN_SendTyping(T, NULL, 1);
else
KillTimer(NULL, idEvent);
-}
+}
void CMsnProto::MSN_StartStopTyping(ThreadData* info, bool start)
@@ -673,7 +675,7 @@ void CMsnProto::MSN_SendStatusMessage(const char* msg) char szMsg[2048];
if (msnCurrentMedia.cbSize == 0) {
sz = mir_snprintf(szMsg, sizeof(szMsg), "<Data><PSM>%s</PSM><CurrentMedia></CurrentMedia><MachineGuid>%s</MachineGuid>"
- "<DDP></DDP><SignatureSound></SignatureSound><Scene></Scene><ColorScheme></ColorScheme></Data>",
+ "<DDP></DDP><SignatureSound></SignatureSound><Scene></Scene><ColorScheme></ColorScheme></Data>",
msgEnc, MyOptions.szMachineGuid);
}
else {
@@ -707,14 +709,14 @@ void CMsnProto::MSN_SendStatusMessage(const char* msg) char *szPlayer = HtmlEncodeUTF8T(msnCurrentMedia.ptszPlayer);
char *szType = HtmlEncodeUTF8T(msnCurrentMedia.ptszType);
- sz = mir_snprintf(szMsg, sizeof szMsg,
+ sz = mir_snprintf(szMsg, sizeof szMsg,
"<Data>"
"<PSM>%s</PSM>"
"<CurrentMedia>%s\\0%s\\01\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0\\0</CurrentMedia>"
"<MachineGuid>%s</MachineGuid><DDP></DDP><SignatureSound></SignatureSound><Scene></Scene><ColorScheme></ColorScheme>"
"<DDP></DDP><SignatureSound></SignatureSound><Scene></Scene><ColorScheme></ColorScheme>"
- "</Data>",
- msgEnc, szPlayer, szType, szFormatEnc, szTitle, szArtist, szAlbum, szTrack, szYear, szGenre,
+ "</Data>",
+ msgEnc, szPlayer, szType, szFormatEnc, szTitle, szArtist, szAlbum, szTrack, szYear, szGenre,
szLength, szPlayer, szType, MyOptions.szMachineGuid);
mir_free(szArtist);
@@ -792,10 +794,10 @@ void CMsnProto::MSN_SetServerStatus(int newStatus) if (newStatus != ID_STATUS_OFFLINE) {
DBVARIANT msnObject = {0};
- if (ServiceExists(MS_AV_SETMYAVATAR))
+ if (ServiceExists(MS_AV_SETMYAVATAR))
getString("PictObject", &msnObject);
- // Capabilties: WLM 2009, Chunking, UUN Bootstrap
+ // Capabilties: WLM 2009, Chunking, UUN Bootstrap
myFlags = 0xA0000000 | cap_SupportsChunking | cap_SupportsP2PBootstrap | cap_SupportsSipInvite;
if (getByte("MobileEnabled", 0) && getByte("MobileAllowed", 0))
myFlags |= cap_MobileEnabled;
@@ -804,7 +806,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus) char szMsg[256];
if (m_iStatus < ID_STATUS_ONLINE) {
- int sz = mir_snprintf(szMsg, sizeof(szMsg),
+ int sz = mir_snprintf(szMsg, sizeof(szMsg),
"<EndpointData><Capabilities>%u:%u</Capabilities></EndpointData>", myFlags, myFlagsEx);
msnNsThread->sendPacket( "UUX", "%d\r\n%s", sz, szMsg );
@@ -829,13 +831,13 @@ void CMsnProto::MSN_SetServerStatus(int newStatus) szPlace = mir_utf8encodeT(buf);
}
- int sz = mir_snprintf(szMsg, sizeof(szMsg),
+ int sz = mir_snprintf(szMsg, sizeof(szMsg),
"<PrivateEndpointData>"
"<EpName>%s</EpName>"
"<Idle>%s</Idle>"
"<ClientType>1</ClientType>"
"<State>%s</State>"
- "</PrivateEndpointData>",
+ "</PrivateEndpointData>",
szPlace, newStatus == ID_STATUS_IDLE ? "true" : "false", szStatusName);
msnNsThread->sendPacket("UUX", "%d\r\n%s", sz, szMsg);
mir_free(szPlace);
@@ -891,7 +893,7 @@ void CMsnProto::MsnInvokeMyURL(bool ismail, const char* url) strcpy(hippy, passport);
strcat(hippy, "\\ppsecure\\sha1auth.srf?lc=");
strcat(hippy, itoa(langpref, passport, 10));
- strcat(hippy, "&token=");
+ strcat(hippy, "&token=");
size_t hiplen = strlen(hippy);
UrlEncode(post, hippy+hiplen, hipsz-hiplen);
mir_free(post);
@@ -928,7 +930,7 @@ LRESULT CALLBACK NullWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara PopupData *tData = (PopupData*)PUGetPluginData(hWnd);
switch (msg) {
- case WM_COMMAND:
+ case WM_COMMAND:
if (tData != NULL) {
if (tData->flags & MSN_HOTMAIL_POPUP) {
HANDLE hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, NULL);
@@ -951,7 +953,7 @@ LRESULT CALLBACK NullWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara PUDeletePopUp(hWnd);
break;
- case UM_FREEPLUGINDATA:
+ case UM_FREEPLUGINDATA:
if (tData != NULL && tData != (PopupData*)CALLSERVICE_NOTFOUND) {
mir_free(tData->title);
mir_free(tData->text);
@@ -1021,7 +1023,7 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) if (pud->flags & MSN_ALLOW_MSGBOX) {
TCHAR szMsg[MAX_SECONDLINE + MAX_CONTACTNAME];
mir_sntprintf(szMsg, SIZEOF(szMsg), _T("%s:\n%s"), pud->title, pud->text);
- MessageBox(NULL, szMsg, TranslateT("MSN Protocol"),
+ MessageBox(NULL, szMsg, TranslateT("MSN Protocol"),
MB_OK | (iserr ? MB_ICONERROR : MB_ICONINFORMATION));
}
mir_free(pud->title);
@@ -1097,11 +1099,11 @@ filetransfer::~filetransfer(void) if (fileId != -1)
{
_close(fileId);
- if (p2p_appID != MSN_APPID_FILE && !(std.flags & PFTS_SENDING))
+ if (p2p_appID != MSN_APPID_FILE && !(std.flags & PFTS_SENDING))
proto->p2p_pictureTransferFailed(this);
}
- if (!bCompleted && p2p_appID == MSN_APPID_FILE)
+ if (!bCompleted && p2p_appID == MSN_APPID_FILE)
{
std.ptszFiles = NULL;
std.totalFiles = 0;
@@ -1115,7 +1117,7 @@ filetransfer::~filetransfer(void) mir_free(std.tszCurrentFile);
mir_free(std.tszWorkingDir);
- if (std.ptszFiles != NULL)
+ if (std.ptszFiles != NULL)
{
for (int i=0; std.ptszFiles[i]; i++)
mir_free(std.ptszFiles[i]);
@@ -1153,7 +1155,7 @@ int filetransfer::create(void) int filetransfer::openNext(void)
{
- if (fileId != -1)
+ if (fileId != -1)
{
close();
++std.currentFileNumber;
@@ -1169,12 +1171,12 @@ int filetransfer::openNext(void) ++cf;
}
- if (std.ptszFiles && std.ptszFiles[cf])
+ if (std.ptszFiles && std.ptszFiles[cf])
{
bCompleted = false;
replaceStrT(std.tszCurrentFile, std.ptszFiles[cf]);
fileId = _topen(std.tszCurrentFile, _O_BINARY | _O_RDONLY, _S_IREAD);
- if (fileId != -1)
+ if (fileId != -1)
{
std.currentFileSize = _filelengthi64(fileId);
std.currentFileProgress = 0;
@@ -1300,7 +1302,7 @@ char* TWinErrorCode::getText() char* MSN_Base64Decode(const char* str)
{
- if (str == NULL) return NULL;
+ if (str == NULL) return NULL;
size_t len = strlen(str);
size_t reslen = Netlib_GetBase64DecodedBufferSize(len) + 4;
@@ -1311,7 +1313,7 @@ char* MSN_Base64Decode(const char* str) char* p1 = (char*)alloca(len+5);
memcpy(p1, p, len);
p = p1;
- p1 += len;
+ p1 += len;
for (int i = 4 - (len & 3); i > 0; i--, p1++, len++)
*p1 = '=';
*p1 = 0;
@@ -1336,7 +1338,7 @@ bool CMsnProto::MSN_IsMeByContact(HANDLE hContact, char* szEmail) char *emailPtr = szEmail ? szEmail : tEmail;
*emailPtr = 0;
- if (getStaticString(hContact, "e-mail", emailPtr, sizeof(tEmail)))
+ if (getStaticString(hContact, "e-mail", emailPtr, sizeof(tEmail)))
return false;
return _stricmp(emailPtr, MyOptions.szEmail) == 0;
@@ -1344,14 +1346,14 @@ bool CMsnProto::MSN_IsMeByContact(HANDLE hContact, char* szEmail) bool MSN_MsgWndExist(HANDLE hContact)
{
- MessageWindowInputData msgWinInData =
+ MessageWindowInputData msgWinInData =
{ sizeof(MessageWindowInputData), hContact, MSG_WINDOW_UFLAG_MSG_BOTH };
MessageWindowData msgWinData = {0};
msgWinData.cbSize = sizeof(MessageWindowData);
bool res = CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgWinInData, (LPARAM)&msgWinData) != 0;
res = res || msgWinData.hwndWindow;
- if (res) {
+ if (res) {
msgWinInData.hContact = (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0);
if (msgWinInData.hContact != NULL) {
res = CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgWinInData, (LPARAM)&msgWinData) != 0;
diff --git a/protocols/MSN/src/msn_msgqueue.cpp b/protocols/MSN/src/msn_msgqueue.cpp index f897a70513..af52e9cea7 100644 --- a/protocols/MSN/src/msn_msgqueue.cpp +++ b/protocols/MSN/src/msn_msgqueue.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -73,10 +75,10 @@ const char* CMsnProto::MsgQueue_CheckContact(const char* wlid, time_t tsc) for (int i=0; i < lsMessageQueue.getCount(); i++)
{
if (_stricmp(lsMessageQueue[i].wlid, wlid) == 0 && (tsc == 0 || (ts - lsMessageQueue[i].ts) < tsc))
- {
+ {
ret = wlid;
break;
- }
+ }
}
LeaveCriticalSection(&csMsgQueue);
@@ -102,7 +104,7 @@ const char* CMsnProto::MsgQueue_GetNextRecipient(void) lsMessageQueue[i].allocatedToThread = 1;
break;
- }
+ }
}
LeaveCriticalSection(&csMsgQueue);
@@ -118,10 +120,10 @@ bool CMsnProto::MsgQueue_GetNext(const char* wlid, MsgQueueEntry& retVal) for(i=0; i < lsMessageQueue.getCount(); i++)
if (_stricmp(lsMessageQueue[i].wlid, wlid) == 0)
break;
-
+
bool res = i != lsMessageQueue.getCount();
if (res)
- {
+ {
retVal = lsMessageQueue[i];
lsMessageQueue.remove(i);
}
@@ -136,7 +138,7 @@ int CMsnProto::MsgQueue_NumMsg(const char* wlid) for(int i=0; i < lsMessageQueue.getCount(); i++)
res += (_stricmp(lsMessageQueue[i].wlid, wlid) == 0);
-
+
LeaveCriticalSection(&csMsgQueue);
return res;
}
@@ -155,7 +157,7 @@ void CMsnProto::MsgQueue_Clear(const char* wlid, bool msg) if (E.msgSize == 0)
{
HANDLE hContact = MSN_HContactFromEmail(E.wlid);
- SendBroadcast(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED,
+ SendBroadcast(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED,
(HANDLE)E.seq, (LPARAM)MSN_Translate("Message delivery failed"));
}
mir_free(E.message);
@@ -176,17 +178,17 @@ void CMsnProto::MsgQueue_Clear(const char* wlid, bool msg) {
bool msgfnd = E.msgSize == 0 && E.ts < ts;
int seq = E.seq;
-
+
mir_free(E.message);
mir_free(E.wlid);
if (E.cont) delete E.cont;
lsMessageQueue.remove(i);
- if (msgfnd)
+ if (msgfnd)
{
LeaveCriticalSection(&csMsgQueue);
HANDLE hContact = MSN_HContactFromEmail(wlid);
- SendBroadcast(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)seq,
+ SendBroadcast(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)seq,
(LPARAM)MSN_Translate("Message delivery failed"));
i = 0;
EnterCriticalSection(&csMsgQueue);
diff --git a/protocols/MSN/src/msn_msgsplit.cpp b/protocols/MSN/src/msn_msgsplit.cpp index 0a58278e17..ecd76b386a 100644 --- a/protocols/MSN/src/msn_msgsplit.cpp +++ b/protocols/MSN/src/msn_msgsplit.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
@@ -24,7 +26,7 @@ chunkedmsg::chunkedmsg(const char* tid, const size_t totsz, const bool tbychunk) : size(totsz), recvsz(0), bychunk(tbychunk)
{
id = mir_strdup(tid);
- msg = tbychunk ? NULL : (char*)mir_alloc(totsz + 1);
+ msg = tbychunk ? NULL : (char*)mir_alloc(totsz + 1);
}
chunkedmsg::~chunkedmsg()
@@ -35,7 +37,7 @@ chunkedmsg::~chunkedmsg() void chunkedmsg::add(const char* tmsg, size_t offset, size_t portion)
{
- if (bychunk)
+ if (bychunk)
{
size_t oldsz = recvsz;
recvsz += portion;
@@ -43,7 +45,7 @@ void chunkedmsg::add(const char* tmsg, size_t offset, size_t portion) memcpy( msg + oldsz, tmsg, portion );
--size;
}
- else
+ else
{
size_t newsz = offset + portion;
if (newsz > size)
@@ -51,20 +53,20 @@ void chunkedmsg::add(const char* tmsg, size_t offset, size_t portion) portion = size - offset;
newsz = size;
}
- memcpy(msg + offset, tmsg, portion);
- if (newsz > recvsz) recvsz = newsz;
+ memcpy(msg + offset, tmsg, portion);
+ if (newsz > recvsz) recvsz = newsz;
}
}
bool chunkedmsg::get(char*& tmsg, size_t& tsize)
{
bool alldata = bychunk ? size == 0 : recvsz == size;
- if (alldata)
- {
+ if (alldata)
+ {
msg[recvsz] = 0;
- tmsg = msg;
+ tmsg = msg;
tsize = recvsz;
- msg = NULL;
+ msg = NULL;
}
return alldata;
@@ -75,7 +77,7 @@ int CMsnProto::addCachedMsg(const char* id, const char* msg, const size_t offset const size_t portion, const size_t totsz, const bool bychunk)
{
int idx = msgCache.getIndex((chunkedmsg*)&id);
- if (idx == -1)
+ if (idx == -1)
{
msgCache.insert(new chunkedmsg(id, totsz, bychunk));
idx = msgCache.getIndex((chunkedmsg*)&id);
diff --git a/protocols/MSN/src/msn_natdetect.cpp b/protocols/MSN/src/msn_natdetect.cpp index 0d17f4a530..1e53ec7117 100644 --- a/protocols/MSN/src/msn_natdetect.cpp +++ b/protocols/MSN/src/msn_natdetect.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
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 30e74d4d36..2acbb835b1 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -78,9 +80,9 @@ INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
+ switch (msg)
{
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
@@ -90,7 +92,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemTextA(hwndDlg, IDC_HANDLE, proto->MyOptions.szEmail);
char tBuffer[MAX_PATH];
- if (!proto->getStaticString(NULL, "Password", tBuffer, sizeof(tBuffer)))
+ if (!proto->getStaticString(NULL, "Password", tBuffer, sizeof(tBuffer)))
{
CallService(MS_DB_CRYPT_DECODESTRING, strlen(tBuffer)+1, (LPARAM)tBuffer);
tBuffer[16] = 0;
@@ -100,13 +102,13 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP HWND wnd = GetDlgItem(hwndDlg, IDC_HANDLE2);
DBVARIANT dbv;
- if (!proto->getTString("Nick", &dbv))
+ if (!proto->getTString("Nick", &dbv))
{
SetWindowText(wnd, dbv.ptszVal);
MSN_FreeVariant(&dbv);
}
EnableWindow(wnd, proto->msnLoggedIn);
- EnableWindow(GetDlgItem(hwndDlg, IDC_MOBILESEND), proto->msnLoggedIn &&
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MOBILESEND), proto->msnLoggedIn &&
proto->getByte("MobileEnabled", 0) && proto->getByte("MobileAllowed", 0));
CheckDlgButton(hwndDlg, IDC_MOBILESEND, proto->getByte("MobileAllowed", 0));
@@ -121,7 +123,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!proto->getStaticString(NULL, "MailerPath", tBuffer, sizeof(tBuffer)))
SetDlgItemTextA(hwndDlg, IDC_MAILER_APP, tBuffer);
- if (!proto->msnLoggedIn)
+ if (!proto->msnLoggedIn)
{
EnableWindow(GetDlgItem(hwndDlg, IDC_MANAGEGROUPS), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_DISABLE_ANOTHER_CONTACTS), FALSE);
@@ -131,24 +133,24 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
case WM_COMMAND:
- if (LOWORD(wParam) == IDC_NEWMSNACCOUNTLINK)
+ if (LOWORD(wParam) == IDC_NEWMSNACCOUNTLINK)
{
CallService(MS_UTILS_OPENURL, 1, (LPARAM)"https://signup.live.com");
return TRUE;
}
- if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
+ if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
{
- switch(LOWORD(wParam))
+ switch(LOWORD(wParam))
{
case IDC_HANDLE: case IDC_PASSWORD: case IDC_HANDLE2:
case IDC_GATEWAYSERVER: case IDC_YOURHOST: case IDC_DIRECTSERVER:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
+ }
}
if (HIWORD(wParam) == BN_CLICKED)
- switch(LOWORD(wParam))
+ switch(LOWORD(wParam))
{
case IDC_SENDFONTINFO:
case IDC_DISABLE_ANOTHER_CONTACTS:
@@ -170,7 +172,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
- case IDC_RUN_APP_ON_HOTMAIL:
+ case IDC_RUN_APP_ON_HOTMAIL:
{
BOOL tIsChosen = IsDlgButtonChecked(hwndDlg, IDC_RUN_APP_ON_HOTMAIL);
EnableWindow(GetDlgItem(hwndDlg, IDC_MAILER_APP), tIsChosen);
@@ -179,7 +181,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP break;
}
- case IDC_ENTER_MAILER_APP:
+ case IDC_ENTER_MAILER_APP:
{
HWND tEditField = GetDlgItem(hwndDlg, IDC_MAILER_APP);
@@ -188,19 +190,19 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP size_t tSelectLen = 0;
- if (szFile[0] == '\"')
+ if (szFile[0] == '\"')
{
char* p = strchr(szFile+1, '\"');
- if (p != NULL)
+ if (p != NULL)
{
*p = '\0';
memmove(szFile, szFile+1, strlen(szFile));
tSelectLen += 2;
goto LBL_Continue;
- }
+ }
}
- {
+ {
char* p = strchr(szFile, ' ');
if (p != NULL) *p = '\0';
}
@@ -216,7 +218,7 @@ LBL_Continue: if (GetOpenFileNameA(&ofn) != TRUE)
break;
- if (strchr(szFile, ' ') != NULL)
+ if (strchr(szFile, ' ') != NULL)
{
char tmpBuf[MAX_PATH + 2];
mir_snprintf(tmpBuf, sizeof(tmpBuf), "\"%s\"", szFile);
@@ -226,13 +228,13 @@ LBL_Continue: SendMessage(tEditField, EM_SETSEL, 0, tSelectLen);
SendMessageA(tEditField, EM_REPLACESEL, TRUE, LPARAM(szFile));
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
+ }
}
break;
case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
+ if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
{
bool reconnectRequired = false;
TCHAR screenStr[MAX_PATH];
@@ -242,7 +244,7 @@ LBL_Continue: CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, sizeof(szEmail));
- if (strcmp(_strlwr(szEmail), proto->MyOptions.szEmail))
+ if (strcmp(_strlwr(szEmail), proto->MyOptions.szEmail))
{
reconnectRequired = true;
strcpy(proto->MyOptions.szEmail, szEmail);
@@ -251,23 +253,23 @@ LBL_Continue: GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, sizeof(password));
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(password),(LPARAM)password);
- if (!proto->getString("Password", &dbv))
+ if (!proto->getString("Password", &dbv))
{
- if (strcmp(password, dbv.pszVal))
+ if (strcmp(password, dbv.pszVal))
{
reconnectRequired = true;
proto->setString("Password", password);
}
MSN_FreeVariant(&dbv);
}
- else
+ else
{
reconnectRequired = true;
proto->setString("Password", password);
}
GetDlgItemText(hwndDlg, IDC_HANDLE2, screenStr, SIZEOF(screenStr));
- if (!proto->getTString("Nick", &dbv))
+ if (!proto->getTString("Nick", &dbv))
{
if (_tcscmp(dbv.ptszVal, screenStr))
proto->MSN_SendNickname(screenStr);
@@ -286,7 +288,7 @@ LBL_Continue: }
unsigned tValue = IsDlgButtonChecked(hwndDlg, IDC_DISABLE_ANOTHER_CONTACTS);
- if (tValue != proto->msnOtherContactsBlocked && proto->msnLoggedIn)
+ if (tValue != proto->msnOtherContactsBlocked && proto->msnLoggedIn)
{
proto->msnOtherContactsBlocked = tValue;
proto->msnNsThread->sendPacket("BLP", tValue ? "BL" : "AL");
@@ -302,7 +304,7 @@ LBL_Continue: proto->setTString("MailerPath", screenStr);
if (reconnectRequired && proto->msnLoggedIn)
- MessageBox(hwndDlg, TranslateT("The changes you have made require you to reconnect to the MSN Messenger network before they take effect"),
+ MessageBox(hwndDlg, TranslateT("The changes you have made require you to reconnect to the MSN Messenger network before they take effect"),
TranslateT("MSN Options"), MB_OK);
proto->LoadOptions();
@@ -328,20 +330,20 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
CMsnProto* proto = (CMsnProto*)lParam;
- if (!proto->getString(NULL, "DirectServer", &dbv))
+ if (!proto->getString(NULL, "DirectServer", &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, dbv.pszVal);
MSN_FreeVariant(&dbv);
}
- else
+ else
SetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, MSN_DEFAULT_LOGIN_SERVER);
- if (!proto->getString(NULL, "GatewayServer", &dbv))
+ if (!proto->getString(NULL, "GatewayServer", &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, dbv.pszVal);
MSN_FreeVariant(&dbv);
}
- else
+ else
SetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, MSN_DEFAULT_GATEWAY);
CheckDlgButton(hwndDlg, IDC_SLOWSEND, proto->getByte("SlowSend", 0));
@@ -354,14 +356,14 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam if (gethst < 2) gethst = !gethst;
char ipaddr[256] = "";
- if (gethst == 1)
+ if (gethst == 1)
{
if (proto->getStaticString(NULL, "YourHost", ipaddr, sizeof(ipaddr)))
gethst = 0;
}
if (gethst == 0)
{
- mir_snprintf(ipaddr, sizeof(ipaddr), "%s", proto->msnLoggedIn ?
+ mir_snprintf(ipaddr, sizeof(ipaddr), "%s", proto->msnLoggedIn ?
proto->MyConnection.GetMyExtIPStr() : "");
}
SendDlgItemMessage(hwndDlg, IDC_HOSTOPT, CB_SETCURSEL, gethst, 0);
@@ -375,7 +377,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam }
case WM_COMMAND:
- switch (LOWORD(wParam))
+ switch (LOWORD(wParam))
{
case IDC_RESETSERVER:
SetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, MSN_DEFAULT_LOGIN_SERVER);
@@ -401,17 +403,17 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam if (HIWORD(wParam) == BN_CLICKED)
{
- switch(LOWORD(wParam))
+ switch(LOWORD(wParam))
{
case IDC_SLOWSEND:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
- }
+ }
}
break;
case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
+ if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
{
bool reconnectRequired = false;
char str[MAX_PATH];
@@ -433,10 +435,10 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam proto->setByte("SlowSend", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SLOWSEND ));
if (proto->getByte("SlowSend", FALSE))
{
- if (DBGetContactSettingDword(NULL, "SRMsg", "MessageTimeout", 60000) < 60000 ||
- DBGetContactSettingDword(NULL, "SRMM", "MessageTimeout", 60000) < 60000)
+ if (DBGetContactSettingDword(NULL, "SRMsg", "MessageTimeout", 60000) < 60000 ||
+ DBGetContactSettingDword(NULL, "SRMM", "MessageTimeout", 60000) < 60000)
{
- MessageBox(NULL, TranslateT("MSN Protocol requires message timeout to be not less then 60 sec. Correct the timeout value."),
+ MessageBox(NULL, TranslateT("MSN Protocol requires message timeout to be not less then 60 sec. Correct the timeout value."),
TranslateT("MSN Protocol"), MB_OK|MB_ICONINFORMATION);
}
}
@@ -460,12 +462,12 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam }
if (reconnectRequired && proto->msnLoggedIn)
- MessageBox(hwndDlg, TranslateT("The changes you have made require you to reconnect to the MSN Messenger network before they take effect"),
+ MessageBox(hwndDlg, TranslateT("The changes you have made require you to reconnect to the MSN Messenger network before they take effect"),
TranslateT("MSN Options"), MB_OK);
proto->LoadOptions();
return TRUE;
- }
+ }
}
return FALSE;
@@ -478,9 +480,9 @@ static INT_PTR CALLBACK DlgProcHotmailPopUpOpts(HWND hwndDlg, UINT msg, WPARAM w {
static bool bEnabled;
- switch(msg)
+ switch(msg)
{
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
bEnabled = false;
@@ -502,11 +504,11 @@ static INT_PTR CALLBACK DlgProcHotmailPopUpOpts(HWND hwndDlg, UINT msg, WPARAM w return TRUE;
}
case WM_COMMAND:
- switch (LOWORD(wParam))
+ switch (LOWORD(wParam))
{
case IDC_DISABLEHOTMAILPOPUP:
- case IDC_DISABLEHOTMAILTRAY:
- case IDC_DISABLEHOTMAILCL:
+ case IDC_DISABLEHOTMAILTRAY:
+ case IDC_DISABLEHOTMAILCL:
case IDC_DISABLEHOTJUNK:
case IDC_NOTIFY_ENDSESSION:
case IDC_NOTIFY_FIRSTMSG:
@@ -518,19 +520,19 @@ static INT_PTR CALLBACK DlgProcHotmailPopUpOpts(HWND hwndDlg, UINT msg, WPARAM w break;
case WM_NOTIFY: //Here we have pressed either the OK or the APPLY button.
- switch(((LPNMHDR)lParam)->idFrom)
+ switch(((LPNMHDR)lParam)->idFrom)
{
case 0:
- switch (((LPNMHDR)lParam)->code)
+ switch (((LPNMHDR)lParam)->code)
{
- case PSN_RESET:
+ case PSN_RESET:
{
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
proto->LoadOptions();
return TRUE;
}
- case PSN_APPLY:
+ case PSN_APPLY:
{
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -559,9 +561,9 @@ static INT_PTR CALLBACK DlgProcHotmailPopUpOpts(HWND hwndDlg, UINT msg, WPARAM w static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
+ switch(msg)
{
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
@@ -571,7 +573,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L SetDlgItemTextA(hwndDlg, IDC_HANDLE, proto->MyOptions.szEmail);
char tBuffer[MAX_PATH];
- if (!proto->getStaticString(NULL, "Password", tBuffer, sizeof(tBuffer)))
+ if (!proto->getStaticString(NULL, "Password", tBuffer, sizeof(tBuffer)))
{
CallService(MS_DB_CRYPT_DECODESTRING, strlen(tBuffer)+1, (LPARAM)tBuffer);
tBuffer[16] = 0;
@@ -589,15 +591,15 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L }
case WM_COMMAND:
- if (LOWORD(wParam) == IDC_NEWMSNACCOUNTLINK)
+ if (LOWORD(wParam) == IDC_NEWMSNACCOUNTLINK)
{
CallService(MS_UTILS_OPENURL, 1, (LPARAM)"https://signup.live.com");
return TRUE;
}
- if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
+ if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
{
- switch(LOWORD(wParam))
+ switch(LOWORD(wParam))
{
case IDC_HANDLE: case IDC_PASSWORD:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -606,7 +608,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case WM_NOTIFY:
- if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
+ if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
{
char password[100], szEmail[MSN_MAX_EMAIL_LEN];
DBVARIANT dbv;
@@ -628,7 +630,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L proto->setString("Password", password);
MSN_FreeVariant(&dbv);
}
- else
+ else
proto->setString("Password", password);
TCHAR szPlace[64];
@@ -648,9 +650,9 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
+ switch(msg)
{
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
return TRUE;
@@ -660,7 +662,7 @@ INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case WM_COMMAND:
- if (LOWORD(wParam) == IDOK)
+ if (LOWORD(wParam) == IDOK)
{
int isBlock = IsDlgButtonChecked(hwndDlg, IDC_REMOVEBLOCK);
int isHot = IsDlgButtonChecked(hwndDlg, IDC_REMOVEHOT);
@@ -668,11 +670,11 @@ INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA DeleteParam *param = (DeleteParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
char szEmail[MSN_MAX_EMAIL_LEN];
- if (!param->proto->getStaticString(param->hContact, "e-mail", szEmail, sizeof(szEmail)))
+ if (!param->proto->getStaticString(param->hContact, "e-mail", szEmail, sizeof(szEmail)))
{
param->proto->MSN_AddUser(param->hContact, szEmail, 0, LIST_FL | (isHot ? LIST_REMOVE : LIST_REMOVENH));
- if (isBlock)
+ if (isBlock)
{
param->proto->MSN_AddUser(param->hContact, szEmail, 0, LIST_AL | LIST_REMOVE);
param->proto->MSN_AddUser(param->hContact, szEmail, 0, LIST_BL);
@@ -723,7 +725,7 @@ int CMsnProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) INT_PTR CMsnProto::SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam (hInst, MAKEINTRESOURCE(IDD_ACCMGRUI),
+ return (INT_PTR)CreateDialogParam (hInst, MAKEINTRESOURCE(IDD_ACCMGRUI),
(HWND)lParam, DlgProcAccMgrUI, (LPARAM)this);
}
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index 3a7a6c4429..46a24488a7 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -34,7 +36,7 @@ static const char sttP2PheaderV2[] = const char sttVoidUid[] = "{00000000-0000-0000-0000-000000000000}";
static const char szUbnCall[] = "{F13B5C79-0126-458F-A29D-747C79C56530}";
-static const char p2pV2Caps[] = { 0x01, 0x0C, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x0F, 0x01, 0x00, 0x00 };
+static const char p2pV2Caps[] = { 0x01, 0x0C, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x0F, 0x01, 0x00, 0x00 };
void P2P_Header::logHeader(CMsnProto *ppro)
{
@@ -87,7 +89,7 @@ bool CMsnProto::p2p_createListener(filetransfer* ft, directconnection *dc, MimeH nlb.pfnNewConnectionV2 = MSN_ConnectionProc;
nlb.pExtra = this;
HANDLE sb = (HANDLE) CallService(MS_NETLIB_BINDPORT, (WPARAM) hNetlibUser, (LPARAM)&nlb);
- if (sb == NULL)
+ if (sb == NULL)
{
MSN_DebugLog("Unable to bind the port for incoming transfers");
return false;
@@ -105,7 +107,7 @@ bool CMsnProto::p2p_createListener(filetransfer* ft, directconnection *dc, MimeH char szIpv4[256] = "";
char szIpv6[256] = "";
- const char *szExtIp = MyConnection.GetMyExtIPStr();
+ const char *szExtIp = MyConnection.GetMyExtIPStr();
bool ipInt = false;
int i4 = 0, i6 = 0;
@@ -165,7 +167,7 @@ bool p2p_IsDlFileOk(filetransfer* ft) bool res = false;
int fileId = _topen(ft->std.tszCurrentFile, O_RDONLY | _O_BINARY, _S_IREAD);
- if (fileId != -1)
+ if (fileId != -1)
{
BYTE buf[4096];
int bytes;
@@ -217,7 +219,7 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft) if (p2p_IsDlFileOk(ft))
{
int fileId = _topen(ft->std.tszCurrentFile, O_RDONLY | _O_BINARY, _S_IREAD);
- if (fileId == -1)
+ if (fileId == -1)
{
p2p_pictureTransferFailed(ft);
return;
@@ -313,11 +315,11 @@ void CMsnProto::p2p_sendMsg(ThreadData* info, const char *wlid, unsigned appId, unsigned fportion = msgType == 1 ? 1352 : 1202;
if (hdrdata.isV2Hdr()) fportion += 4;
- char* buf = (char*) alloca(sizeof(sttP2PheaderV2)+ MSN_MAX_EMAIL_LEN +
+ char* buf = (char*) alloca(sizeof(sttP2PheaderV2)+ MSN_MAX_EMAIL_LEN +
120 + fportion);
size_t offset = 0;
- do
+ do
{
size_t portion = msgsz - offset;
if (portion > fportion) portion = fportion;
@@ -325,13 +327,13 @@ void CMsnProto::p2p_sendMsg(ThreadData* info, const char *wlid, unsigned appId, char* p = buf;
// add message header
- p += msgType == 1 ? sizeof(unsigned) :
+ p += msgType == 1 ? sizeof(unsigned) :
sprintf(p, hdrdata.isV2Hdr() ? sttP2PheaderV2 : sttP2Pheader, wlid, MyOptions.szEmail, MyOptions.szMachineGuidP2P);
if (hdrdata.isV2Hdr())
{
- P2PV2_Header *ph = (P2PV2_Header*)&hdrdata;
- if (offset == 0)
+ P2PV2_Header *ph = (P2PV2_Header*)&hdrdata;
+ if (offset == 0)
{
if (!info || !info->mBridgeInit)
{
@@ -349,7 +351,7 @@ void CMsnProto::p2p_sendMsg(ThreadData* info, const char *wlid, unsigned appId, }
}
}
- else
+ else
{
ph->mOpCode = 0;
ph->mCap = NULL;
@@ -360,7 +362,7 @@ void CMsnProto::p2p_sendMsg(ThreadData* info, const char *wlid, unsigned appId, {
if (hdrdata.isV2Hdr())
{
- P2PV2_Header *ph = (P2PV2_Header*)&hdrdata;
+ P2PV2_Header *ph = (P2PV2_Header*)&hdrdata;
ph->mPacketLen = (unsigned)portion;
ph->mRemSize = msgsz - offset - portion;
ph->mTFCode = offset ? ph->mTFCode & 0xfe : ph->mTFCode | 0x01;
@@ -370,7 +372,7 @@ void CMsnProto::p2p_sendMsg(ThreadData* info, const char *wlid, unsigned appId, }
else
{
- P2P_Header *ph = (P2P_Header*)&hdrdata;
+ P2P_Header *ph = (P2P_Header*)&hdrdata;
ph->mPacketLen = (unsigned)portion;
ph->mOffset = offset;
ph->mTotalSize = msgsz;
@@ -386,20 +388,20 @@ void CMsnProto::p2p_sendMsg(ThreadData* info, const char *wlid, unsigned appId, // add message footer
if (msgType != 1)
- {
+ {
*(unsigned*)p = _htonl(appId);
p += 4;
}
char* szEmail;
- switch (msgType)
+ switch (msgType)
{
case 0:
parseWLID(NEWSTR_ALLOCA(wlid), NULL, &szEmail, NULL);
MsgQueue_Add(szEmail, 'D', buf, p - buf);
break;
- case 1:
+ case 1:
*(unsigned*)buf = (unsigned)(p - buf - sizeof(unsigned));
info->send(buf, p - buf);
break;
@@ -409,13 +411,13 @@ void CMsnProto::p2p_sendMsg(ThreadData* info, const char *wlid, unsigned appId, break;
}
offset += portion;
- }
+ }
while (offset < msgsz);
}
void CMsnProto::p2p_sendAck(const char *wlid, P2PB_Header* hdr)
-{
+{
if (hdr == NULL) return;
if (!hdr->isV2Hdr())
@@ -448,7 +450,7 @@ void CMsnProto::p2p_sendAck(const char *wlid, P2PB_Header* hdr) void CMsnProto::p2p_sendAbortSession(filetransfer* ft)
{
- if (ft == NULL)
+ if (ft == NULL)
{
MSN_DebugLog(sttVoidSession);
return;
@@ -462,12 +464,12 @@ void CMsnProto::p2p_sendAbortSession(filetransfer* ft) tHdr.mAckSessionID = ft->p2p_sendmsgid;
tHdr.mID = p2p_getMsgId(ft->p2p_dest, 1);
- if (ft->std.flags & PFTS_SENDING)
+ if (ft->std.flags & PFTS_SENDING)
{
tHdr.mFlags = 0x40;
tHdr.mAckSessionID = tHdr.mID - 2;
}
- else
+ else
{
tHdr.mAckUniqueID = 0x8200000f;
tHdr.mFlags = 0x80;
@@ -480,7 +482,7 @@ void CMsnProto::p2p_sendAbortSession(filetransfer* ft) void CMsnProto::p2p_sendRedirect(filetransfer* ft)
{
- if (ft == NULL)
+ if (ft == NULL)
{
MSN_DebugLog(sttVoidSession);
return;
@@ -508,7 +510,7 @@ void CMsnProto::p2p_sendRedirect(filetransfer* ft) void CMsnProto::p2p_sendSlp(int iKind, filetransfer *ft, MimeHeaders &pHeaders,
MimeHeaders &pContent, const char *wlid)
{
- if (ft == NULL)
+ if (ft == NULL)
{
MSN_DebugLog(sttVoidSession);
return;
@@ -522,7 +524,7 @@ void CMsnProto::p2p_sendSlp(int iKind, filetransfer *ft, MimeHeaders &pHeaders, char* buf = (char*)alloca(pHeaders.getLength() + cbContLen + 512);
char* p = buf;
- switch (iKind)
+ switch (iKind)
{
case -3: p += sprintf(p, "ACK MSNMSGR:%s MSNSLP/1.0", wlid); break;
case -2: p += sprintf(p, "INVITE MSNMSGR:%s MSNSLP/1.0", wlid); break;
@@ -535,7 +537,7 @@ void CMsnProto::p2p_sendSlp(int iKind, filetransfer *ft, MimeHeaders &pHeaders, default: return;
}
- if (iKind < 0)
+ if (iKind < 0)
{
mir_free(ft->p2p_branch);
ft->p2p_branch = getNewUuid();
@@ -546,7 +548,7 @@ void CMsnProto::p2p_sendSlp(int iKind, filetransfer *ft, MimeHeaders &pHeaders, p += sprintf(p,
"\r\nTo: <msnmsgr:%s>\r\n"
"From: <msnmsgr:%s;%s>\r\n"
- "Via: MSNSLP/1.0/TLP ;branch=%s\r\n",
+ "Via: MSNSLP/1.0/TLP ;branch=%s\r\n",
wlid, MyOptions.szEmail, MyOptions.szMachineGuidP2P, ft->p2p_branch);
}
else
@@ -554,7 +556,7 @@ void CMsnProto::p2p_sendSlp(int iKind, filetransfer *ft, MimeHeaders &pHeaders, p += sprintf(p,
"\r\nTo: <msnmsgr:%s>\r\n"
"From: <msnmsgr:%s>\r\n"
- "Via: MSNSLP/1.0/TLP ;branch=%s\r\n",
+ "Via: MSNSLP/1.0/TLP ;branch=%s\r\n",
wlid, MyOptions.szEmail, ft->p2p_branch);
}
@@ -562,9 +564,9 @@ void CMsnProto::p2p_sendSlp(int iKind, filetransfer *ft, MimeHeaders &pHeaders, p = pContent.writeToBuffer(p);
unsigned short status = getWord(ft->std.hContact, "Status", ID_STATUS_OFFLINE);
- if (!(myFlags & cap_SupportsP2PBootstrap) || ft->p2p_sessionid ||
+ if (!(myFlags & cap_SupportsP2PBootstrap) || ft->p2p_sessionid ||
MSN_GetThreadByContact(wlid, SERVER_P2P_DIRECT) ||
- status == ID_STATUS_OFFLINE || status == ID_STATUS_INVISIBLE ||
+ status == ID_STATUS_OFFLINE || status == ID_STATUS_INVISIBLE ||
m_iStatus == ID_STATUS_INVISIBLE)
{
if (!ft->p2p_isV2)
@@ -575,10 +577,10 @@ void CMsnProto::p2p_sendSlp(int iKind, filetransfer *ft, MimeHeaders &pHeaders, p2p_sendMsg(wlid, 0, tHdr, buf, p - buf + 1);
ft->p2p_waitack = true;
- switch (iKind)
+ switch (iKind)
{
- case -1: case 500: case 603:
- ft->p2p_byemsgid = tHdr.mID;
+ case -1: case 500: case 603:
+ ft->p2p_byemsgid = tHdr.mID;
break;
}
@@ -602,7 +604,7 @@ void CMsnProto::p2p_sendSlp(int iKind, filetransfer *ft, MimeHeaders &pHeaders, void CMsnProto::p2p_sendBye(filetransfer* ft)
{
- if (ft == NULL)
+ if (ft == NULL)
{
MSN_DebugLog(sttVoidSession);
return;
@@ -629,7 +631,7 @@ void CMsnProto::p2p_sendCancel(filetransfer* ft) void CMsnProto::p2p_sendNoCall(filetransfer* ft)
{
- if (ft == NULL)
+ if (ft == NULL)
{
MSN_DebugLog(sttVoidSession);
return;
@@ -653,7 +655,7 @@ void CMsnProto::p2p_sendNoCall(filetransfer* ft) void CMsnProto::p2p_sendStatus(filetransfer* ft, long lStatus)
{
- if (ft == NULL)
+ if (ft == NULL)
{
MSN_DebugLog(sttVoidSession);
return;
@@ -723,7 +725,7 @@ bool CMsnProto::p2p_connectTo(ThreadData* info, directconnection *dc) tConn.timeout = 5;
char* tPortDelim = strrchr(info->mServer, ':');
- if (tPortDelim != NULL)
+ if (tPortDelim != NULL)
{
*tPortDelim = '\0';
tConn.wPort = (WORD)atol(tPortDelim + 1);
@@ -762,7 +764,7 @@ bool CMsnProto::p2p_connectTo(ThreadData* info, directconnection *dc) long cbPacketLen;
HReadBuffer buf(info, 0);
BYTE* p;
- if ((p = buf.surelyRead(4)) == NULL)
+ if ((p = buf.surelyRead(4)) == NULL)
{
MSN_DebugLog("Error reading data, closing filetransfer");
return false;
@@ -778,7 +780,7 @@ bool CMsnProto::p2p_connectTo(ThreadData* info, directconnection *dc) {
P2P_Header cookie((char*)p);
- if (dc->useHashedNonce)
+ if (dc->useHashedNonce)
{
char* hnonce = dc->calcHashedNonce((UUID*)&cookie.mAckSessionID);
cookieMatch = strcmp(hnonce, dc->xNonce) == 0;
@@ -794,7 +796,7 @@ bool CMsnProto::p2p_connectTo(ThreadData* info, directconnection *dc) mir_free(hnonce);
}
- if (!cookieMatch)
+ if (!cookieMatch)
{
MSN_DebugLog("Invalid cookie received, exiting");
return false;
@@ -808,7 +810,7 @@ bool CMsnProto::p2p_connectTo(ThreadData* info, directconnection *dc) bool CMsnProto::p2p_listen(ThreadData* info, directconnection *dc)
{
- switch(WaitForSingleObject(info->hWaitEvent, 10000))
+ switch(WaitForSingleObject(info->hWaitEvent, 10000))
{
case WAIT_TIMEOUT:
case WAIT_FAILED:
@@ -825,13 +827,13 @@ LBL_Error: if ((p = buf.surelyRead(8)) == NULL)
goto LBL_Error;
- if (memcmp(p, p2p_greeting, 8) != 0)
+ if (memcmp(p, p2p_greeting, 8) != 0)
{
MSN_DebugLog("Invalid input data, exiting");
return false;
}
- if ((p = buf.surelyRead(4)) == NULL)
+ if ((p = buf.surelyRead(4)) == NULL)
{
MSN_DebugLog("Error reading data, closing filetransfer");
return false;
@@ -848,7 +850,7 @@ LBL_Error: {
P2P_Header cookie((char*)p);
- if (dc->useHashedNonce)
+ if (dc->useHashedNonce)
{
char* hnonce = dc->calcHashedNonce((UUID*)&cookie.mAckSessionID);
cookieMatch = strcmp(hnonce, dc->xNonce) == 0;
@@ -858,7 +860,7 @@ LBL_Error: else
cookieMatch = memcmp(&cookie.mAckSessionID, dc->mNonce, sizeof(UUID)) == 0;
- if (!cookieMatch)
+ if (!cookieMatch)
{
MSN_DebugLog("Invalid cookie received, exiting");
return false;
@@ -874,7 +876,7 @@ LBL_Error: cookieMatch = strcmp(hnonce, dc->xNonce) == 0;
mir_free(hnonce);
- if (!cookieMatch)
+ if (!cookieMatch)
{
MSN_DebugLog("Invalid cookie received, exiting");
goto LBL_Error;
@@ -953,7 +955,7 @@ LONG CMsnProto::p2p_sendPortion(filetransfer* ft, ThreadData* T, bool isV2) trid = T->sendRawMessage('D', (char *)databuf, p - databuf);
}
- if (trid != 0)
+ if (trid != 0)
{
ft->std.totalProgress += portion;
ft->std.currentFileProgress += portion;
@@ -985,7 +987,7 @@ void __cdecl CMsnProto::p2p_sendFeedThread(void* arg) MSN_DebugLog("File send thread started");
- switch(WaitForSingleObject(info->hWaitEvent, 6000))
+ switch(WaitForSingleObject(info->hWaitEvent, 6000))
{
case WAIT_FAILED:
MSN_DebugLog("File send wait failed");
@@ -996,7 +998,7 @@ void __cdecl CMsnProto::p2p_sendFeedThread(void* arg) ThreadData* T = NULL;
TInfoType lastType = SERVER_NOTIFICATION;
- filetransfer *ft = p2p_getSessionByCallID(info->mCookie,
+ filetransfer *ft = p2p_getSessionByCallID(info->mCookie,
info->mJoinedIdentContactsWLID.getCount() ? info->mJoinedIdentContactsWLID[0] : info->mJoinedContactsWLID[0]);
if (ft != NULL && WaitForSingleObject(ft->hLockHandle, 2000) == WAIT_OBJECT_0)
@@ -1030,9 +1032,9 @@ void __cdecl CMsnProto::p2p_sendFeedThread(void* arg) if (ft->bCanceled) break;
bool cfault = (T == NULL || p2p_sendPortion(ft, T, isV2) == 0);
- if (cfault)
+ if (cfault)
{
- if (fault)
+ if (fault)
{
MSN_DebugLog("File send failed");
break;
@@ -1075,7 +1077,7 @@ void CMsnProto::p2p_sendFeedStart(filetransfer* ft) strcpy(newThread->mCookie, ft->p2p_callID);
newThread->mInitialContactWLID = mir_strdup(ft->p2p_dest);
newThread->startThread(&CMsnProto::p2p_sendFeedThread, this);
- }
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1098,7 +1100,7 @@ void CMsnProto::p2p_sendRecvFileDirectly(ThreadData* info) bool isV2 = strchr(wlid, ';') != NULL;
- for (;;)
+ for (;;)
{
long len = state ? cbPacketLen : 4;
@@ -1176,7 +1178,7 @@ void __cdecl CMsnProto::p2p_filePassiveThread(void* arg) void CMsnProto::p2p_InitFileTransfer(
ThreadData* info,
MimeHeaders& tFileInfo,
- MimeHeaders& tFileInfo2,
+ MimeHeaders& tFileInfo2,
const char* wlid)
{
if (info->mJoinedContactsWLID.getCount() == 0 && info->mJoinedIdentContactsWLID.getCount() == 0)
@@ -1200,7 +1202,7 @@ void CMsnProto::p2p_InitFileTransfer( *szContext = tFileInfo2["Context"],
*szAppId = tFileInfo2["AppID"];
- if (szSessionID == NULL || szAppId == NULL || szEufGuid == NULL)
+ if (szSessionID == NULL || szAppId == NULL || szEufGuid == NULL)
{
MSN_DebugLog("Ignoring invalid invitation: SessionID='%s', AppID=%s, Branch='%s',Context='%s'",
szSessionID, szAppId, szEufGuid, szContext);
@@ -1236,7 +1238,7 @@ void CMsnProto::p2p_InitFileTransfer( if (!_stricmp(szEufGuid, "{A4268EEC-FEC5-49E5-95C3-F126696BDBF6}")) {
DBVARIANT dbv;
bool pictmatch = !getString("PictObject", &dbv);
- if (pictmatch)
+ if (pictmatch)
{
UrlDecode(dbv.pszVal);
@@ -1260,12 +1262,12 @@ void CMsnProto::p2p_InitFileTransfer( ezxml_free(xmldb);
MSN_FreeVariant(&dbv);
}
- if (pictmatch)
+ if (pictmatch)
{
TCHAR szFileName[MAX_PATH];
MSN_GetAvatarFileName(NULL, szFileName, SIZEOF(szFileName), NULL);
ft->fileId = _topen(szFileName, O_RDONLY | _O_BINARY, _S_IREAD);
- if (ft->fileId == -1)
+ if (ft->fileId == -1)
{
p2p_sendStatus(ft, 603);
MSN_ShowError("Your avatar not set correctly. Avatar should be set in View/Change My Details | Avatar");
@@ -1301,17 +1303,17 @@ void CMsnProto::p2p_InitFileTransfer( break;
case MSN_APPID_FILE:
- if (!_stricmp(szEufGuid, "{5D3E02AB-6190-11D3-BBBB-00C04F795683}"))
+ if (!_stricmp(szEufGuid, "{5D3E02AB-6190-11D3-BBBB-00C04F795683}"))
{
wchar_t* wszFileName = ((HFileContext*)szContext)->wszFileName;
for (wchar_t* p = wszFileName; *p != 0; p++)
- {
- switch(*p)
+ {
+ switch(*p)
{
case ':': case '?': case '/': case '\\': case '*':
*p = '_';
- }
- }
+ }
+ }
mir_free(ft->std.tszCurrentFile);
ft->std.tszCurrentFile = mir_u2t(wszFileName);
@@ -1336,12 +1338,12 @@ void CMsnProto::p2p_InitFileTransfer( case MSN_APPID_WEBCAM:
if (!_stricmp(szEufGuid, "{4BD96FC0-AB17-4425-A14A-439185962DC8}")) {
MSN_ShowPopup(ft->std.hContact,
- TranslateT("Contact tried to send its webcam data (currently not supported)"),
+ TranslateT("Contact tried to send its webcam data (currently not supported)"),
MSN_ALLOW_MSGBOX | MSN_SHOW_ERROR);
}
if (!_stricmp(szEufGuid, "{1C9AA97E-9C05-4583-A3BD-908A196F1E92}")) {
MSN_ShowPopup(ft->std.hContact,
- TranslateT("Contact tried to view our webcam data (currently not supported)"),
+ TranslateT("Contact tried to view our webcam data (currently not supported)"),
MSN_ALLOW_MSGBOX | MSN_SHOW_ERROR);
}
p2p_sendStatus(ft, 603);
@@ -1350,7 +1352,7 @@ void CMsnProto::p2p_InitFileTransfer( case MSN_APPID_MEDIA_SHARING:
// MSN_ShowPopup(ft->std.hContact,
-// TranslateT("Contact tried to share media with us (currently not supported)"),
+// TranslateT("Contact tried to share media with us (currently not supported)"),
// MSN_ALLOW_MSGBOX | MSN_SHOW_ERROR);
p2p_sendStatus(ft, 603);
p2p_unregisterSession(ft);
@@ -1376,19 +1378,19 @@ void CMsnProto::p2p_InitDirectTransfer(MimeHeaders& tFileInfo, MimeHeaders& tFil *szICF = tFileInfo2["ICF"],
*szHashedNonce = tFileInfo2["Hashed-Nonce"];
- if (szBranch != NULL)
+ if (szBranch != NULL)
{
szBranch = strstr(szBranch, "branch=");
if (szBranch != NULL)
szBranch += 7;
}
- if (szCallID == NULL || szBranch == NULL)
+ if (szCallID == NULL || szBranch == NULL)
{
MSN_DebugLog("Ignoring invalid invitation: CallID='%s', Branch='%s'", szCallID, szBranch);
return;
}
- if (szConnType == NULL || szUPnPNat == NULL || szICF == NULL || szNetID == NULL)
+ if (szConnType == NULL || szUPnPNat == NULL || szICF == NULL || szNetID == NULL)
{
MSN_DebugLog("Ignoring invalid invitation: ConnType='%s', UPnPNat='%s', ICF='%s', NetID='%s'",
szConnType, szUPnPNat, szICF, szNetID);
@@ -1411,7 +1413,7 @@ void CMsnProto::p2p_InitDirectTransfer(MimeHeaders& tFileInfo, MimeHeaders& tFil replaceStr(ft->p2p_branch, szBranch);
ft->p2p_acksessid = MSN_GenRandom();
/*
- if (p2p_isAvatarOnly(ft->std.hContact))
+ if (p2p_isAvatarOnly(ft->std.hContact))
{
p2p_sendStatus(ft, 1603);
return;
@@ -1459,7 +1461,7 @@ void CMsnProto::p2p_InitDirectTransfer(MimeHeaders& tFileInfo, MimeHeaders& tFil if (conType.weight <= MyConnection.weight)
listen = p2p_createListener(ft, dc, chdrs);
- if (!listen)
+ if (!listen)
{
chdrs.addString("Bridge", "TCPv1");
chdrs.addBool("Listening", false);
@@ -1486,13 +1488,13 @@ void CMsnProto::p2p_startConnect(const char* wlid, const char* szCallID, const c if (port == NULL) return;
char *pPortTokBeg = (char*)port;
- for (;;)
+ for (;;)
{
char *pPortTokEnd = strchr(pPortTokBeg, ' ');
if (pPortTokEnd != NULL) *pPortTokEnd = 0;
char *pAddrTokBeg = (char*)addr;
- for (;;)
+ for (;;)
{
char *pAddrTokEnd = strchr(pAddrTokBeg, ' ');
if (pAddrTokEnd != NULL) *pAddrTokEnd = 0;
@@ -1533,14 +1535,14 @@ void CMsnProto::p2p_InitDirectTransfer2(MimeHeaders& tFileInfo, MimeHeaders& tFi *szV6Address = tFileInfo2["IPv6-Addrs"],
*szV6Port = tFileInfo2["IPv6-Port" ];
- if ((szNonce == NULL && szHashedNonce == NULL) || szListening == NULL)
+ if ((szNonce == NULL && szHashedNonce == NULL) || szListening == NULL)
{
MSN_DebugLog("Ignoring invalid invitation: Listening='%s', Nonce=%s", szListening, szNonce);
return;
}
directconnection* dc = p2p_getDCByCallID(szCallID, wlid);
- if (dc == NULL)
+ if (dc == NULL)
{
dc = new directconnection(szCallID, wlid);
p2p_registerDC(dc);
@@ -1549,7 +1551,7 @@ void CMsnProto::p2p_InitDirectTransfer2(MimeHeaders& tFileInfo, MimeHeaders& tFi dc->useHashedNonce = szHashedNonce != NULL;
replaceStr(dc->xNonce, szHashedNonce ? szHashedNonce : szNonce);
- if (!strcmp(szListening, "true") && strcmp(dc->xNonce, sttVoidUid))
+ if (!strcmp(szListening, "true") && strcmp(dc->xNonce, sttVoidUid))
{
p2p_startConnect(wlid, szCallID, szV6Address, szV6Port, true);
p2p_startConnect(wlid, szCallID, szInternalAddress, szInternalPort, false);
@@ -1582,14 +1584,14 @@ void CMsnProto::p2p_AcceptTransfer(MimeHeaders& tFileInfo, MimeHeaders& tFileInf }
else
{
- if (!(ft->std.flags & PFTS_SENDING))
+ if (!(ft->std.flags & PFTS_SENDING))
{
replaceStr(ft->p2p_branch, szBranch);
replaceStr(ft->p2p_callID, szCallID);
}
}
- if (szCallID == NULL || szBranch == NULL || szOldContentType == NULL)
+ if (szCallID == NULL || szBranch == NULL || szOldContentType == NULL)
{
MSN_DebugLog("Ignoring invalid invitation: CallID='%s', szBranch='%s'", szCallID, szBranch);
LBL_Close:
@@ -1604,7 +1606,7 @@ LBL_Close: MimeHeaders chdrs(12);
- if (!strcmp(szOldContentType, "application/x-msnmsgr-sessionreqbody"))
+ if (!strcmp(szOldContentType, "application/x-msnmsgr-sessionreqbody"))
{
if (ft == &ftl)
{
@@ -1622,7 +1624,7 @@ LBL_Close: if (ft->p2p_type != MSN_APPID_FILE)
{
- if (ft->fileId == -1) ft->create();
+ if (ft->fileId == -1) ft->create();
return;
}
@@ -1651,7 +1653,7 @@ LBL_Close: chdrs.addString("IPv6-global", GetGlobalIp(), 2);
chdrs.addString("Hashed-Nonce", dc->mNonceToHash(), 2);
}
- else if (!strcmp(szOldContentType, "application/x-msnmsgr-transrespbody"))
+ else if (!strcmp(szOldContentType, "application/x-msnmsgr-transrespbody"))
{
const char *szListening = tFileInfo2["Listening"],
*szNonce = tFileInfo2["Nonce"],
@@ -1663,7 +1665,7 @@ LBL_Close: *szV6Address = tFileInfo2["IPv6-Addrs"],
*szV6Port = tFileInfo2["IPv6-Port" ];
- if ((szNonce == NULL && szHashedNonce == NULL) || szListening == NULL)
+ if ((szNonce == NULL && szHashedNonce == NULL) || szListening == NULL)
{
MSN_DebugLog("Invalid data packet, exiting...");
goto LBL_Close;
@@ -1681,7 +1683,7 @@ LBL_Close: replaceStr(dc->xNonce, szHashedNonce ? szHashedNonce : szNonce);
// another side reported that it will be a server.
- if (!strcmp(szListening, "true") && (szNonce == NULL || strcmp(szNonce, sttVoidUid)))
+ if (!strcmp(szListening, "true") && (szNonce == NULL || strcmp(szNonce, sttVoidUid)))
{
p2p_startConnect(ft->p2p_dest, szCallID, szV6Address, szV6Port, true);
p2p_startConnect(ft->p2p_dest, szCallID, szInternalAddress, szInternalPort, false);
@@ -1690,7 +1692,7 @@ LBL_Close: }
// no, send a file via server
- if (!p2p_createListener(ft, dc, chdrs))
+ if (!p2p_createListener(ft, dc, chdrs))
{
p2p_unregisterDC(dc);
if (ft != &ftl)
@@ -1702,13 +1704,13 @@ LBL_Close: tResult.addString("Content-Type", "application/x-msnmsgr-transrespbody");
}
- else if (!strcmp(szOldContentType, "application/x-msnmsgr-transreqbody"))
+ else if (!strcmp(szOldContentType, "application/x-msnmsgr-transreqbody"))
{
const char *szHashedNonce = tFileInfo2["Hashed-Nonce"];
const char *szNonce = tFileInfo2["Nonce"];
directconnection* dc = p2p_getDCByCallID(szCallID, wlid);
- if (dc == NULL)
+ if (dc == NULL)
{
dc = new directconnection(szCallID, wlid);
p2p_registerDC(dc);
@@ -1718,7 +1720,7 @@ LBL_Close: replaceStr(dc->xNonce, szHashedNonce ? szHashedNonce : szNonce);
// no, send a file via server
- if (!p2p_createListener(ft, dc, chdrs))
+ if (!p2p_createListener(ft, dc, chdrs))
{
p2p_unregisterDC(dc);
MSN_StartP2PTransferByContact(ft->p2p_dest);
@@ -1727,7 +1729,7 @@ LBL_Close: tResult.addString("Content-Type", "application/x-msnmsgr-transrespbody");
}
- else
+ else
return;
if (!ft->p2p_isV2) p2p_getMsgId(ft->p2p_dest, -1);
@@ -1765,7 +1767,7 @@ void CMsnProto::p2p_processSIP(ThreadData* info, char* msgbody, P2PB_Header* hdr msgbody = tFileInfo2.readFromBuffer(msgbody);
const char* szContentType = tFileInfo["Content-Type"];
- if (szContentType == NULL)
+ if (szContentType == NULL)
{
MSN_DebugLog("Invalid or missing Content-Type field, exiting");
return;
@@ -1777,7 +1779,7 @@ void CMsnProto::p2p_processSIP(ThreadData* info, char* msgbody, P2PB_Header* hdr p2p_getMsgId(wlid, 1);
}
- switch(iMsgType)
+ switch(iMsgType)
{
case 1:
if (!strcmp(szContentType, "application/x-msnmsgr-sessionreqbody"))
@@ -1805,7 +1807,7 @@ void CMsnProto::p2p_processSIP(ThreadData* info, char* msgbody, P2PB_Header* hdr }
else
{
- if (!(ft->std.flags & PFTS_SENDING))
+ if (!(ft->std.flags & PFTS_SENDING))
ft->bCompleted = true;
}
@@ -1932,7 +1934,7 @@ void CMsnProto::p2p_processMsgV2(ThreadData* info, char* msgbody, const char* ft->ts = time(NULL);
- if (hdrdata.mTFCode >= 4 && hdrdata.mTFCode <= 7)
+ if (hdrdata.mTFCode >= 4 && hdrdata.mTFCode <= 7)
{
_write(ft->fileId, msg, hdrdata.mPacketLen);
@@ -1948,25 +1950,25 @@ void CMsnProto::p2p_processMsgV2(ThreadData* info, char* msgbody, const char* MSN_DebugLog("Transferred %I64u bytes remaining %I64u", ft->std.currentFileProgress, hdrdata.mRemSize);
}
- if (hdrdata.mRemSize == 0)
+ if (hdrdata.mRemSize == 0)
{
if (ft->p2p_appID == MSN_APPID_FILE)
{
SendBroadcast(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM)&ft->std);
ft->complete();
}
- else
+ else
{
p2p_savePicture2disk(ft);
if (!ft->p2p_isV2) p2p_sendBye(ft);
}
- }
+ }
}
}
void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wlid)
{
- P2P_Header hdrdata;
+ P2P_Header hdrdata;
msgbody = hdrdata.parseMsg(msgbody);
hdrdata.logHeader(this);
@@ -1981,7 +1983,7 @@ void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wl {
char msgid[128];
mir_snprintf(msgid, sizeof(msgid), "%s_%08x", wlid, hdrdata.mID);
- int idx = addCachedMsg(msgid, msgbody, (size_t)hdrdata.mOffset, hdrdata.mPacketLen,
+ int idx = addCachedMsg(msgid, msgbody, (size_t)hdrdata.mOffset, hdrdata.mPacketLen,
(size_t)hdrdata.mTotalSize, false);
char* newbody;
@@ -2016,9 +2018,9 @@ void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wl ft->ts = time(NULL);
//---- receiving redirect -----------
- if (hdrdata.mFlags == 0x01)
+ if (hdrdata.mFlags == 0x01)
{
- if (WaitForSingleObject(ft->hLockHandle, INFINITE) == WAIT_OBJECT_0)
+ if (WaitForSingleObject(ft->hLockHandle, INFINITE) == WAIT_OBJECT_0)
{
__int64 dp = (__int64)(ft->std.currentFileProgress - hdrdata.mAckDataSize);
ft->std.totalProgress -= dp ;
@@ -2026,17 +2028,17 @@ void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wl _lseeki64(ft->fileId, ft->std.currentFileProgress, SEEK_SET);
ft->tType = info->mType;
ReleaseMutex(ft->hLockHandle);
- }
+ }
}
//---- receiving ack -----------
- if (hdrdata.mFlags == 0x02)
+ if (hdrdata.mFlags == 0x02)
{
ft->p2p_waitack = false;
- if (hdrdata.mAckSessionID == ft->p2p_sendmsgid)
+ if (hdrdata.mAckSessionID == ft->p2p_sendmsgid)
{
- if (ft->p2p_appID == MSN_APPID_FILE)
+ if (ft->p2p_appID == MSN_APPID_FILE)
{
ft->bCompleted = true;
p2p_sendBye(ft);
@@ -2050,7 +2052,7 @@ void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wl return;
}
- switch(ft->p2p_ackID)
+ switch(ft->p2p_ackID)
{
case 1000:
//---- send Data Preparation Message
@@ -2067,11 +2069,11 @@ void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wl return;
}
- if (LOWORD(hdrdata.mFlags) == 0)
+ if (LOWORD(hdrdata.mFlags) == 0)
{
//---- accept the data preparation message ------
// const unsigned* pLongs = (unsigned*)msgbody;
- if (hdrdata.mPacketLen == 4 && hdrdata.mTotalSize == 4)
+ if (hdrdata.mPacketLen == 4 && hdrdata.mTotalSize == 4)
{
p2p_sendAck(ft->p2p_dest, &hdrdata);
return;
@@ -2081,12 +2083,12 @@ void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wl }
//---- receiving data -----------
- if (LOWORD(hdrdata.mFlags) == 0x20 || LOWORD(hdrdata.mFlags) == 0x30)
+ if (LOWORD(hdrdata.mFlags) == 0x20 || LOWORD(hdrdata.mFlags) == 0x30)
{
if (hdrdata.mOffset + hdrdata.mPacketLen > hdrdata.mTotalSize)
hdrdata.mPacketLen = DWORD(hdrdata.mTotalSize - hdrdata.mOffset);
- if (ft->tTypeReq == 0 || ft->tTypeReq == info->mType)
+ if (ft->tTypeReq == 0 || ft->tTypeReq == info->mType)
{
ft->tType = info->mType;
ft->p2p_sendmsgid = hdrdata.mID;
@@ -2095,9 +2097,9 @@ void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wl __int64 dsz = ft->std.currentFileSize - hdrdata.mOffset;
if (dsz > hdrdata.mPacketLen) dsz = hdrdata.mPacketLen;
- if (ft->tType == info->mType)
+ if (ft->tType == info->mType)
{
- if (dsz > 0 && ft->fileId >= 0)
+ if (dsz > 0 && ft->fileId >= 0)
{
if (ft->lstFilePtr != hdrdata.mOffset)
_lseeki64(ft->fileId, hdrdata.mOffset, SEEK_SET);
@@ -2106,7 +2108,7 @@ void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wl ft->lstFilePtr = hdrdata.mOffset + dsz;
__int64 dp = ft->lstFilePtr - ft->std.currentFileProgress;
- if (dp > 0)
+ if (dp > 0)
{
ft->std.totalProgress += dp;
ft->std.currentFileProgress += dp;
@@ -2122,7 +2124,7 @@ void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wl MSN_DebugLog("Transferred %I64u bytes out of %I64u", ft->std.currentFileProgress, hdrdata.mTotalSize);
}
- if (ft->std.currentFileProgress >= hdrdata.mTotalSize)
+ if (ft->std.currentFileProgress >= hdrdata.mTotalSize)
{
SendBroadcast(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM)&ft->std);
p2p_sendAck(ft->p2p_dest, &hdrdata);
@@ -2132,16 +2134,16 @@ void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wl ft->p2p_waitack = true;
ft->complete();
}
- else
+ else
{
p2p_savePicture2disk(ft);
p2p_sendBye(ft);
}
- }
- }
+ }
+ }
}
- if (hdrdata.mFlags == 0x40 || hdrdata.mFlags == 0x80)
+ if (hdrdata.mFlags == 0x40 || hdrdata.mFlags == 0x80)
{
p2p_sendAbortSession(ft);
p2p_unregisterSession(ft);
@@ -2154,7 +2156,7 @@ void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wl void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid)
{
const char* szAppID;
- switch(iAppID)
+ switch(iAppID)
{
case MSN_APPID_FILE: szAppID = "{5D3E02AB-6190-11D3-BBBB-00C04F795683}"; break;
case MSN_APPID_AVATAR: szAppID = "{A4268EEC-FEC5-49E5-95C3-F126696BDBF6}"; break;
@@ -2180,7 +2182,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid) char* pContext = NULL;
size_t cbContext = 0;
- switch (iAppID)
+ switch (iAppID)
{
case MSN_APPID_FILE:
{
@@ -2191,11 +2193,11 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid) if (ft->p2p_isV2)
{
cbContext -= 64;
- ctx->ver = 2;
+ ctx->ver = 2;
}
else
{
- ctx->ver = 3;
+ ctx->ver = 3;
ctx->id = 0xffffffff;
}
ctx->len = (unsigned)cbContext;
@@ -2263,12 +2265,12 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid) }
bool sessionExist = p2p_sessionRegistered(ft);
- if (!sessionExist)
+ if (!sessionExist)
{
p2p_registerSession(ft);
unsigned short status = getWord(ft->std.hContact, "Status", ID_STATUS_OFFLINE);
- if ((myFlags & 0x4000000) && cont->places.getCount() <= 1 &&
+ if ((myFlags & 0x4000000) && cont->places.getCount() <= 1 &&
status != ID_STATUS_OFFLINE && status != ID_STATUS_INVISIBLE && m_iStatus != ID_STATUS_INVISIBLE)
{
if (ft->p2p_isV2)
@@ -2276,8 +2278,8 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid) if (cont->places.getCount() && cont->places[0].cap1 & cap_SupportsP2PBootstrap)
{
char wlid[128];
- mir_snprintf(wlid, SIZEOF(wlid),
- strcmp(cont->places[0].id, sttVoidUid) ? "%s;%s" : "%s",
+ mir_snprintf(wlid, SIZEOF(wlid),
+ strcmp(cont->places[0].id, sttVoidUid) ? "%s;%s" : "%s",
cont->email, cont->places[0].id);
if (!MSN_GetThreadByContact(wlid, SERVER_P2P_DIRECT))
@@ -2326,7 +2328,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid) tResult.addLong("Max-Forwards", 0);
tResult.addString("Content-Type", "application/x-msnmsgr-sessionreqbody");
- if (iAppID != MSN_APPID_FILE)
+ if (iAppID != MSN_APPID_FILE)
ft->p2p_waitack = true;
if (ft->p2p_isV2 && ft->std.currentFileNumber == 0)
@@ -2334,8 +2336,8 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid) for (int i = 0; i < cont->places.getCount(); ++i)
{
char wlid[128];
- mir_snprintf(wlid, SIZEOF(wlid),
- strcmp(cont->places[i].id, sttVoidUid) ? "%s;%s" : "%s",
+ mir_snprintf(wlid, SIZEOF(wlid),
+ strcmp(cont->places[i].id, sttVoidUid) ? "%s;%s" : "%s",
cont->email, cont->places[i].id);
p2p_sendSlp(-2, ft, tResult, chdrs, wlid);
@@ -2398,20 +2400,20 @@ void CMsnProto::p2p_sessionComplete(filetransfer* ft) {
if (ft->p2p_appID != MSN_APPID_FILE)
p2p_unregisterSession(ft);
- else if (ft->std.flags & PFTS_SENDING)
+ else if (ft->std.flags & PFTS_SENDING)
{
- if (ft->openNext() == -1)
+ if (ft->openNext() == -1)
{
bool success = ft->std.currentFileNumber >= ft->std.totalFiles && ft->bCompleted;
SendBroadcast(ft->std.hContact, ACKTYPE_FILE, success ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, ft, 0);
}
- else
+ else
{
SendBroadcast(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ft, 0);
p2p_invite(ft->p2p_appID, ft, NULL);
}
}
- else
+ else
{
SendBroadcast(ft->std.hContact, ACKTYPE_FILE, ft->bCompleted ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, ft, 0);
p2p_unregisterSession(ft);
@@ -2469,7 +2471,7 @@ char* P2PV2_Header::createMsg(char *buf, const char* wlid, CMsnProto *ppro) {
unsigned char hdrLen1 = 8 + (mAckUniqueID ? 6 : 0) + (mCap ? 2 + mCap[1] : 0);
unsigned char comp = hdrLen1 & 3;
- hdrLen1 += comp ? 4 - comp : 0;
+ hdrLen1 += comp ? 4 - comp : 0;
unsigned char hdrLen2 = mPacketLen ? (8 + (mRemSize ? 10 : 0)) : 0;
comp = hdrLen2 & 3;
@@ -2520,8 +2522,8 @@ char* P2PV2_Header::createMsg(char *buf, const char* wlid, CMsnProto *ppro) }
char* P2P_Header::createMsg(char *buf, const char* wlid, CMsnProto *ppro)
-{
- if (!mID) mID = ppro->p2p_getMsgId(wlid, 1);
- memcpy(buf, &mSessionID, 48);
- return buf + 48;
+{
+ if (!mID) mID = ppro->p2p_getMsgId(wlid, 1);
+ memcpy(buf, &mSessionID, 48);
+ return buf + 48;
}
diff --git a/protocols/MSN/src/msn_p2ps.cpp b/protocols/MSN/src/msn_p2ps.cpp index 58edbc2d05..4bfb86d1ee 100644 --- a/protocols/MSN/src/msn_p2ps.cpp +++ b/protocols/MSN/src/msn_p2ps.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -38,7 +40,7 @@ void CMsnProto::p2p_unregisterSession(filetransfer* ft) {
EnterCriticalSection(&sessionLock);
// int idx = sessionList.getIndex(ft);
-// if (idx > -1)
+// if (idx > -1)
sessionList.remove(ft);
LeaveCriticalSection(&sessionLock);
}
@@ -54,14 +56,14 @@ filetransfer* CMsnProto::p2p_getSessionByID(unsigned id) filetransfer* ft = NULL;
EnterCriticalSection(&sessionLock);
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
- if (FT->p2p_sessionid == id)
+ if (FT->p2p_sessionid == id)
{
ft = FT;
break;
- }
+ }
}
LeaveCriticalSection(&sessionLock);
@@ -79,14 +81,14 @@ filetransfer* CMsnProto::p2p_getSessionByUniqueID(unsigned id) filetransfer* ft = NULL;
EnterCriticalSection(&sessionLock);
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
- if (FT->p2p_acksessid == id)
+ if (FT->p2p_acksessid == id)
{
ft = FT;
break;
- }
+ }
}
LeaveCriticalSection(&sessionLock);
@@ -113,14 +115,14 @@ filetransfer* CMsnProto::p2p_getThreadSession(HANDLE hContact, TInfoType mType) EnterCriticalSection(&sessionLock);
filetransfer* result = NULL;
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
- if (FT->std.hContact == hContact && FT->tType == mType)
+ if (FT->std.hContact == hContact && FT->tType == mType)
{
result = FT;
break;
- }
+ }
}
LeaveCriticalSection(&sessionLock);
@@ -131,15 +133,15 @@ void CMsnProto::p2p_clearThreadSessions(HANDLE hContact, TInfoType mType) {
EnterCriticalSection(&sessionLock);
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* ft = &sessionList[i];
- if (ft->std.hContact == hContact && ft->tType == mType)
+ if (ft->std.hContact == hContact && ft->tType == mType)
{
ft->bCanceled = true;
ft->tType = SERVER_NOTIFICATION;
p2p_sendCancel(ft);
- }
+ }
}
LeaveCriticalSection(&sessionLock);
@@ -150,13 +152,13 @@ filetransfer* CMsnProto::p2p_getAvatarSession(HANDLE hContact) EnterCriticalSection(&sessionLock);
filetransfer* result = NULL;
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
if (FT->std.hContact == hContact && !(FT->std.flags & PFTS_SENDING) && FT->p2p_type == MSN_APPID_AVATAR) {
result = FT;
break;
- }
+ }
}
LeaveCriticalSection(&sessionLock);
@@ -168,7 +170,7 @@ bool CMsnProto::p2p_isAvatarOnly(HANDLE hContact) EnterCriticalSection(&sessionLock);
bool result = true;
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
result &= FT->std.hContact != hContact || FT->p2p_type != MSN_APPID_FILE;
@@ -183,12 +185,12 @@ void CMsnProto::p2p_clearDormantSessions(void) EnterCriticalSection(&sessionLock);
time_t ts = time(NULL);
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
if (!FT->p2p_sessionid && !MSN_GetUnconnectedThread(FT->p2p_dest, SERVER_P2P_DIRECT))
p2p_invite(FT->p2p_type, FT, NULL);
- else if (FT->p2p_waitack && (ts - FT->ts) > 120)
+ else if (FT->p2p_waitack && (ts - FT->ts) > 120)
{
FT->bCanceled = true;
p2p_sendCancel(FT);
@@ -196,7 +198,7 @@ void CMsnProto::p2p_clearDormantSessions(void) p2p_unregisterSession(FT);
EnterCriticalSection(&sessionLock);
i = 0;
- }
+ }
}
LeaveCriticalSection(&sessionLock);
@@ -207,10 +209,10 @@ void CMsnProto::p2p_redirectSessions(const char *wlid) EnterCriticalSection(&sessionLock);
ThreadData* T = MSN_GetP2PThreadByContact(wlid);
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
- if (_stricmp(FT->p2p_dest, wlid) == 0 &&
+ if (_stricmp(FT->p2p_dest, wlid) == 0 &&
FT->std.currentFileProgress < FT->std.currentFileSize &&
(T == NULL || (FT->tType != T->mType && FT->tType != 0)))
{
@@ -221,7 +223,7 @@ void CMsnProto::p2p_redirectSessions(const char *wlid) }
else
{
- if (!(FT->std.flags & PFTS_SENDING))
+ if (!(FT->std.flags & PFTS_SENDING))
p2p_sendRedirect(FT);
}
}
@@ -237,7 +239,7 @@ void CMsnProto::p2p_startSessions(const char* wlid) char* szEmail;
parseWLID(NEWSTR_ALLOCA(wlid), NULL, &szEmail, NULL);
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
if (!FT->bAccepted && !_stricmp(FT->p2p_dest, szEmail))
@@ -256,7 +258,7 @@ void CMsnProto::p2p_cancelAllSessions(void) {
EnterCriticalSection(&sessionLock);
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
sessionList[i].bCanceled = true;
p2p_sendCancel(&sessionList[i]);
@@ -274,10 +276,10 @@ filetransfer* CMsnProto::p2p_getSessionByCallID(const char* CallID, const char* filetransfer* ft = NULL;
char* szEmail = NULL;
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
- if (FT->p2p_callID && !_stricmp(FT->p2p_callID, CallID))
+ if (FT->p2p_callID && !_stricmp(FT->p2p_callID, CallID))
{
if (_stricmp(FT->p2p_dest, wlid))
{
@@ -288,7 +290,7 @@ filetransfer* CMsnProto::p2p_getSessionByCallID(const char* CallID, const char* }
ft = FT;
break;
- }
+ }
}
LeaveCriticalSection(&sessionLock);
@@ -321,14 +323,14 @@ directconnection* CMsnProto::p2p_getDCByCallID(const char* CallID, const char* EnterCriticalSection(&sessionLock);
directconnection* dc = NULL;
- for (int i=0; i < dcList.getCount(); i++)
+ for (int i=0; i < dcList.getCount(); i++)
{
directconnection* DC = &dcList[i];
- if (DC->callId != NULL && !strcmp(DC->callId, CallID) && !strcmp(DC->wlid, wlid))
+ if (DC->callId != NULL && !strcmp(DC->callId, CallID) && !strcmp(DC->wlid, wlid))
{
dc = DC;
break;
- }
+ }
}
LeaveCriticalSection(&sessionLock);
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index b9f4174a55..bea00b586f 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.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) 2008-2012 Boris Krasnovskiy.
This program is free software; you can redistribute it and/or
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h index 87f343c7a7..2db55f0ee1 100644 --- a/protocols/MSN/src/msn_proto.h +++ b/protocols/MSN/src/msn_proto.h @@ -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) 2009-2012 Boris Krasnovskiy.
This program is free software; you can redistribute it and/or
diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp index b565305199..c3ec9f6020 100644 --- a/protocols/MSN/src/msn_soapab.cpp +++ b/protocols/MSN/src/msn_soapab.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
@@ -19,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "msn_global.h"
#include "msn_proto.h"
-static const char abReqHdr[] =
+static const char abReqHdr[] =
"SOAPAction: http://www.msn.com/webservices/AddressBook/%s\r\n";
@@ -30,7 +32,7 @@ ezxml_t CMsnProto::abSoapHdr(const char* service, const char* scenario, ezxml_t& 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:soapenc", "http://schemas.xmlsoap.org/soap/encoding/");
-
+
ezxml_t hdr = ezxml_add_child(xmlp, "soap:Header", 0);
ezxml_t apphdr = ezxml_add_child(hdr, "ABApplicationHeader", 0);
ezxml_set_attr(apphdr, "xmlns", "http://www.msn.com/webservices/AddressBook");
@@ -56,7 +58,7 @@ ezxml_t CMsnProto::abSoapHdr(const char* service, const char* scenario, ezxml_t& if (authContactToken) ezxml_set_txt(node, authContactToken);
ezxml_t bdy = ezxml_add_child(xmlp, "soap:Body", 0);
-
+
tbdy = ezxml_add_child(bdy, service, 0);
ezxml_set_attr(tbdy, "xmlns", "http://www.msn.com/webservices/AddressBook");
@@ -81,11 +83,11 @@ ezxml_t CMsnProto::getSoapResponse(ezxml_t bdy, const char* service) mir_snprintf(resp1, sizeof(resp1), "%sResponse", service);
mir_snprintf(resp2, sizeof(resp2), "%sResult", service);
- ezxml_t res = ezxml_get(bdy, "soap:Body", 0, resp1, 0, resp2, -1);
+ ezxml_t res = ezxml_get(bdy, "soap:Body", 0, resp1, 0, resp2, -1);
if (res == NULL)
res = ezxml_get(bdy, "s:Body", 0, resp1, 0, resp2, -1);
- return res;
+ return res;
}
ezxml_t CMsnProto::getSoapFault(ezxml_t bdy, bool err)
@@ -97,7 +99,7 @@ ezxml_t CMsnProto::getSoapFault(ezxml_t bdy, bool err) void CMsnProto::UpdateABHost(const char* service, const char* url)
{
char hostname[128];
- mir_snprintf(hostname, sizeof(hostname), "ABHost-%s", service);
+ mir_snprintf(hostname, sizeof(hostname), "ABHost-%s", service);
if (url)
setString(NULL, hostname, url);
@@ -118,12 +120,12 @@ void CMsnProto::UpdateABCacheKey(ezxml_t bdy, bool isSharing) char* CMsnProto::GetABHost(const char* service, bool isSharing)
{
char hostname[128];
- mir_snprintf(hostname, sizeof(hostname), "ABHost-%s", service);
+ mir_snprintf(hostname, sizeof(hostname), "ABHost-%s", service);
char* host = (char*)mir_alloc(256);
if (getStaticString(NULL, hostname, host, 256))
{
- mir_snprintf(host, 256, "https://byrdr.omega.contacts.msn.com/abservice/%s.asmx",
+ mir_snprintf(host, 256, "https://byrdr.omega.contacts.msn.com/abservice/%s.asmx",
isSharing ? "SharingService" : "abservice");
}
@@ -209,7 +211,7 @@ bool CMsnProto::MSN_ABAdd(bool allowRecurse) mir_free(reqHdr);
free(szData);
- if (tResult != NULL)
+ if (tResult != NULL)
{
UpdateABHost("ABAdd", abUrl);
@@ -302,8 +304,8 @@ bool CMsnProto::MSN_SharingFindMembership(bool deltas, bool allowRecurse) {
UpdateABCacheKey(xmlm, true);
ezxml_t body = getSoapResponse(xmlm, "FindMembership");
- ezxml_t svcs = ezxml_get(body, "Services", 0, "Service", -1);
-
+ ezxml_t svcs = ezxml_get(body, "Services", 0, "Service", -1);
+
UpdateABHost("FindMembership", body ? abUrl : NULL);
while (svcs != NULL)
@@ -315,13 +317,13 @@ bool CMsnProto::MSN_SharingFindMembership(bool deltas, bool allowRecurse) const char* szLastChange = ezxml_txt(ezxml_child(svcs, "LastChange"));
if (szLastChange[0]) setString("SharingLastChange", szLastChange);
-
+
ezxml_t mems = ezxml_get(svcs, "Memberships", 0, "Membership", -1);
-
+
while (mems != NULL)
{
const char* szRole = ezxml_txt(ezxml_child(mems, "MemberRole"));
-
+
int lstId = 0;
if (strcmp(szRole, "Allow") == 0) lstId = LIST_AL;
else if (strcmp(szRole, "Block") == 0) lstId = LIST_BL;
@@ -399,7 +401,7 @@ bool CMsnProto::MSN_SharingFindMembership(bool deltas, bool allowRecurse) }
else
UpdateABHost("FindMembership", NULL);
-
+
ezxml_free(xmlm);
}
mir_free(tResult);
@@ -436,21 +438,21 @@ bool CMsnProto::MSN_SharingAddDelMember(const char* szEmail, const int listId, c switch (netId)
{
- case 1:
+ case 1:
szMemberName = "PassportMember";
szTypeName = "Passport";
szAccIdName = "PassportName";
break;
- case 4:
+ case 4:
szMemberName = "PhoneMember";
szTypeName = "Phone";
szAccIdName = "PhoneNumber";
- szEmail = strchr(szEmail, ':') + 1;
+ szEmail = strchr(szEmail, ':') + 1;
break;
- case 2:
- case 32:
+ case 2:
+ case 32:
szMemberName = "EmailMember";
szTypeName = "Email";
szAccIdName = "Email";
@@ -471,7 +473,7 @@ bool CMsnProto::MSN_SharingAddDelMember(const char* szEmail, const int listId, c ezxml_set_txt(node, "Accepted");
node = ezxml_add_child(memb, szAccIdName, 0);
ezxml_set_txt(node, szEmail);
-
+
char buf[64];
if ((netId == NETID_LCS || netId == NETID_YAHOO) && strcmp(szMethod, "DeleteMember") != 0)
{
@@ -504,7 +506,7 @@ bool CMsnProto::MSN_SharingAddDelMember(const char* szEmail, const int listId, c mir_free(reqHdr);
free(szData);
- if (tResult != NULL)
+ if (tResult != NULL)
{
UpdateABHost(szMethod, abUrl);
ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult));
@@ -555,7 +557,7 @@ bool CMsnProto::MSN_SharingMyProfile(bool allowRecurse) ezxml_set_txt(node, "Accepted");
node = ezxml_add_child(memb, "Id", 0);
ezxml_set_txt(node, "Allow");
-
+
ezxml_t svcdef = ezxml_add_child(memb, "DefiningService", 0);
node = ezxml_add_child(svcdef, "Id", 0);
ezxml_set_txt(node, "0");
@@ -660,7 +662,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas node = ezxml_add_child(tbdy, "dynamicItemLastChange", 0);
ezxml_set_txt(node, szDynLastChange);
}
-
+
if (szGuid)
{
node = ezxml_add_child(tbdy, "contactIds", 0);
@@ -738,12 +740,12 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas if (MyOptions.ManageServer)
{
- ezxml_t grp = ezxml_get(body, szGroups, 0, "Group", -1);
+ ezxml_t grp = ezxml_get(body, szGroups, 0, "Group", -1);
while (grp != NULL)
{
const char* szGrpId = ezxml_txt(ezxml_child(grp, "groupId"));
const char* szGrpName = ezxml_txt(ezxml_get(grp, "groupInfo", 0, "name", -1));
- MSN_AddGroup(szGrpName, szGrpId, true);
+ MSN_AddGroup(szGrpName, szGrpId, true);
grp = ezxml_next(grp);
}
@@ -752,7 +754,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas for (ezxml_t cont = ezxml_get(body, szContacts, 0, "Contact", -1); cont != NULL; cont = ezxml_next(cont))
{
const char* szContId = ezxml_txt(ezxml_child(cont, "contactId"));
-
+
ezxml_t contInf = ezxml_child(cont, "contactInfo");
const char* szType = ezxml_txt(ezxml_child(contInf, "contactType"));
@@ -762,7 +764,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas const char* szEmail = ezxml_txt(ezxml_child(contInf, "passportName"));
const char* szMsgUsr = ezxml_txt(ezxml_child(contInf, "isMessengerUser"));
-
+
int netId = NETID_UNKNOWN;
if (strcmp(szMsgUsr, "true") == 0) netId = NETID_MSN;
@@ -772,7 +774,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas while (eml != NULL)
{
szMsgUsr = ezxml_txt(ezxml_child(eml, "isMessengerEnabled"));
- if (strcmp(szMsgUsr, "true") == 0)
+ if (strcmp(szMsgUsr, "true") == 0)
{
szEmail = ezxml_txt(ezxml_child(eml, "email"));
const char* szCntType = ezxml_txt(ezxml_child(eml, "contactEmailType"));
@@ -791,7 +793,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas while (phn != NULL)
{
szMsgUsr = ezxml_txt(ezxml_child(phn, "isMessengerEnabled"));
- if (strcmp(szMsgUsr, "true") == 0)
+ if (strcmp(szMsgUsr, "true") == 0)
{
szEmail = ezxml_txt(ezxml_child(phn, "number"));
mir_snprintf(email, sizeof(email), "tel:%s", szEmail);
@@ -824,7 +826,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas MSN_SyncContactToServerGroup(hContact, szContId, grps);
}
}
-
+
const char* szNick = NULL;
ezxml_t anot = ezxml_get(contInf, "annotations", 0, "Annotation", -1);
while (anot != NULL)
@@ -898,7 +900,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas while (loc != NULL)
{
const char* szCntType = ezxml_txt(ezxml_child(loc, "contactLocationType"));
-
+
int locid = -1;
if (strcmp(szCntType, "ContactLocationPersonal") == 0)
locid = 0;
@@ -970,7 +972,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas if (!msnLoggedIn && msnNsThread)
{
char *szCircleTicket = ezxml_txt(ezxml_get(body, "CircleResult", 0, "CircleTicket", -1));
- int cbCircleTicket = (int)strlen(szCircleTicket);
+ int cbCircleTicket = (int)strlen(szCircleTicket);
int cbCircleTicketEnc = Netlib_GetBase64EncodedBufferSize(cbCircleTicket);
char* szCircleTicketEnc = (char*)alloca(cbCircleTicketEnc);
@@ -1123,7 +1125,7 @@ void CMsnProto::MSN_ABAddGroup(const char* szGrpName, bool allowRecurse) {
ezxml_t body = getSoapResponse(xmlm, "ABGroupAdd");
const char* szGrpId = ezxml_txt(ezxml_child(body, "guid"));
- MSN_AddGroup(szGrpName, szGrpId, false);
+ MSN_AddGroup(szGrpName, szGrpId, false);
}
else if (status == 500)
{
@@ -1319,7 +1321,7 @@ bool CMsnProto::MSN_ABUpdateProperty(const char* szCntId, const char* propName, ezxml_set_txt(node, propValue);
node = ezxml_add_child(cont, "propertiesChanged", 0);
- char* szPrpChg = mir_strdup(propName);
+ char* szPrpChg = mir_strdup(propName);
*szPrpChg = _toupper(*szPrpChg);
ezxml_set_txt(node, szPrpChg);
@@ -1552,10 +1554,10 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in if (status == 200)
{
ezxml_t body = getSoapResponse(xmlm, "ABContactAdd");
-
+
const char* szContId = ezxml_txt(ezxml_child(body, "guid"));
- if (search)
+ if (search)
MSN_ABAddDelContactGroup(szContId , NULL, "ABContactDelete");
else
{
@@ -1577,7 +1579,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in status = 2;
else if (strcmp(szErr, "BadEmailArgument") == 0)
status = 4;
- else if (strcmp(szErr, "ContactAlreadyExists") == 0)
+ else if (strcmp(szErr, "ContactAlreadyExists") == 0)
{
status = 3;
@@ -1585,7 +1587,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in node = ezxml_get(node, "detail", 0, "additionalDetails", 0, "conflictObjectId", -1);
const char* szContId = ezxml_txt(node);
- if (search)
+ if (search)
{
if (retry)
{
@@ -1626,7 +1628,7 @@ void CMsnProto::MSN_ABUpdateDynamicItem(bool allowRecurse) ezxml_t dynitms = ezxml_add_child(tbdy, "dynamicItems", 0);
ezxml_t dynitm = ezxml_add_child(dynitms, "DynamicItem", 0);
-
+
ezxml_set_attr(dynitm, "xsi:type", "PassportDynamicItem");
ezxml_t node = ezxml_add_child(dynitm, "Type", 0);
ezxml_set_txt(node, "Passport");
@@ -1645,7 +1647,7 @@ void CMsnProto::MSN_ABUpdateDynamicItem(bool allowRecurse) ezxml_set_txt(node, "Profile");
node = ezxml_add_child(hnd, "ForeignId", 0);
ezxml_set_txt(node, "MyProfile");
-
+
node = ezxml_add_child(info, "InverseRequired", 0);
ezxml_set_txt(node, "false");
node = ezxml_add_child(info, "IsBot", 0);
@@ -1660,14 +1662,14 @@ void CMsnProto::MSN_ABUpdateDynamicItem(bool allowRecurse) node = ezxml_add_child(notd, "Status", 0);
ezxml_set_txt(node, "Exist Access");
node = ezxml_add_child(notd, "LastChanged", 0);
-
+
time_t timer;
time(&timer);
tm *tmst = gmtime(&timer);
char tmstr[32];
- mir_snprintf(tmstr, sizeof(tmstr), "%04u-%02u-%02uT%02u:%02u:%02uZ",
- tmst->tm_year + 1900, tmst->tm_mon+1, tmst->tm_mday,
+ mir_snprintf(tmstr, sizeof(tmstr), "%04u-%02u-%02uT%02u:%02u:%02uZ",
+ tmst->tm_year + 1900, tmst->tm_mon+1, tmst->tm_mday,
tmst->tm_hour, tmst->tm_min, tmst->tm_sec);
ezxml_set_txt(node, tmstr);
diff --git a/protocols/MSN/src/msn_soapstore.cpp b/protocols/MSN/src/msn_soapstore.cpp index 1e565d0ca9..b0c7a17473 100644 --- a/protocols/MSN/src/msn_soapstore.cpp +++ b/protocols/MSN/src/msn_soapstore.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
@@ -19,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "msn_global.h"
#include "msn_proto.h"
-static const char storeReqHdr[] =
+static const char storeReqHdr[] =
"SOAPAction: http://www.msn.com/webservices/storage/2008/%s\r\n";
ezxml_t CMsnProto::storeSoapHdr(const char* service, const char* scenario, ezxml_t& tbdy, char*& httphdr)
@@ -29,7 +31,7 @@ ezxml_t CMsnProto::storeSoapHdr(const char* service, const char* scenario, ezxml 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:soapenc", "http://schemas.xmlsoap.org/soap/encoding/");
-
+
ezxml_t hdr = ezxml_add_child(xmlp, "soap:Header", 0);
if (storageCacheKey)
@@ -55,7 +57,7 @@ ezxml_t CMsnProto::storeSoapHdr(const char* service, const char* scenario, ezxml if (authStorageToken) ezxml_set_txt(node, authStorageToken);
ezxml_t bdy = ezxml_add_child(xmlp, "soap:Body", 0);
-
+
tbdy = ezxml_add_child(bdy, service, 0);
ezxml_set_attr(tbdy, "xmlns", "http://www.msn.com/webservices/storage/2008");
@@ -70,7 +72,7 @@ ezxml_t CMsnProto::storeSoapHdr(const char* service, const char* scenario, ezxml char* CMsnProto::GetStoreHost(const char* service)
{
char hostname[128];
- mir_snprintf(hostname, sizeof(hostname), "StoreHost-%s", service);
+ mir_snprintf(hostname, sizeof(hostname), "StoreHost-%s", service);
char* host = (char*)mir_alloc(256);
if (getStaticString(NULL, hostname, host, 256))
@@ -82,7 +84,7 @@ char* CMsnProto::GetStoreHost(const char* service) void CMsnProto::UpdateStoreHost(const char* service, const char* url)
{
char hostname[128];
- mir_snprintf(hostname, sizeof(hostname), "StoreHost-%s", service);
+ mir_snprintf(hostname, sizeof(hostname), "StoreHost-%s", service);
setString(NULL, hostname, url);
}
@@ -256,7 +258,7 @@ bool CMsnProto::MSN_StoreGetProfile(bool allowRecurse) mir_free(reqHdr);
free(szData);
- if (tResult != NULL)
+ if (tResult != NULL)
{
if (status == 200)
{
@@ -278,12 +280,12 @@ bool CMsnProto::MSN_StoreGetProfile(bool allowRecurse) {
const char* szNick = ezxml_txt(ezxml_child(expr, "DisplayName"));
setStringUtf(NULL, "Nick", (char*)szNick);
-
+
const char* szStatus = ezxml_txt(ezxml_child(expr, "PersonalStatus"));
replaceStr(msnLastStatusMsg, szStatus);
mir_snprintf(expresid, sizeof(expresid), "%s", ezxml_txt(ezxml_child(expr, "ResourceID")));
-
+
ezxml_t photo = ezxml_child(expr, "Photo");
mir_snprintf(photoid, sizeof(photoid), "%s", ezxml_txt(ezxml_child(photo, "ResourceID")));
@@ -566,7 +568,7 @@ bool CMsnProto::MSN_StoreCreateDocument(const TCHAR *sztName, const char *szMime node = ezxml_add_child(doc, "MimeType", 0);
ezxml_set_txt(node, szMimeType);
node = ezxml_add_child(doc, "Data", 0);
- ezxml_set_txt(node, szPicData);
+ ezxml_set_txt(node, szPicData);
node = ezxml_add_child(doc, "DataSize", 0);
ezxml_set_txt(node, "0");
@@ -640,7 +642,7 @@ bool CMsnProto::MSN_StoreUpdateDocument(const TCHAR *sztName, const char *szMime doc = ezxml_add_child(doc, "DocumentStreams", 0);
doc = ezxml_add_child(doc, "DocumentStream", 0);
ezxml_set_attr(doc, "xsi:type", "PhotoStream");
-
+
node = ezxml_add_child(doc, "MimeType", 0);
ezxml_set_txt(node, szMimeType);
node = ezxml_add_child(doc, "Data", 0);
diff --git a/protocols/MSN/src/msn_srv.cpp b/protocols/MSN/src/msn_srv.cpp index a01cd401da..0f75491617 100644 --- a/protocols/MSN/src/msn_srv.cpp +++ b/protocols/MSN/src/msn_srv.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -33,7 +35,7 @@ void CMsnProto::MSN_AddGroup(const char* grpName, const char *grpId, bool init) p = (ServerGroupItem*)mir_alloc(sizeof(ServerGroupItem));
p->id = mir_strdup(grpId);
p->name = mir_strdup(grpName);
-
+
grpList.insert(p);
if (init)
@@ -50,7 +52,7 @@ void CMsnProto::MSN_AddGroup(const char* grpName, const char *grpId, bool init) void CMsnProto::MSN_DeleteGroup(const char* pId)
{
int i = grpList.getIndex((ServerGroupItem*)&pId);
- if (i > -1)
+ if (i > -1)
{
ServerGroupItem* p = grpList[i];
mir_free(p->id);
@@ -76,7 +78,7 @@ void CMsnProto::MSN_DeleteServerGroup(LPCSTR szId) if (msc == NULL) break;
char szGroupID[100];
- if (!getStaticString(msc->hContact, "GroupID", szGroupID, sizeof(szGroupID)))
+ if (!getStaticString(msc->hContact, "GroupID", szGroupID, sizeof(szGroupID)))
{
if (strcmp(szGroupID, szId) == 0)
deleteSetting(msc->hContact, "GroupID");
@@ -90,7 +92,7 @@ void CMsnProto::MSN_DeleteServerGroup(LPCSTR szId) void CMsnProto::MSN_FreeGroups(void)
{
- for (int i=0; i < grpList.getCount(); i++)
+ for (int i=0; i < grpList.getCount(); i++)
{
ServerGroupItem* p = grpList[i];
mir_free(p->id);
@@ -110,11 +112,11 @@ LPCSTR CMsnProto::MSN_GetGroupById(const char* pId) }
/////////////////////////////////////////////////////////////////////////////////////////
-// MSN_GetGroupByName - tries to return a group UUID associated with the given name
+// MSN_GetGroupByName - tries to return a group UUID associated with the given name
LPCSTR CMsnProto::MSN_GetGroupByName(const char* pName)
{
- for (int i=0; i < grpList.getCount(); i++)
+ for (int i=0; i < grpList.getCount(); i++)
{
const ServerGroupItem* p = grpList[i];
if (strcmp(p->name, pName) == 0)
@@ -134,7 +136,7 @@ void CMsnProto::MSN_SetGroupName(const char* pId, const char* pNewName) }
/////////////////////////////////////////////////////////////////////////////////////////
-// MSN_MoveContactToGroup - sends a contact to the specified group
+// MSN_MoveContactToGroup - sends a contact to the specified group
void CMsnProto::MSN_MoveContactToGroup(HANDLE hContact, const char* grpName)
{
@@ -197,7 +199,7 @@ void CMsnProto::MSN_RemoveEmptyGroups(void) if (msc == NULL) break;
char szGroupID[100];
- if (!getStaticString(msc->hContact, "GroupID", szGroupID, sizeof(szGroupID)))
+ if (!getStaticString(msc->hContact, "GroupID", szGroupID, sizeof(szGroupID)))
{
const char *pId = szGroupID;
int i = grpList.getIndex((ServerGroupItem*)&pId);
@@ -205,7 +207,7 @@ void CMsnProto::MSN_RemoveEmptyGroups(void) }
}
- for (int i=grpList.getCount(); i--;)
+ for (int i=grpList.getCount(); i--;)
{
if (cCount[i] == 0) MSN_DeleteServerGroup(grpList[i]->id);
}
@@ -236,17 +238,17 @@ void CMsnProto::MSN_UploadServerGroups(char* group) if (msc == NULL) break;
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(msc->hContact, "CList", "Group", &dbv))
+ if (!DBGetContactSettingStringUtf(msc->hContact, "CList", "Group", &dbv))
{
char szGroupID[100];
if (group == NULL || (strcmp(group, dbv.pszVal) == 0 &&
- getStaticString(msc->hContact, "GroupID", szGroupID, sizeof(szGroupID)) != 0))
+ getStaticString(msc->hContact, "GroupID", szGroupID, sizeof(szGroupID)) != 0))
{
MSN_MoveContactToGroup(msc->hContact, dbv.pszVal);
}
MSN_FreeVariant(&dbv);
- }
- }
+ }
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -287,26 +289,26 @@ void CMsnProto::MSN_SyncContactToServerGroup(HANDLE hContact, const char* szCont const char* szGrpNameById = MSN_GetGroupById(szGrpId);
- if (szGrpNameById && (strcmp(szGrpNameById, szGrpName) == 0 ||
- (cgrp == NULL && szGrpIdF == NULL)))
+ if (szGrpNameById && (strcmp(szGrpNameById, szGrpName) == 0 ||
+ (cgrp == NULL && szGrpIdF == NULL)))
szGrpIdF = szGrpId;
- else
+ else
MSN_ABAddDelContactGroup(szContId, szGrpId, "ABGroupContactDelete");
}
- if (szGrpIdF != NULL)
+ if (szGrpIdF != NULL)
{
setString(hContact, "GroupID", szGrpIdF);
const char* szGrpNameById = MSN_GetGroupById(szGrpIdF);
if (strcmp(szGrpNameById, szGrpName))
DBWriteContactSettingStringUtf(hContact, "CList", "Group", szGrpNameById);
}
- else
+ else
{
if (szGrpName[0])
DBDeleteContactSetting(hContact, "CList", "Group");
deleteSetting(hContact, "GroupID");
- }
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -318,7 +320,7 @@ void CMsnProto::MSN_SendNicknameUtf(const char* nickname) setStringUtf(NULL, "Nick", nickname);
else
deleteSetting(NULL, "Nick");
-
+
MSN_SetNicknameUtf(nickname[0] ? nickname : MyOptions.szEmail);
ForkThread(&CMsnProto::msn_storeProfileThread, (void*)1);
@@ -348,7 +350,7 @@ void CMsnProto::msn_storeAvatarThread(void* arg) NETLIBBASE64 nlb = { szEncBuf, (int)szEncPngSize, dat->data, (int)dat->dataSize };
CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb));
}
-
+
if (photoid[0] && dat)
{
MSN_StoreUpdateDocument(dat->szName, dat->szMimeType, szEncBuf);
@@ -401,7 +403,7 @@ void CMsnProto::msn_storeProfileThread(void* param) char** msgptr = GetStatusMsgLoc(m_iStatus);
char *szStatus = msgptr ? *msgptr : NULL;
- if (param || (msnLastStatusMsg != szStatus &&
+ if (param || (msnLastStatusMsg != szStatus &&
(msnLastStatusMsg && szStatus && strcmp(msnLastStatusMsg, szStatus))))
{
diff --git a/protocols/MSN/src/msn_ssl.cpp b/protocols/MSN/src/msn_ssl.cpp index f17f738add..d88d3ee2f3 100644 --- a/protocols/MSN/src/msn_ssl.cpp +++ b/protocols/MSN/src/msn_ssl.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -21,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "msn_global.h"
#include "msn_proto.h"
-char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char* hdrs, unsigned& status)
+char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char* hdrs, unsigned& status)
{
mHttpsTS = clock();
@@ -60,7 +62,7 @@ char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char {
char* fnd = strchr(hdrprs, ':');
if (fnd == NULL) break;
- *fnd = 0;
+ *fnd = 0;
fnd += 2;
nlhr.headers[nlhr.headersCount].szName = hdrprs;
@@ -78,7 +80,7 @@ char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,
(WPARAM)hNetlibUserHttps,(LPARAM)&nlhr);
- if (nlhrReply)
+ if (nlhrReply)
{
hHttpsConnection = nlhrReply->nlc;
status = nlhrReply->resultCode;
@@ -94,7 +96,7 @@ char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char nlhrReply->dataLength = 0;
nlhrReply->pData = NULL;
-
+
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
}
else
@@ -105,7 +107,7 @@ char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char return result;
}
-bool CMsnProto::getMyAvatarFile(char *url, TCHAR *fname)
+bool CMsnProto::getMyAvatarFile(char *url, TCHAR *fname)
{
NETLIBHTTPREQUEST nlhr = {0};
bool result = true;
@@ -125,7 +127,7 @@ bool CMsnProto::getMyAvatarFile(char *url, TCHAR *fname) NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,
(WPARAM)hNetlibUserHttps,(LPARAM)&nlhr);
- if (nlhrReply)
+ if (nlhrReply)
{
if (nlhrReply->resultCode == 200 && nlhrReply->dataLength)
MSN_SetMyAvatar(fname, nlhrReply->pData, nlhrReply->dataLength);
diff --git a/protocols/MSN/src/msn_std.cpp b/protocols/MSN/src/msn_std.cpp index 588df3c9e9..d96e13d8fa 100644 --- a/protocols/MSN/src/msn_std.cpp +++ b/protocols/MSN/src/msn_std.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -136,7 +138,7 @@ void CMsnProto::setWord(const char* name, WORD value) void CMsnProto::setWord(HANDLE hContact, const char* name, WORD value)
{ DBWriteContactSettingWord(hContact, m_szModuleName, name, value);
}
-
+
/////////////////////////////////////////////////////////////////////////////////////////
void CMsnProto::CreateProtoService(const char* szService, MsnServiceFunc serviceProc)
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index 5a4ec5404a..20d0aa2153 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -249,7 +251,7 @@ INT_PTR CMsnProto::SendNudge(WPARAM wParam, LPARAM lParam) char tEmail[MSN_MAX_EMAIL_LEN];
if (MSN_IsMeByContact(hContact, tEmail)) return 0;
- static const char nudgemsg[] =
+ static const char nudgemsg[] =
"Content-Type: text/x-msnmsgr-datacast\r\n\r\n"
"ID: 1\r\n\r\n";
@@ -267,7 +269,7 @@ INT_PTR CMsnProto::SendNudge(WPARAM wParam, LPARAM lParam) ThreadData* thread = MSN_StartSB(tEmail, isOffline);
if (thread == NULL)
{
- if (isOffline) return 0;
+ if (isOffline) return 0;
MsgQueue_Add(tEmail, 'N', nudgemsg, -1);
}
else
@@ -385,21 +387,21 @@ int CMsnProto::OnContactDeleted(WPARAM wParam, LPARAM lParam) return 0;
int type = getByte(hContact, "ChatRoom", 0);
- if (type != 0)
+ if (type != 0)
{
DBVARIANT dbv;
if (!getTString(hContact, "ChatRoomID", &dbv)) {
MSN_KillChatSession(dbv.ptszVal);
MSN_FreeVariant(&dbv);
- }
+ }
}
else
{
char szEmail[MSN_MAX_EMAIL_LEN];
if (MSN_IsMeByContact(hContact, szEmail))
CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM) 1);
-
- if (szEmail[0])
+
+ if (szEmail[0])
{
MSN_DebugLog("Deleted Handler Email");
@@ -409,7 +411,7 @@ int CMsnProto::OnContactDeleted(WPARAM wParam, LPARAM lParam) DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), NULL, DlgDeleteContactUI, (LPARAM)¶m);
MsnContact* msc = Lists_Get(szEmail);
- if (msc) msc->hContact = NULL;
+ if (msc) msc->hContact = NULL;
}
if (Lists_IsInList(LIST_LL, szEmail))
{
@@ -434,7 +436,7 @@ int CMsnProto::OnGroupChange(WPARAM wParam,LPARAM lParam) if (grpchg->pszNewName == NULL && grpchg->pszOldName != NULL)
{
LPCSTR szId = MSN_GetGroupByName(UTF8(grpchg->pszOldName));
- if (szId != NULL) MSN_DeleteServerGroup(szId);
+ if (szId != NULL) MSN_DeleteServerGroup(szId);
}
else if (grpchg->pszNewName != NULL && grpchg->pszOldName != NULL)
{
@@ -466,47 +468,47 @@ int CMsnProto::OnDbSettingChanged(WPARAM wParam,LPARAM lParam) if (!msnLoggedIn)
return 0;
- if (hContact == NULL)
+ if (hContact == NULL)
{
if (MyOptions.SlowSend && strcmp(cws->szSetting, "MessageTimeout") == 0 &&
(strcmp(cws->szModule, "SRMM") == 0 || strcmp(cws->szModule, "SRMsg") == 0))
- {
+ {
if (cws->value.dVal < 60000)
- MessageBox(NULL, TranslateT("MSN requires message send timeout in your Message window plugin to be not less then 60 sec. Please correct the timeout value."),
+ MessageBox(NULL, TranslateT("MSN requires message send timeout in your Message window plugin to be not less then 60 sec. Please correct the timeout value."),
TranslateT("MSN Protocol"), MB_OK|MB_ICONINFORMATION);
}
return 0;
}
- if (!strcmp(cws->szSetting, "ApparentMode"))
+ if (!strcmp(cws->szSetting, "ApparentMode"))
{
char tEmail[MSN_MAX_EMAIL_LEN];
- if (!getStaticString(hContact, "e-mail", tEmail, sizeof(tEmail)))
+ if (!getStaticString(hContact, "e-mail", tEmail, sizeof(tEmail)))
{
bool isBlocked = Lists_IsInList(LIST_BL, tEmail);
- if (isBlocked && (cws->value.type == DBVT_DELETED || cws->value.wVal == 0))
+ if (isBlocked && (cws->value.type == DBVT_DELETED || cws->value.wVal == 0))
{
MSN_AddUser(hContact, tEmail, 0, LIST_BL + LIST_REMOVE);
MSN_AddUser(hContact, tEmail, 0, LIST_AL);
- }
- else if (!isBlocked && cws->value.wVal == ID_STATUS_OFFLINE)
+ }
+ else if (!isBlocked && cws->value.wVal == ID_STATUS_OFFLINE)
{
MSN_AddUser(hContact, tEmail, 0, LIST_AL + LIST_REMOVE);
MSN_AddUser(hContact, tEmail, 0, LIST_BL);
}
- }
+ }
}
- if (!strcmp(cws->szSetting, "MyHandle") && !strcmp(cws->szModule, "CList"))
+ if (!strcmp(cws->szSetting, "MyHandle") && !strcmp(cws->szModule, "CList"))
{
bool isMe = MSN_IsMeByContact(hContact);
if (!isMe || !nickChg)
{
char szContactID[100];
- if (!getStaticString(hContact, "ID", szContactID, sizeof(szContactID)))
+ if (!getStaticString(hContact, "ID", szContactID, sizeof(szContactID)))
{
- if (cws->value.type != DBVT_DELETED)
+ if (cws->value.type != DBVT_DELETED)
{
if (cws->value.type == DBVT_UTF8)
MSN_ABUpdateNick(cws->value.pszVal, szContactID);
@@ -554,13 +556,13 @@ int CMsnProto::OnWindowEvent(WPARAM wParam, LPARAM lParam) {
MessageWindowEventData* msgEvData = (MessageWindowEventData*)lParam;
- if (msgEvData->uType == MSG_WINDOW_EVT_OPENING)
+ if (msgEvData->uType == MSG_WINDOW_EVT_OPENING)
{
if (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_INVISIBLE)
return 0;
if (!MSN_IsMyContact(msgEvData->hContact)) return 0;
-
+
char tEmail[MSN_MAX_EMAIL_LEN];
if (MSN_IsMeByContact(msgEvData->hContact, tEmail)) return 0;
@@ -571,7 +573,7 @@ int CMsnProto::OnWindowEvent(WPARAM wParam, LPARAM lParam) bool isOffline;
ThreadData* thread = MSN_StartSB(tEmail, isOffline);
-
+
if (thread == NULL && !isOffline)
MsgQueue_Add(tEmail, 'X', NULL, 0);
}
@@ -597,7 +599,7 @@ int CMsnProto::OnWindowPopup(WPARAM wParam, LPARAM lParam) case MSG_WINDOWPOPUP_SELECTED:
if (mwpd->selection == 13465)
{
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
+ DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
LPARAM(new InviteChatParam(NULL, mwpd->hContact, this)));
}
break;
@@ -622,7 +624,7 @@ INT_PTR CMsnProto::GetUnreadEmailCount(WPARAM wParam, LPARAM lParam) INT_PTR CMsnProto::OnLeaveChat(WPARAM wParam,LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
- if (getByte(hContact, "ChatRoom", 0) != 0)
+ if (getByte(hContact, "ChatRoom", 0) != 0)
{
DBVARIANT dbv;
if (getTString(hContact, "ChatRoomID", &dbv) == 0)
diff --git a/protocols/MSN/src/msn_switchboard.cpp b/protocols/MSN/src/msn_switchboard.cpp index 05bfae3ecc..c7777c25a4 100644 --- a/protocols/MSN/src/msn_switchboard.cpp +++ b/protocols/MSN/src/msn_switchboard.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp index 25f9a9a765..3db86cced2 100644 --- a/protocols/MSN/src/msn_threads.cpp +++ b/protocols/MSN/src/msn_threads.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -40,7 +42,7 @@ void __cdecl CMsnProto::msn_keepAliveThread(void*) keepFlag = msnNsThread != NULL;
if (usingGateway)
msnPingTimeout = 45;
- else
+ else
{
msnPingTimeout = 20;
keepFlag = keepFlag && msnNsThread->send("PNG\r\n", 5);
@@ -66,7 +68,7 @@ void __cdecl CMsnProto::msn_keepAliveThread(void*) default:
keepFlag = false;
break;
- }
+ }
}
CloseHandle(hKeepAliveThreadEvt); hKeepAliveThreadEvt = NULL;
@@ -87,10 +89,10 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) if (tPortDelim != NULL)
*tPortDelim = '\0';
- if (usingGateway)
+ if (usingGateway)
{
if (info->mServer[0] == 0)
- strcpy(info->mServer, MSN_DEFAULT_LOGIN_SERVER);
+ strcpy(info->mServer, MSN_DEFAULT_LOGIN_SERVER);
else if (info->mIsMainThread)
strcpy(info->mGatewayIP, info->mServer);
@@ -123,25 +125,25 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) {
tConn.szHost = info->mServer;
tConn.wPort = MSN_DEFAULT_PORT;
- if (tPortDelim != NULL)
+ if (tPortDelim != NULL)
{
int tPortNumber = atoi(tPortDelim + 1);
if (tPortNumber)
tConn.wPort = (WORD)tPortNumber;
- }
+ }
}
MSN_DebugLog("Thread started: server='%s:%d', type=%d", tConn.szHost, tConn.wPort, info->mType);
info->s = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlibUser, (LPARAM)&tConn);
- if (info->s == NULL)
+ if (info->s == NULL)
{
MSN_DebugLog("Connection Failed (%d) server='%s:%d'", WSAGetLastError(), tConn.szHost, tConn.wPort);
- switch (info->mType)
+ switch (info->mType)
{
- case SERVER_NOTIFICATION:
- goto LBL_Exit;
+ case SERVER_NOTIFICATION:
+ goto LBL_Exit;
break;
case SERVER_SWITCHBOARD:
@@ -156,7 +158,7 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) MSN_DebugLog("Connected with handle=%08X", info->s);
- if (info->mType == SERVER_NOTIFICATION)
+ if (info->mType == SERVER_NOTIFICATION)
{
info->sendPacket("VER", "MSNP18 MSNP17 CVR0");
}
@@ -164,28 +166,28 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) {
info->sendPacket(info->mCaller ? "USR" : "ANS", "%s;%s %s", MyOptions.szEmail, MyOptions.szMachineGuid, info->mCookie);
}
- else if (info->mType == SERVER_FILETRANS && info->mCaller == 0)
+ else if (info->mType == SERVER_FILETRANS && info->mCaller == 0)
{
info->send("VER MSNFTP\r\n", 12);
}
- if (info->mIsMainThread)
+ if (info->mIsMainThread)
{
msnNsThread = info;
}
MSN_DebugLog("Entering main recv loop");
info->mBytesInData = 0;
- for (;;)
+ for (;;)
{
int recvResult = info->recv(info->mData + info->mBytesInData, sizeof(info->mData) - info->mBytesInData);
- if (recvResult == SOCKET_ERROR)
+ if (recvResult == SOCKET_ERROR)
{
MSN_DebugLog("Connection %08p [%08X] was abortively closed", info->s, GetCurrentThreadId());
break;
}
- if (!recvResult)
+ if (!recvResult)
{
MSN_DebugLog("Connection %08p [%08X] was gracefully closed", info->s, GetCurrentThreadId());
break;
@@ -193,14 +195,14 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) info->mBytesInData += recvResult;
- if (info->mCaller == 1 && info->mType == SERVER_FILETRANS)
+ if (info->mCaller == 1 && info->mType == SERVER_FILETRANS)
{
if (MSN_HandleMSNFTP(info, info->mData))
break;
}
- else
+ else
{
- for (;;)
+ for (;;)
{
char* peol = strchr(info->mData, '\r');
if (peol == NULL)
@@ -221,13 +223,13 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) memmove(info->mData, peol, info->mBytesInData);
MSN_DebugLog("RECV: %s", msg);
- if (!isalnum(msg[0]) || !isalnum(msg[1]) || !isalnum(msg[2]) || (msg[3] && msg[3] != ' '))
+ if (!isalnum(msg[0]) || !isalnum(msg[1]) || !isalnum(msg[2]) || (msg[3] && msg[3] != ' '))
{
MSN_DebugLog("Invalid command name");
continue;
}
- if (info->mType != SERVER_FILETRANS)
+ if (info->mType != SERVER_FILETRANS)
{
int handlerResult;
if (isdigit(msg[0]) && isdigit(msg[1]) && isdigit(msg[2])) //all error messages
@@ -241,26 +243,26 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) info->sendTerminate();
}
}
- else
+ else
if (MSN_HandleMSNFTP(info, msg))
goto LBL_Exit;
- }
+ }
}
- if (info->mBytesInData == sizeof(info->mData))
+ if (info->mBytesInData == sizeof(info->mData))
{
MSN_DebugLog("sizeof(data) is too small: the longest line won't fit");
break;
- }
+ }
}
LBL_Exit:
- if (info->mIsMainThread)
+ if (info->mIsMainThread)
{
- if (!isConnectSuccess && !usingGateway && m_iDesiredStatus != ID_STATUS_OFFLINE)
- {
+ if (!isConnectSuccess && !usingGateway && m_iDesiredStatus != ID_STATUS_OFFLINE)
+ {
msnNsThread = NULL;
- usingGateway = true;
+ usingGateway = true;
ThreadData* newThread = new ThreadData;
newThread->mType = SERVER_NOTIFICATION;
@@ -270,7 +272,7 @@ LBL_Exit: }
else
{
- if (hKeepAliveThreadEvt)
+ if (hKeepAliveThreadEvt)
{
msnPingTimeout *= -1;
SetEvent(hKeepAliveThreadEvt);
@@ -310,11 +312,11 @@ void CMsnProto::MSN_CloseConnections(void) NETLIBSELECTEX nls = {0};
nls.cbSize = sizeof(nls);
- for (int i=0; i < sttThreads.getCount(); i++)
+ for (int i=0; i < sttThreads.getCount(); i++)
{
ThreadData* T = &sttThreads[i];
- switch (T->mType)
+ switch (T->mType)
{
case SERVER_NOTIFICATION :
case SERVER_SWITCHBOARD :
@@ -330,7 +332,7 @@ void CMsnProto::MSN_CloseConnections(void) case SERVER_P2P_DIRECT :
CallService(MS_NETLIB_SHUTDOWN, (WPARAM)T->s, 0);
break;
- }
+ }
}
LeaveCriticalSection(&sttLock);
@@ -351,7 +353,7 @@ ThreadData* CMsnProto::MSN_GetThreadByContact(const char* wlid, TInfoType type) {
ThreadData* result = NULL;
EnterCriticalSection(&sttLock);
-
+
if (type == SERVER_P2P_DIRECT)
{
for (int i=0; i < sttThreads.getCount(); i++)
@@ -416,14 +418,14 @@ ThreadData* CMsnProto::MSN_GetThreadByTimer(UINT timerId) ThreadData* result = NULL;
EnterCriticalSection(&sttLock);
- for (int i=0; i < sttThreads.getCount(); i++)
+ for (int i=0; i < sttThreads.getCount(); i++)
{
ThreadData* T = &sttThreads[i];
- if (T->mType == SERVER_SWITCHBOARD && T->mTimerId == timerId)
+ if (T->mType == SERVER_SWITCHBOARD && T->mTimerId == timerId)
{
result = T;
break;
- }
+ }
}
LeaveCriticalSection(&sttLock);
@@ -458,14 +460,14 @@ ThreadData* CMsnProto::MSN_GetP2PThreadByContact(const char *wlid) {
ThreadData* T = &sttThreads[i];
if (T->mJoinedContactsWLID.getCount() && !T->mInitialContactWLID &&
- _stricmp(T->mJoinedContactsWLID[0], szEmail) == 0)
+ _stricmp(T->mJoinedContactsWLID[0], szEmail) == 0)
{
if (T->mType == SERVER_P2P_DIRECT)
{
result = T;
break;
}
- else if (T->mType == SERVER_SWITCHBOARD)
+ else if (T->mType == SERVER_SWITCHBOARD)
result = T;
}
}
@@ -481,12 +483,12 @@ void CMsnProto::MSN_StartP2PTransferByContact(const char* wlid) {
EnterCriticalSection(&sttLock);
- for (int i=0; i < sttThreads.getCount(); i++)
+ for (int i=0; i < sttThreads.getCount(); i++)
{
ThreadData* T = &sttThreads[i];
if (T->mType == SERVER_FILETRANS && T->hWaitEvent != INVALID_HANDLE_VALUE)
{
- if ((T->mInitialContactWLID && !_stricmp(T->mInitialContactWLID, wlid)) ||
+ if ((T->mInitialContactWLID && !_stricmp(T->mInitialContactWLID, wlid)) ||
(T->mJoinedContactsWLID.getCount() && !_stricmp(T->mJoinedContactsWLID[0], wlid)) ||
(T->mJoinedIdentContactsWLID.getCount() && !_stricmp(T->mJoinedIdentContactsWLID[0], wlid)))
ReleaseSemaphore(T->hWaitEvent, 1, NULL);
@@ -502,17 +504,17 @@ ThreadData* CMsnProto::MSN_GetOtherContactThread(ThreadData* thread) ThreadData* result = NULL;
EnterCriticalSection(&sttLock);
- for (int i=0; i < sttThreads.getCount(); i++)
+ for (int i=0; i < sttThreads.getCount(); i++)
{
ThreadData* T = &sttThreads[i];
if (T->mJoinedContactsWLID.getCount() == 0 || T->s == NULL)
continue;
- if (T != thread && _stricmp(T->mJoinedContactsWLID[0], thread->mJoinedContactsWLID[0]) == 0)
+ if (T != thread && _stricmp(T->mJoinedContactsWLID[0], thread->mJoinedContactsWLID[0]) == 0)
{
result = T;
break;
- }
+ }
}
LeaveCriticalSection(&sttLock);
@@ -525,18 +527,18 @@ ThreadData* CMsnProto::MSN_GetUnconnectedThread(const char* wlid, TInfoType typ EnterCriticalSection(&sttLock);
char* szEmail = (char*)wlid;
-
+
if (type == SERVER_SWITCHBOARD && strchr(wlid, ';'))
parseWLID(NEWSTR_ALLOCA(wlid), NULL, &szEmail, NULL);
- for (int i=0; i < sttThreads.getCount(); i++)
+ for (int i=0; i < sttThreads.getCount(); i++)
{
ThreadData* T = &sttThreads[i];
- if (T->mType == type && T->mInitialContactWLID && _stricmp(T->mInitialContactWLID, szEmail) == 0)
+ if (T->mType == type && T->mInitialContactWLID && _stricmp(T->mInitialContactWLID, szEmail) == 0)
{
result = T;
break;
- }
+ }
}
LeaveCriticalSection(&sttLock);
@@ -586,14 +588,14 @@ ThreadData* CMsnProto::MSN_GetThreadByConnection(HANDLE s) ThreadData* tResult = NULL;
EnterCriticalSection(&sttLock);
- for (int i=0; i < sttThreads.getCount(); i++)
+ for (int i=0; i < sttThreads.getCount(); i++)
{
ThreadData* T = &sttThreads[i];
- if (T->s == s)
+ if (T->s == s)
{
tResult = T;
break;
- }
+ }
}
LeaveCriticalSection(&sttLock);
@@ -605,14 +607,14 @@ ThreadData* CMsnProto::MSN_GetThreadByPort(WORD wPort) ThreadData* result = NULL;
EnterCriticalSection(&sttLock);
- for (int i=0; i < sttThreads.getCount(); i++)
+ for (int i=0; i < sttThreads.getCount(); i++)
{
ThreadData* T = &sttThreads[i];
if (T->mIncomingPort == wPort)
{
result = T;
break;
- }
+ }
}
LeaveCriticalSection(&sttLock);
@@ -634,7 +636,7 @@ ThreadData::~ThreadData() {
int i;
- if (s != NULL)
+ if (s != NULL)
{
proto->MSN_DebugLog("Closing connection handle %08X", s);
Netlib_CloseHandle(s);
@@ -645,7 +647,7 @@ ThreadData::~ThreadData() Netlib_CloseHandle(mIncomingBoundPort);
}
- if (mMsnFtp != NULL)
+ if (mMsnFtp != NULL)
{
delete mMsnFtp;
mMsnFtp = NULL;
@@ -654,7 +656,7 @@ ThreadData::~ThreadData() if (hWaitEvent != INVALID_HANDLE_VALUE)
CloseHandle(hWaitEvent);
- if (mTimerId != 0)
+ if (mTimerId != 0)
KillTimer(NULL, mTimerId);
if (mType == SERVER_SWITCHBOARD)
@@ -662,7 +664,7 @@ ThreadData::~ThreadData() for (i=0; i<mJoinedContactsWLID.getCount(); ++i)
{
const char* wlid = mJoinedContactsWLID[i];
- HANDLE hContact = proto->MSN_HContactFromEmail(wlid);
+ HANDLE hContact = proto->MSN_HContactFromEmail(wlid);
int temp_status = proto->getWord(hContact, "Status", ID_STATUS_OFFLINE);
if (temp_status == ID_STATUS_INVISIBLE && proto->MSN_GetThreadByContact(wlid) == NULL)
proto->setWord(hContact, "Status", ID_STATUS_OFFLINE);
@@ -675,10 +677,10 @@ ThreadData::~ThreadData() const char* wlid = NEWSTR_ALLOCA(mInitialContactWLID);
mir_free(mInitialContactWLID); mInitialContactWLID = NULL;
- if (proto && mType == SERVER_P2P_DIRECT)
+ if (proto && mType == SERVER_P2P_DIRECT)
proto->p2p_clearDormantSessions();
- if (wlid != NULL && mType == SERVER_SWITCHBOARD &&
+ if (wlid != NULL && mType == SERVER_SWITCHBOARD &&
proto->MSN_GetThreadByContact(wlid) == NULL &&
proto->MSN_GetUnconnectedThread(wlid) == NULL)
{
@@ -723,7 +725,7 @@ void ThreadData::processSessionData(const char* xMsgr, const char* xHost) char* tDelim = (char*)strchr(xMsgr, ';');
if (tDelim == NULL)
- return;
+ return;
*tDelim = 0; tDelim += 2;
@@ -803,14 +805,14 @@ BYTE* HReadBuffer::surelyRead(size_t parBytes) if ((startOffset + parBytes) > bufferSize)
{
- if (totalDataSize > startOffset)
+ if (totalDataSize > startOffset)
memmove(buffer, buffer + startOffset, (totalDataSize -= startOffset));
else
totalDataSize = 0;
startOffset = 0;
- if (parBytes > bufferSize)
+ if (parBytes > bufferSize)
{
owner->proto->MSN_DebugLog("HReadBuffer::surelyRead: not enough memory, %d %d %d", parBytes, bufferSize, startOffset);
return NULL;
diff --git a/protocols/MSN/src/msn_useropts.cpp b/protocols/MSN/src/msn_useropts.cpp index d8d247cf4b..24b04705e0 100644 --- a/protocols/MSN/src/msn_useropts.cpp +++ b/protocols/MSN/src/msn_useropts.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -26,12 +28,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /*
INT_PTR CALLBACK MsnDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
+ switch (msg)
{
case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
-
+
const HANDLE hContact = (HANDLE)lParam;
SetDlgItemInt(hwndDlg, IDC_MOBILE, DBGetContactSettingByte(hContact, m_szModuleName, "MobileAllowed", 0), 0);
@@ -59,7 +61,7 @@ int MsnOnDetailsInit(WPARAM wParam, LPARAM lParam) if (!MSN_IsMyContact(hContact))
return 0;
- if (getDword(hContact, "FlagBits", 0))
+ if (getDword(hContact, "FlagBits", 0))
{
OPTIONSDIALOGPAGE odp = {0};
@@ -72,6 +74,6 @@ int MsnOnDetailsInit(WPARAM wParam, LPARAM lParam) UserInfo_AddPage(wParam, &odp);
}
-*/
+*/
return 0;
}
diff --git a/protocols/MSN/src/msn_ws.cpp b/protocols/MSN/src/msn_ws.cpp index 653343e7f8..5833dbf626 100644 --- a/protocols/MSN/src/msn_ws.cpp +++ b/protocols/MSN/src/msn_ws.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) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -30,14 +32,14 @@ int ThreadData::send(const char data[], size_t datalen) resetTimeout();
- if (proto->usingGateway && !(mType == SERVER_FILETRANS || mType == SERVER_P2P_DIRECT))
+ if (proto->usingGateway && !(mType == SERVER_FILETRANS || mType == SERVER_P2P_DIRECT))
{
mGatewayTimeout = 2;
CallService(MS_NETLIB_SETPOLLINGTIMEOUT, WPARAM(s), mGatewayTimeout);
}
int rlen = CallService(MS_NETLIB_SEND, (WPARAM)s, (LPARAM)&nlb);
- if (rlen == SOCKET_ERROR)
+ if (rlen == SOCKET_ERROR)
{
// should really also check if sendlen is the same as datalen
proto->MSN_DebugLog("Send failed: %d", WSAGetLastError());
@@ -63,7 +65,7 @@ bool ThreadData::isTimeout(void) {
res = !proto->usingGateway;
}
- else if (mJoinedContactsWLID.getCount() <= 1 || mChatID[0] == 0)
+ else if (mJoinedContactsWLID.getCount() <= 1 || mChatID[0] == 0)
{
HANDLE hContact = getContactHandle();
@@ -71,13 +73,13 @@ bool ThreadData::isTimeout(void) res = true;
else if (proto->p2p_getThreadSession(hContact, mType) != NULL)
res = false;
- else if (mType == SERVER_SWITCHBOARD)
+ else if (mType == SERVER_SWITCHBOARD)
{
res = MSN_MsgWndExist(hContact);
- if (res)
- {
+ if (res)
+ {
WORD status = proto->getWord(hContact, "Status", ID_STATUS_OFFLINE);
- if ((status == ID_STATUS_OFFLINE || status == ID_STATUS_INVISIBLE || proto->m_iStatus == ID_STATUS_INVISIBLE))
+ if ((status == ID_STATUS_OFFLINE || status == ID_STATUS_INVISIBLE || proto->m_iStatus == ID_STATUS_INVISIBLE))
res = false;
}
}
@@ -85,21 +87,21 @@ bool ThreadData::isTimeout(void) res = true;
}
- if (res)
+ if (res)
{
bool sbsess = mType == SERVER_SWITCHBOARD;
proto->MSN_DebugLog("Dropping the idle %s due to inactivity", sbsess ? "switchboard" : "p2p");
if (!sbsess || termPending) return true;
- if (proto->getByte("EnableSessionPopup", 0))
+ if (proto->getByte("EnableSessionPopup", 0))
{
HANDLE hContact = NULL;
if (mJoinedContactsWLID.getCount())
hContact = proto->MSN_HContactFromEmail(mJoinedContactsWLID[0]);
else if (mInitialContactWLID)
hContact = proto->MSN_HContactFromEmail(mInitialContactWLID);
-
+
if (hContact)
proto->MSN_ShowPopup(hContact, TranslateT("Chat session dropped due to inactivity"), 0);
}
@@ -117,7 +119,7 @@ int ThreadData::recv(char* data, size_t datalen) {
NETLIBBUFFER nlb = { data, (int)datalen, 0 };
- if (!proto->usingGateway)
+ if (!proto->usingGateway)
{
resetTimeout();
NETLIBSELECT nls = { 0 };
@@ -128,12 +130,12 @@ int ThreadData::recv(char* data, size_t datalen) for (;;)
{
int ret = CallService(MS_NETLIB_SELECT, 0, (LPARAM)&nls);
- if (ret < 0)
+ if (ret < 0)
{
proto->MSN_DebugLog("Connection abortively closed, error %d", WSAGetLastError());
return ret;
}
- else if (ret == 0)
+ else if (ret == 0)
{
if (isTimeout()) return 0;
}
@@ -144,13 +146,13 @@ int ThreadData::recv(char* data, size_t datalen) LBL_RecvAgain:
int ret = CallService(MS_NETLIB_RECV, (WPARAM)s, (LPARAM)&nlb);
- if (ret == 0)
+ if (ret == 0)
{
proto->MSN_DebugLog("Connection closed gracefully");
return 0;
}
- if (ret < 0)
+ if (ret < 0)
{
proto->MSN_DebugLog("Connection abortively closed, error %d", WSAGetLastError());
return ret;
@@ -158,7 +160,7 @@ LBL_RecvAgain: if (proto->usingGateway)
{
- if (ret == 1 && *data == 0)
+ if (ret == 1 && *data == 0)
{
if (sessionClosed || isTimeout()) return 0;
if ((mGatewayTimeout += 2) > 20) mGatewayTimeout = 20;
@@ -166,7 +168,7 @@ LBL_RecvAgain: CallService(MS_NETLIB_SETPOLLINGTIMEOUT, WPARAM(s), mGatewayTimeout);
goto LBL_RecvAgain;
}
- else
+ else
{
resetTimeout();
mGatewayTimeout = 1;
diff --git a/protocols/MSN/src/stdafx.cpp b/protocols/MSN/src/stdafx.cpp index 6607524f0f..6a827b56bd 100644 --- a/protocols/MSN/src/stdafx.cpp +++ b/protocols/MSN/src/stdafx.cpp @@ -1,5 +1,5 @@ /*
-Copyright (C) 2012 Miranda NG team (http://miranda-ng.org)
+Copyright (C) 2012-2013 Miranda NG team (http://miranda-ng.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
diff --git a/protocols/MSN/src/version.h b/protocols/MSN/src/version.h index ecb8d1bdf2..4796dac116 100644 --- a/protocols/MSN/src/version.h +++ b/protocols/MSN/src/version.h @@ -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) 2008-2009 Boris Krasnovskiy.
This program is free software; you can redistribute it and/or
|