summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/MRA/res/resource.rc2
-rw-r--r--protocols/MRA/src/Mra.cpp7
-rw-r--r--protocols/MRA/src/Mra.h1
-rw-r--r--protocols/MRA/src/MraAvatars.cpp2
-rw-r--r--protocols/MRA/src/MraConstans.h1
-rw-r--r--protocols/MRA/src/MraMPop.cpp148
-rw-r--r--protocols/MRA/src/MraMPop.h2
-rw-r--r--protocols/MRA/src/MraProto.cpp2
-rw-r--r--protocols/MRA/src/MraProto.h2
-rw-r--r--protocols/MRA/src/MraSendCommand.cpp16
-rw-r--r--protocols/MRA/src/Mra_menus.cpp63
-rw-r--r--protocols/MRA/src/Mra_options.cpp2
-rw-r--r--protocols/MRA/src/Mra_proto.cpp20
-rw-r--r--protocols/MRA/src/resource.h1
14 files changed, 146 insertions, 123 deletions
diff --git a/protocols/MRA/res/resource.rc b/protocols/MRA/res/resource.rc
index 0cf5df058e..5928f0ea9d 100644
--- a/protocols/MRA/res/resource.rc
+++ b/protocols/MRA/res/resource.rc
@@ -83,6 +83,8 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,72,263,8
CONTROL "Automatically grant authorization to new users",IDC_AUTO_AUTH_GRAND_NEW_USERS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,83,263,8
+ CONTROL "Automatically authorization on mail.ru web services",IDC_AUTO_AUTH_ON_WEB_SVCS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,94,263,8
CONTROL "Notify me when a message delivery has failed",IDC_SLOWSEND,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,107,263,8
CONTROL "Notify about new mail if increment",IDC_INCREMENTAL_NEW_MAIL_NOTIFY,
diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp
index 944b965fda..498a701dc5 100644
--- a/protocols/MRA/src/Mra.cpp
+++ b/protocols/MRA/src/Mra.cpp
@@ -19,7 +19,6 @@ PLUGININFOEX pluginInfoEx = {
{ 0xe7c48bab, 0x8ace, 0x4cb3, { 0x84, 0x46, 0xd4, 0xb7, 0x34, 0x81, 0xf4, 0x97 } }
};
-HANDLE g_hHeap;
HINSTANCE g_hInstance;
HMODULE g_hDLLXStatusIcons;
HICON g_hMainIcon;
@@ -37,13 +36,11 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID Reserved)
switch (dwReason) {
case DLL_PROCESS_ATTACH:
g_hInstance = hInstance;
- g_hHeap = HeapCreate(0, 0, 0);
DisableThreadLibraryCalls(hInstance);
break;
-
case DLL_PROCESS_DETACH:
- HeapDestroy(g_hHeap);
- g_hHeap = NULL;
+ /* Nothink to do. */
+ break;
}
return TRUE;
diff --git a/protocols/MRA/src/Mra.h b/protocols/MRA/src/Mra.h
index c76e9cc70c..b2276778f4 100644
--- a/protocols/MRA/src/Mra.h
+++ b/protocols/MRA/src/Mra.h
@@ -177,7 +177,6 @@ extern IconItem gdiExtraStatusIconsItems[];
/////////////////////////////////////////////////////////////////////////////////////////
// plugin options
-extern HANDLE g_hHeap;
extern HINSTANCE g_hInstance;
extern HMODULE g_hDLLXStatusIcons;
extern HICON g_hMainIcon;
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp
index da45ef5852..ad70e838cc 100644
--- a/protocols/MRA/src/MraAvatars.cpp
+++ b/protocols/MRA/src/MraAvatars.cpp
@@ -529,7 +529,7 @@ DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFl
if (hAvatarsQueueHandle)
if (db_get_b(NULL, MRA_AVT_SECT_NAME, "Enable", MRA_AVT_DEFAULT_ENABLE))
- if (IsContactChatAgent(hContact) == FALSE) {
+ if (!IsContactChatAgent(hContact)) {
// not @chat.agent conference
BOOL bQueueAdd = TRUE;// check for updates
MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hAvatarsQueueHandle;
diff --git a/protocols/MRA/src/MraConstans.h b/protocols/MRA/src/MraConstans.h
index bb9808bcd1..493206d0a2 100644
--- a/protocols/MRA/src/MraConstans.h
+++ b/protocols/MRA/src/MraConstans.h
@@ -155,6 +155,7 @@ static const LPSTR lpcszMailRuDomains[] =
#define MRA_DEFAULT_AUTO_AUTH_REQ_ON_LOGON FALSE
#define MRA_DEFAULT_AUTO_AUTH_GRAND_IN_CLIST FALSE
#define MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS FALSE
+#define MRA_DEFAULT_AUTO_AUTH_ON_WEB_SVCS TRUE
#define MRA_DEFAULT_SLOW_SEND TRUE
#define MRA_DEFAULT_CVT_SMILES_TO_TAGS TRUE
#define MRA_DEFAULT_MIRVER_RAW FALSE // hidden option
diff --git a/protocols/MRA/src/MraMPop.cpp b/protocols/MRA/src/MraMPop.cpp
index 300b20114b..18667f1d72 100644
--- a/protocols/MRA/src/MraMPop.cpp
+++ b/protocols/MRA/src/MraMPop.cpp
@@ -4,14 +4,14 @@
// MPOP_SESSION
struct MRA_MPOP_SESSION_QUEUE : public FIFO_MT
{
- bool bKeyValid;
- LPSTR lpszMPOPKey;
- size_t dwMPOPKeySize;
+ bool bKeyValid; /* lpszMPOPKey contain valid key. */
+ LPSTR lpszMPOPKey; /* Key for web auth on mail.ru services. */
+ size_t dwMPOPKeySize; /* Key size. */
};
struct MRA_MPOP_SESSION_QUEUE_ITEM : public FIFO_MT_ITEM
{
- LPSTR lpszUrl;
+ LPSTR lpszUrl; /* Url to open. */
size_t dwUrlSize;
};
@@ -20,13 +20,15 @@ void MraMPopSessionQueueClear(HANDLE hMPopSessionQueue);
DWORD MraMPopSessionQueueInitialize(HANDLE *phMPopSessionQueue)
{
if (!phMPopSessionQueue)
+ return ERROR_INVALID_HANDLE;
+ if ((*phMPopSessionQueue))
return ERROR_ALREADY_INITIALIZED;
MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)mir_calloc(sizeof(MRA_MPOP_SESSION_QUEUE));
if (!pmpsqMPopSessionQueue)
return GetLastError();
- pmpsqMPopSessionQueue->bKeyValid = FALSE;
+ pmpsqMPopSessionQueue->bKeyValid = false;
pmpsqMPopSessionQueue->lpszMPOPKey = NULL;
pmpsqMPopSessionQueue->dwMPOPKeySize = 0;
FifoMTInitialize(pmpsqMPopSessionQueue, 0);
@@ -36,68 +38,63 @@ DWORD MraMPopSessionQueueInitialize(HANDLE *phMPopSessionQueue)
void MraMPopSessionQueueClear(HANDLE hMPopSessionQueue)
{
- if (hMPopSessionQueue) {
- MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue;
- pmpsqMPopSessionQueue->bKeyValid = FALSE;
- mir_free(pmpsqMPopSessionQueue->lpszMPOPKey);
- pmpsqMPopSessionQueue->dwMPOPKeySize = 0;
+ if (!hMPopSessionQueue)
+ return;
- MRA_MPOP_SESSION_QUEUE_ITEM *pmpsqi;
- while ( !FifoMTItemPop(pmpsqMPopSessionQueue, NULL, (LPVOID*)&pmpsqi))
- mir_free(pmpsqi);
- }
-}
+ MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue;
+ pmpsqMPopSessionQueue->bKeyValid = false;
+ mir_free(pmpsqMPopSessionQueue->lpszMPOPKey);
+ pmpsqMPopSessionQueue->lpszMPOPKey = NULL;
+ pmpsqMPopSessionQueue->dwMPOPKeySize = 0;
-void CMraProto::MraMPopSessionQueueFlush(HANDLE hMPopSessionQueue)
-{
- if (hMPopSessionQueue) {
- MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue;
- while ( FifoMTGetCount(pmpsqMPopSessionQueue)) {
- MraMPopSessionQueueSetNewMPopKey(hMPopSessionQueue, "");
- MraMPopSessionQueueStart(hMPopSessionQueue);
- }
- }
+ MRA_MPOP_SESSION_QUEUE_ITEM *pmpsqi;
+ while ( !FifoMTItemPop(pmpsqMPopSessionQueue, NULL, (LPVOID*)&pmpsqi))
+ mir_free(pmpsqi);
}
void MraMPopSessionQueueDestroy(HANDLE hMPopSessionQueue)
{
- if (hMPopSessionQueue) {
- MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue;
- MraMPopSessionQueueClear(hMPopSessionQueue);
- FifoMTDestroy(pmpsqMPopSessionQueue);
- mir_free(pmpsqMPopSessionQueue);
- }
+ if (!hMPopSessionQueue)
+ return;
+
+ MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue;
+ MraMPopSessionQueueClear(hMPopSessionQueue);
+ FifoMTDestroy(pmpsqMPopSessionQueue);
+ mir_free(pmpsqMPopSessionQueue);
}
-DWORD CMraProto::MraMPopSessionQueueAddUrl(HANDLE hMPopSessionQueue, const CMStringA &szUrl)
+DWORD CMraProto::MraMPopSessionQueueAddUrl(HANDLE hMPopSessionQueue, const CMStringA &lpszUrl)
{
- if (!hMPopSessionQueue || szUrl.IsEmpty())
+ if (!hMPopSessionQueue)
return ERROR_INVALID_HANDLE;
-
+ if (lpszUrl.IsEmpty())
+ return ERROR_INVALID_DATA;
MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue;
- MRA_MPOP_SESSION_QUEUE_ITEM *pmpsqi = (MRA_MPOP_SESSION_QUEUE_ITEM*)mir_calloc((sizeof(MRA_MPOP_SESSION_QUEUE_ITEM)+szUrl.GetLength()+sizeof(size_t)));
+ MRA_MPOP_SESSION_QUEUE_ITEM *pmpsqi;
+
+ if (!getByte("AutoAuthOnWebServices", MRA_DEFAULT_AUTO_AUTH_ON_WEB_SVCS) || !m_bLoggedIn) { /* Open without web auth. / Not loggedIn. */
+ CallService(MS_UTILS_OPENURL, TRUE, (LPARAM)lpszUrl.c_str());
+ return NO_ERROR;
+ }
+ /* Add to queue. */
+ pmpsqi = (MRA_MPOP_SESSION_QUEUE_ITEM*)mir_calloc((sizeof(MRA_MPOP_SESSION_QUEUE_ITEM) + lpszUrl.GetLength() + sizeof(size_t)));
if (!pmpsqi)
return GetLastError();
- pmpsqi->dwUrlSize = szUrl.GetLength();
- pmpsqi->lpszUrl = (LPSTR)(pmpsqi+1);
- memmove(pmpsqi->lpszUrl, szUrl, szUrl.GetLength());
+ pmpsqi->dwUrlSize = lpszUrl.GetLength();
+ pmpsqi->lpszUrl = (LPSTR)(pmpsqi + 1);
+ memcpy(pmpsqi->lpszUrl, lpszUrl, lpszUrl.GetLength());
FifoMTItemPush(pmpsqMPopSessionQueue, pmpsqi, (LPVOID)pmpsqi);
- if (pmpsqMPopSessionQueue->bKeyValid)
- return MraMPopSessionQueueStart(hMPopSessionQueue);
-
- if (m_bLoggedIn)
- MraSendCMD(MRIM_CS_GET_MPOP_SESSION, NULL, 0);
- else
- MraMPopSessionQueueFlush(hMPopSessionQueue);
-
+ MraMPopSessionQueueStart(hMPopSessionQueue);
return NO_ERROR;
}
DWORD CMraProto::MraMPopSessionQueueAddUrlAndEMail(HANDLE hMPopSessionQueue, const CMStringA &lpszUrl, CMStringA &szEmail)
{
- if (!hMPopSessionQueue || lpszUrl.IsEmpty() || szEmail.IsEmpty())
+ if (!hMPopSessionQueue)
return ERROR_INVALID_HANDLE;
+ if (lpszUrl.IsEmpty() || szEmail.IsEmpty())
+ return ERROR_INVALID_DATA;
szEmail.MakeLower();
@@ -110,27 +107,52 @@ DWORD CMraProto::MraMPopSessionQueueAddUrlAndEMail(HANDLE hMPopSessionQueue, con
return MraMPopSessionQueueAddUrl(hMPopSessionQueue, szUrl);
}
-DWORD CMraProto::MraMPopSessionQueueStart(HANDLE hMPopSessionQueue)
+void CMraProto::MraMPopSessionQueueStart(HANDLE hMPopSessionQueue)
{
if (!hMPopSessionQueue)
- return ERROR_INVALID_HANDLE;
+ return;
MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue;
MRA_MPOP_SESSION_QUEUE_ITEM *pmpsqi;
- if (pmpsqMPopSessionQueue->bKeyValid == TRUE)
- if ( FifoMTItemPop(pmpsqMPopSessionQueue, NULL, (LPVOID*)&pmpsqi) == NO_ERROR) {
- CMStringA szUrl, szEmail;
- if (mraGetStringA(NULL, "e-mail", szEmail)) {
- pmpsqMPopSessionQueue->bKeyValid = FALSE;
- szEmail.MakeLower();
- szUrl.Format(MRA_MPOP_AUTH_URL, szEmail, pmpsqMPopSessionQueue->lpszMPOPKey, pmpsqi->lpszUrl);
- CallService(MS_UTILS_OPENURL, TRUE, (LPARAM)szUrl.c_str());
- debugLogA("Opening URL: %s\n", szUrl);
+ if (!getByte("AutoAuthOnWebServices", MRA_DEFAULT_AUTO_AUTH_ON_WEB_SVCS) || !m_bLoggedIn) { /* Open without web auth. / Not loggedIn. */
+ MraMPopSessionQueueFlush(hMPopSessionQueue);
+ return;
+ }
+
+ while ( FifoMTGetCount(pmpsqMPopSessionQueue)) {
+ if (!pmpsqMPopSessionQueue->bKeyValid) { /* We have no key, try to get one. */
+ if (0 == MraSendCMD(MRIM_CS_GET_MPOP_SESSION, NULL, 0)) /* Fail to send. */
+ MraMPopSessionQueueFlush(hMPopSessionQueue);
+ return;
+ }
+
+ if ( FifoMTItemPop(pmpsqMPopSessionQueue, NULL, (LPVOID*)&pmpsqi) == NO_ERROR) {
+ CMStringA szUrl, szEmail;
+ if (mraGetStringA(NULL, "e-mail", szEmail)) {
+ pmpsqMPopSessionQueue->bKeyValid = false;
+ szEmail.MakeLower();
+ szUrl.Format(MRA_MPOP_AUTH_URL, szEmail, pmpsqMPopSessionQueue->lpszMPOPKey, pmpsqi->lpszUrl);
+ CallService(MS_UTILS_OPENURL, TRUE, (LPARAM)szUrl.c_str());
+ debugLogA("Opening URL: %s\n", szUrl);
+ }
+ mir_free(pmpsqi);
}
+ }
+}
+
+void CMraProto::MraMPopSessionQueueFlush(HANDLE hMPopSessionQueue)
+{
+ if (!hMPopSessionQueue)
+ return;
+
+ MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue;
+ MRA_MPOP_SESSION_QUEUE_ITEM *pmpsqi;
+
+ while ( FifoMTItemPop(pmpsqMPopSessionQueue, NULL, (LPVOID*)&pmpsqi) == NO_ERROR) {
+ CallService(MS_UTILS_OPENURL, TRUE, (LPARAM)pmpsqi->lpszUrl);
mir_free(pmpsqi);
}
- return NO_ERROR;
}
DWORD MraMPopSessionQueueSetNewMPopKey(HANDLE hMPopSessionQueue, const CMStringA &szKey)
@@ -139,20 +161,20 @@ DWORD MraMPopSessionQueueSetNewMPopKey(HANDLE hMPopSessionQueue, const CMStringA
return ERROR_INVALID_HANDLE;
MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue;
- if (pmpsqMPopSessionQueue->dwMPOPKeySize < szKey.GetLength() || szKey.IsEmpty()) {
+ if (pmpsqMPopSessionQueue->dwMPOPKeySize < (size_t)szKey.GetLength() || szKey.IsEmpty()) {
mir_free(pmpsqMPopSessionQueue->lpszMPOPKey);
- pmpsqMPopSessionQueue->lpszMPOPKey = (LPSTR)mir_calloc(szKey.GetLength()+sizeof(size_t));
+ pmpsqMPopSessionQueue->lpszMPOPKey = (LPSTR)mir_calloc(szKey.GetLength() + sizeof(size_t));
}
if (pmpsqMPopSessionQueue->lpszMPOPKey) {
- pmpsqMPopSessionQueue->bKeyValid = TRUE;
+ pmpsqMPopSessionQueue->bKeyValid = true;
pmpsqMPopSessionQueue->dwMPOPKeySize = szKey.GetLength();
- memmove(pmpsqMPopSessionQueue->lpszMPOPKey, szKey, szKey.GetLength());
+ memcpy(pmpsqMPopSessionQueue->lpszMPOPKey, szKey, szKey.GetLength());
(*(pmpsqMPopSessionQueue->lpszMPOPKey + szKey.GetLength())) = 0;
return NO_ERROR;
}
- pmpsqMPopSessionQueue->bKeyValid = FALSE;
+ pmpsqMPopSessionQueue->bKeyValid = false;
pmpsqMPopSessionQueue->lpszMPOPKey = NULL;
pmpsqMPopSessionQueue->dwMPOPKeySize = 0;
return GetLastError();
diff --git a/protocols/MRA/src/MraMPop.h b/protocols/MRA/src/MraMPop.h
index ee0ede280f..a0a1ee348e 100644
--- a/protocols/MRA/src/MraMPop.h
+++ b/protocols/MRA/src/MraMPop.h
@@ -5,7 +5,7 @@
#pragma once
DWORD MraMPopSessionQueueInitialize (HANDLE *phMPopSessionQueue);
-void MraMPopSessionQueueDestroy (HANDLE hMPopSessionQueue);
+void MraMPopSessionQueueDestroy (HANDLE hMPopSessionQueue);
DWORD MraMPopSessionQueueSetNewMPopKey (HANDLE hMPopSessionQueue, const CMStringA &szKey);
#endif // !defined(AFX_MRA_MPOP_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_)
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp
index 13e7f9f666..f6eea6903a 100644
--- a/protocols/MRA/src/MraProto.cpp
+++ b/protocols/MRA/src/MraProto.cpp
@@ -15,7 +15,7 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) :
InitializeCriticalSectionAndSpinCount(&csCriticalSectionSend, 0);
MraSendQueueInitialize(0, &hSendQueueHandle);
MraFilesQueueInitialize(0, &hFilesQueueHandle);
- MraMPopSessionQueueInitialize(&hMPopSessionQueue);
+ MraMPopSessionQueueInitialize(&hMPopSessionQueue);//getByte("AutoAuthOnWebServices", MRA_DEFAULT_AUTO_AUTH_ON_WEB_SVCS)
MraAvatarsQueueInitialize(&hAvatarsQueueHandle);
CreateProtoService(PS_SETCUSTOMSTATUSEX, &CMraProto::MraSetXStatusEx);
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h
index c5d642b46c..fe54da40f7 100644
--- a/protocols/MRA/src/MraProto.h
+++ b/protocols/MRA/src/MraProto.h
@@ -294,7 +294,7 @@ struct CMraProto : public PROTO<CMraProto>
DWORD MraMPopSessionQueueAddUrl(HANDLE hMPopSessionQueue, const CMStringA &szUrl);
DWORD MraMPopSessionQueueAddUrlAndEMail(HANDLE hMPopSessionQueue, const CMStringA &, CMStringA &szEmail);
- DWORD MraMPopSessionQueueStart(HANDLE hMPopSessionQueue);
+ void MraMPopSessionQueueStart(HANDLE hMPopSessionQueue);
void MraMPopSessionQueueFlush(HANDLE hMPopSessionQueue);
size_t MraFilesQueueGetLocalAddressesList(LPSTR lpszBuff, size_t dwBuffSize, DWORD dwPort);
diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp
index 27bd038607..37341ba126 100644
--- a/protocols/MRA/src/MraSendCommand.cpp
+++ b/protocols/MRA/src/MraSendCommand.cpp
@@ -317,11 +317,11 @@ HANDLE CMraProto::MraWPRequestW(MCONTACT hContact, DWORD dwAckType, DWORD dwRequ
OutBuffer buf;
CMStringA tmp;
- if (GetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_USER)) { buf.SetUL(MRIM_CS_WP_REQUEST_PARAM_USER);buf.SetLPSLowerCase(szUser); }
- if (GetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_DOMAIN)) { buf.SetUL(MRIM_CS_WP_REQUEST_PARAM_DOMAIN);buf.SetLPSLowerCase(szDomain); }
- if (GetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_NICKNAME)) { buf.SetUL(MRIM_CS_WP_REQUEST_PARAM_NICKNAME);buf.SetLPSW(wszNickName); }
- if (GetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_FIRSTNAME)) { buf.SetUL(MRIM_CS_WP_REQUEST_PARAM_FIRSTNAME);buf.SetLPSW(wszFirstName); }
- if (GetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_LASTNAME)) { buf.SetUL(MRIM_CS_WP_REQUEST_PARAM_LASTNAME);buf.SetLPSW(wszLastName); }
+ if (GetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_USER)) { buf.SetUL(MRIM_CS_WP_REQUEST_PARAM_USER); buf.SetLPSLowerCase(szUser); }
+ if (GetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_DOMAIN)) { buf.SetUL(MRIM_CS_WP_REQUEST_PARAM_DOMAIN); buf.SetLPSLowerCase(szDomain); }
+ if (GetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_NICKNAME)) { buf.SetUL(MRIM_CS_WP_REQUEST_PARAM_NICKNAME); buf.SetLPSW(wszNickName); }
+ if (GetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_FIRSTNAME)) { buf.SetUL(MRIM_CS_WP_REQUEST_PARAM_FIRSTNAME); buf.SetLPSW(wszFirstName); }
+ if (GetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_LASTNAME)) { buf.SetUL(MRIM_CS_WP_REQUEST_PARAM_LASTNAME); buf.SetLPSW(wszLastName); }
if (GetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_SEX)) {
tmp.Format("%lu", dwSex);
@@ -503,15 +503,15 @@ DWORD CMraProto::MraSendPacket(HANDLE m_hConnection, DWORD dwCMDNum, DWORD dwTyp
mrim_packet_header_t *pmaHeader = (mrim_packet_header_t*)lpbData;
memset(pmaHeader, 0, sizeof(mrim_packet_header_t));
pmaHeader->magic = CS_MAGIC;
- pmaHeader->proto = (PROTO_VERSION_MAJOR<<16) + PROTO_VERSION_MINOR; // Версия протокола
+ pmaHeader->proto = (PROTO_VERSION_MAJOR << 16) + PROTO_VERSION_MINOR; // Версия протокола
pmaHeader->seq = dwCMDNum;// Sequence
pmaHeader->msg = dwType;// Тип пакета
pmaHeader->dlen = dwDataSize;// Длина данных
debugLogA("Sending packet %08x\n", dwType);
- memcpy(lpbData+sizeof(mrim_packet_header_t), lpData, dwDataSize);
- return Netlib_Send(m_hConnection, (LPSTR)lpbData, (dwDataSize+sizeof(mrim_packet_header_t)), 0);
+ memcpy((lpbData + sizeof(mrim_packet_header_t)), lpData, dwDataSize);
+ return Netlib_Send(m_hConnection, (LPSTR)lpbData, (dwDataSize + sizeof(mrim_packet_header_t)), 0);
}
DWORD CMraProto::MraSendCMD(DWORD dwType, LPVOID lpData, size_t dwDataSize)
diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp
index b7a045a62f..c1a0261516 100644
--- a/protocols/MRA/src/Mra_menus.cpp
+++ b/protocols/MRA/src/Mra_menus.cpp
@@ -42,6 +42,9 @@ INT_PTR CMraProto::MraWebSearch(WPARAM wParam, LPARAM lParam)
INT_PTR CMraProto::MraUpdateAllUsersInfo(WPARAM wParam, LPARAM lParam)
{
+ if (!m_bLoggedIn)
+ return 0;
+
if (MessageBox(NULL, TranslateT("Are you sure?"), TranslateT(MRA_UPD_ALL_USERS_INFO_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
CMStringA szEmail;
@@ -67,6 +70,9 @@ INT_PTR CMraProto::MraCheckUpdatesUsersAvt(WPARAM wParam, LPARAM lParam)
INT_PTR CMraProto::MraRequestAuthForAll(WPARAM wParam, LPARAM lParam)
{
+ if (!m_bLoggedIn)
+ return 0;
+
if (MessageBox(NULL, TranslateT("Are you sure?"), TranslateT(MRA_REQ_AUTH_FOR_ALL_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
DWORD dwContactSeverFlags;
@@ -80,7 +86,7 @@ INT_PTR CMraProto::MraRequestAuthForAll(WPARAM wParam, LPARAM lParam)
INT_PTR CMraProto::MraRequestAuthorization(WPARAM hContact, LPARAM lParam)
{
- if (!hContact)
+ if (!hContact || !m_bLoggedIn)
return 0;
CMStringW wszAuthMessage;
@@ -117,9 +123,6 @@ INT_PTR CMraProto::MraGrantAuthorization(WPARAM wParam, LPARAM lParam)
INT_PTR CMraProto::MraSendPostcard(WPARAM wParam, LPARAM lParam)
{
- if (!m_bLoggedIn)
- return 0;
-
DWORD dwContactEMailCount = GetContactEMailCount(wParam, FALSE);
if (dwContactEMailCount) {
if (dwContactEMailCount == 1) {
@@ -137,9 +140,6 @@ INT_PTR CMraProto::MraSendPostcard(WPARAM wParam, LPARAM lParam)
INT_PTR CMraProto::MraViewAlbum(WPARAM wParam, LPARAM lParam)
{
- if (!m_bLoggedIn)
- return 0;
-
DWORD dwContactEMailMRCount = GetContactEMailCount(wParam, TRUE);
if (dwContactEMailMRCount) {
if (dwContactEMailMRCount == 1) {
@@ -154,9 +154,6 @@ INT_PTR CMraProto::MraViewAlbum(WPARAM wParam, LPARAM lParam)
INT_PTR CMraProto::MraReadBlog(WPARAM wParam, LPARAM lParam)
{
- if (!m_bLoggedIn)
- return 0;
-
DWORD dwContactEMailMRCount = GetContactEMailCount(wParam, TRUE);
if (dwContactEMailMRCount)
if (dwContactEMailMRCount == 1) {
@@ -184,9 +181,6 @@ INT_PTR CMraProto::MraReplyBlogStatus(WPARAM wParam, LPARAM lParam)
INT_PTR CMraProto::MraViewVideo(WPARAM wParam, LPARAM lParam)
{
- if (!m_bLoggedIn)
- return 0;
-
DWORD dwContactEMailMRCount = GetContactEMailCount(wParam, TRUE);
if (dwContactEMailMRCount) {
if (dwContactEMailMRCount == 1) {
@@ -201,9 +195,6 @@ INT_PTR CMraProto::MraViewVideo(WPARAM wParam, LPARAM lParam)
INT_PTR CMraProto::MraAnswers(WPARAM wParam, LPARAM lParam)
{
- if (!m_bLoggedIn)
- return 0;
-
DWORD dwContactEMailMRCount = GetContactEMailCount(wParam, TRUE);
if (dwContactEMailMRCount) {
if (dwContactEMailMRCount == 1) {
@@ -218,9 +209,6 @@ INT_PTR CMraProto::MraAnswers(WPARAM wParam, LPARAM lParam)
INT_PTR CMraProto::MraWorld(WPARAM wParam, LPARAM lParam)
{
- if (!m_bLoggedIn)
- return 0;
-
DWORD dwContactEMailMRCount = GetContactEMailCount(wParam, TRUE);
if (dwContactEMailMRCount) {
if (dwContactEMailMRCount == 1) {
@@ -237,51 +225,60 @@ INT_PTR CMraProto::MraWorld(WPARAM wParam, LPARAM lParam)
int CMraProto::MraRebuildContactMenu(WPARAM hContact, LPARAM lParam)
{
- BOOL bIsContactMRA, bHasEMail, bHasEMailMR, bChatAgent;
+ bool bIsContactMRA, bHasEMail, bHasEMailMR, bChatAgent;
DWORD dwContactSeverFlags = 0;
CMStringW blogStatusMsgSize;
// proto own contact
bIsContactMRA = IsContactMra(hContact);
if (bIsContactMRA) {
- bHasEMail = TRUE;
- bHasEMailMR = TRUE;
+ bHasEMail = true;
+ bHasEMailMR = true;
bChatAgent = IsContactChatAgent(hContact);
GetContactBasicInfoW(hContact, NULL, NULL, NULL, &dwContactSeverFlags, NULL, NULL, NULL, NULL);
mraGetStringW(hContact, DBSETTING_BLOGSTATUS, blogStatusMsgSize);
}
// non proto contact
- else bHasEMail = bHasEMailMR = bChatAgent = FALSE;
-
+ else {
+ bHasEMail = false;
+ bHasEMailMR = false;
+ bChatAgent = false;
+ if (!getByte(NULL, "HideMenuItemsForNonMRAContacts", MRA_DEFAULT_HIDE_MENU_ITEMS_FOR_NON_MRA))
+ if (!IsContactMraProto(hContact))// избегаем добавления менюшек в контакты других копий MRA
+ if (GetContactEMailCount(hContact, FALSE)) {
+ bHasEMail = true;
+ if (GetContactEMailCount(hContact, TRUE)) bHasEMailMR = true;
+ }
+ }
// menu root;
- Menu_ShowItem(hContactMenuRoot, bIsContactMRA);
+ Menu_ShowItem(hContactMenuRoot, bHasEMail);
//"Request authorization"
Menu_ShowItem(hContactMenuItems[0], (m_bLoggedIn && bIsContactMRA));// && (dwContactSeverFlags&CONTACT_INTFLAG_NOT_AUTHORIZED)
//"Grant authorization"
- Menu_ShowItem(hContactMenuItems[1], (m_bLoggedIn && bIsContactMRA && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[1], (m_bLoggedIn && bIsContactMRA && !bChatAgent));
//"&Send postcard"
- Menu_ShowItem(hContactMenuItems[2], (m_bLoggedIn && bHasEMail && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[2], (bHasEMail && !bChatAgent));
//"&View Album"
- Menu_ShowItem(hContactMenuItems[3], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[3], (bHasEMailMR && !bChatAgent));
//"&Read Blog"
- Menu_ShowItem(hContactMenuItems[4], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[4], (bHasEMailMR && !bChatAgent));
//"Reply Blog Status"
- Menu_ShowItem(hContactMenuItems[5], (m_bLoggedIn && blogStatusMsgSize.GetLength() && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[5], (m_bLoggedIn && blogStatusMsgSize.GetLength() && !bChatAgent));
//"View Video"
- Menu_ShowItem(hContactMenuItems[6], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[6], (bHasEMailMR && !bChatAgent));
//"Answers"
- Menu_ShowItem(hContactMenuItems[7], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[7], (bHasEMailMR && !bChatAgent));
//"World"
- Menu_ShowItem(hContactMenuItems[8], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[8], (bHasEMailMR && !bChatAgent));
//"Send &Nudge"
Menu_ShowItem(hContactMenuItems[9], (!m_heNudgeReceived) ? (m_bLoggedIn && bIsContactMRA) : 0);
diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp
index 52ffb2bbf1..d30e207549 100644
--- a/protocols/MRA/src/Mra_options.cpp
+++ b/protocols/MRA/src/Mra_options.cpp
@@ -125,6 +125,7 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L
CheckDlgButton(hWndDlg, IDC_AUTO_AUTH_REQ_ON_LOGON, ppro->getByte("AutoAuthRequestOnLogon", MRA_DEFAULT_AUTO_AUTH_REQ_ON_LOGON));
CheckDlgButton(hWndDlg, IDC_AUTO_AUTH_GRAND_IN_CLIST, ppro->getByte("AutoAuthGrandUsersInCList", MRA_DEFAULT_AUTO_AUTH_GRAND_IN_CLIST));
CheckDlgButton(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS, ppro->getByte("AutoAuthGrandNewUsers", MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS));
+ CheckDlgButton(hWndDlg, IDC_AUTO_AUTH_ON_WEB_SVCS, ppro->getByte("AutoAuthOnWebServices", MRA_DEFAULT_AUTO_AUTH_ON_WEB_SVCS));
CheckDlgButton(hWndDlg, IDC_SLOWSEND, ppro->getByte("SlowSend", MRA_DEFAULT_SLOW_SEND));
CheckDlgButton(hWndDlg, IDC_INCREMENTAL_NEW_MAIL_NOTIFY, ppro->getByte("IncrementalNewMailNotify", MRA_DEFAULT_INC_NEW_MAIL_NOTIFY));
@@ -192,6 +193,7 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L
ppro->setByte("AutoAuthRequestOnLogon", IsDlgButtonChecked(hWndDlg, IDC_AUTO_AUTH_REQ_ON_LOGON));
ppro->setByte("AutoAuthGrandUsersInCList", IsDlgButtonChecked(hWndDlg, IDC_AUTO_AUTH_GRAND_IN_CLIST));
ppro->setByte("AutoAuthGrandNewUsers", IsDlgButtonChecked(hWndDlg, IDC_AUTO_AUTH_GRAND_NEW_USERS));
+ ppro->setByte("AutoAuthOnWebServices", IsDlgButtonChecked(hWndDlg, IDC_AUTO_AUTH_ON_WEB_SVCS));
ppro->setByte("SlowSend", IsDlgButtonChecked(hWndDlg, IDC_SLOWSEND));
ppro->setByte("IncrementalNewMailNotify", IsDlgButtonChecked(hWndDlg, IDC_INCREMENTAL_NEW_MAIL_NOTIFY));
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp
index 321c314025..9fcea8eeb0 100644
--- a/protocols/MRA/src/Mra_proto.cpp
+++ b/protocols/MRA/src/Mra_proto.cpp
@@ -22,9 +22,9 @@ DWORD CMraProto::StartConnect()
MraPopupShowFromAgentW(MRA_POPUP_TYPE_WARNING, 0, TranslateT("Please, setup password in options"));
else {
InterlockedExchange((volatile LONG*)&m_dwThreadWorkerLastPingTime, GetTickCount());
- if (INVALID_HANDLE_VALUE == ForkThreadEx(&CMraProto::MraThreadProc, NULL, 0)) /* Thread create fail. */
- MraPopupShowFromAgentW(MRA_POPUP_TYPE_ERROR, 0, TranslateT("Thread create fail"));
- return 0;
+ if (INVALID_HANDLE_VALUE != ForkThreadEx(&CMraProto::MraThreadProc, NULL, 0))
+ return 0; /* OK. */
+ MraPopupShowFromAgentW(MRA_POPUP_TYPE_ERROR, 0, TranslateT("Thread create fail"));
}
InterlockedExchange((volatile LONG*)&m_dwThreadWorkerRunning, FALSE);
return ERROR_OPERATION_ABORTED;
@@ -589,13 +589,15 @@ bool CMraProto::CmdPopSession(BinBuffer &buf)
DWORD dwTemp = buf.getDword();
if (dwTemp) {
CMStringA szString; buf >> szString;
- MraMPopSessionQueueSetNewMPopKey(hMPopSessionQueue, szString);
- MraMPopSessionQueueStart(hMPopSessionQueue);
- }
- else { //error
- MraPopupShowFromAgentW(MRA_POPUP_TYPE_WARNING, 0, TranslateT("Server error: can't get MPOP key for web authorize"));
- MraMPopSessionQueueFlush(hMPopSessionQueue);
+ if (NO_ERROR == MraMPopSessionQueueSetNewMPopKey(hMPopSessionQueue, szString)) {
+ MraMPopSessionQueueStart(hMPopSessionQueue);
+ return true;
+ }
}
+ //error
+ MraPopupShowFromAgentW(MRA_POPUP_TYPE_WARNING, 0, TranslateT("Server error: can't get MPOP key for web authorize"));
+ MraMPopSessionQueueFlush(hMPopSessionQueue);
+
return true;
}
diff --git a/protocols/MRA/src/resource.h b/protocols/MRA/src/resource.h
index ce5e636e0d..eb89c48c19 100644
--- a/protocols/MRA/src/resource.h
+++ b/protocols/MRA/src/resource.h
@@ -66,6 +66,7 @@
#define IDC_FILE_SEND_ENABLE_MRIMPROXY_CONS 1015
#define IDC_AUTO_AUTH_GRAND_IN_CLIST 1015
#define IDC_AUTO_AUTH_GRAND_NEW_USERS 1016
+#define IDC_AUTO_AUTH_ON_WEB_SVCS 1017
#define IDC_OPTIONSTAB 1017
#define IDC_NEW_ACCOUNT_LINK 1018
#define IDC_LOOKUPLINK 1019