diff options
author | George Hazan <george.hazan@gmail.com> | 2015-08-18 11:47:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-08-18 11:47:58 +0000 |
commit | 914f4263b866f546311b4f8e3a95ff816770783f (patch) | |
tree | 2d078d9779b448faca946f48dadf55d120eb4c21 /protocols/MRA | |
parent | d3b77308122587707580ec1f308dbdda38c806ac (diff) |
- naming conflict;
- warning fixes;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@14985 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA')
-rw-r--r-- | protocols/MRA/src/MraAdvancedSearch.cpp | 62 | ||||
-rw-r--r-- | protocols/MRA/src/MraAvatars.cpp | 46 | ||||
-rw-r--r-- | protocols/MRA/src/MraChat.cpp | 4 | ||||
-rw-r--r-- | protocols/MRA/src/MraFilesQueue.cpp | 70 | ||||
-rw-r--r-- | protocols/MRA/src/MraIcons.cpp | 6 | ||||
-rw-r--r-- | protocols/MRA/src/MraMPop.cpp | 52 | ||||
-rw-r--r-- | protocols/MRA/src/MraProto.cpp | 8 | ||||
-rw-r--r-- | protocols/MRA/src/MraProto.h | 2 | ||||
-rw-r--r-- | protocols/MRA/src/MraSendCommand.cpp | 44 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_options.cpp | 33 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_proto.cpp | 44 |
11 files changed, 183 insertions, 188 deletions
diff --git a/protocols/MRA/src/MraAdvancedSearch.cpp b/protocols/MRA/src/MraAdvancedSearch.cpp index 42cc03beb1..a8056de463 100644 --- a/protocols/MRA/src/MraAdvancedSearch.cpp +++ b/protocols/MRA/src/MraAdvancedSearch.cpp @@ -10,50 +10,47 @@ struct FieldNames LPWSTR lpszText;
};
-
-
static const FieldNames GenderField[] =
{
- {1, LPGENT("Male")},
- {2, LPGENT("Female")},
- {-1, NULL}
+ { 1, LPGENT("Male") },
+ { 2, LPGENT("Female") },
+ { 0, NULL }
};
static const FieldNames MonthField[] =
{
- {1, LPGENT("January")},
- {2, LPGENT("February")},
- {3, LPGENT("March")},
- {4, LPGENT("April")},
- {5, LPGENT("May")},
- {6, LPGENT("June")},
- {7, LPGENT("July")},
- {8, LPGENT("August")},
- {9, LPGENT("September")},
- {10, LPGENT("October")},
- {11, LPGENT("November")},
- {12, LPGENT("December")},
- {-1, NULL}
+ { 1, LPGENT("January") },
+ { 2, LPGENT("February") },
+ { 3, LPGENT("March") },
+ { 4, LPGENT("April") },
+ { 5, LPGENT("May") },
+ { 6, LPGENT("June") },
+ { 7, LPGENT("July") },
+ { 8, LPGENT("August") },
+ { 9, LPGENT("September") },
+ { 10, LPGENT("October") },
+ { 11, LPGENT("November") },
+ { 12, LPGENT("December") },
+ { 0, NULL }
};
static const FieldNames ZodiakField[] =
{
- {1, LPGENT("Aries")},
- {2, LPGENT("Taurus")},
- {3, LPGENT("Gemini")},
- {4, LPGENT("Cancer")},
- {5, LPGENT("Leo")},
- {6, LPGENT("Virgo")},
- {7, LPGENT("Libra")},
- {8, LPGENT("Scorpio")},
- {9, LPGENT("Sagittarius")},
- {10, LPGENT("Capricorn")},
- {11, LPGENT("Aquarius")},
- {12, LPGENT("Pisces")},
- {-1, NULL}
+ { 1, LPGENT("Aries") },
+ { 2, LPGENT("Taurus") },
+ { 3, LPGENT("Gemini") },
+ { 4, LPGENT("Cancer") },
+ { 5, LPGENT("Leo") },
+ { 6, LPGENT("Virgo") },
+ { 7, LPGENT("Libra") },
+ { 8, LPGENT("Scorpio") },
+ { 9, LPGENT("Sagittarius") },
+ { 10, LPGENT("Capricorn") },
+ { 11, LPGENT("Aquarius") },
+ { 12, LPGENT("Pisces") },
+ { 0, NULL }
};
-
void ResetComboBox(HWND hWndCombo)
{
SendMessage(hWndCombo, CB_RESETCONTENT, 0, 0);
@@ -101,7 +98,6 @@ INT_PTR CALLBACK AdvancedSearchDlgProc(HWND hWndDlg, UINT message, WPARAM wParam GetLocalTime(&stTime);
ppro = (CMraProto*)lParam;
- //InitComboBox(GetDlgItem(hWndDlg, IDC_EMAIL_DOMAIN), (FieldNames*)DomainField);
HWND hWndCombo = GetDlgItem(hWndDlg, IDC_EMAIL_DOMAIN);
ResetComboBox(hWndCombo);
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index 41139cbe0f..05ccb0ba1e 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -79,12 +79,12 @@ DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle) return NO_ERROR;
}
-void CMraProto::MraAvatarsQueueClear(HANDLE hAvatarsQueueHandle)
+void CMraProto::MraAvatarsQueueClear(HANDLE hQueue)
{
- if (!hAvatarsQueueHandle)
+ if (!hQueue)
return;
- MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hAvatarsQueueHandle;
+ MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hQueue;
MRA_AVATARS_QUEUE_ITEM *pmraaqiAvatarsQueueItem;
PROTO_AVATAR_INFORMATION ai = { 0 };
@@ -97,27 +97,27 @@ void CMraProto::MraAvatarsQueueClear(HANDLE hAvatarsQueueHandle) }
}
-void CMraProto::MraAvatarsQueueSuspend(HANDLE hAvatarsQueueHandle)
+void CMraProto::MraAvatarsQueueSuspend(HANDLE hQueue)
{
- MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hAvatarsQueueHandle;
- MraAvatarsQueueClear(hAvatarsQueueHandle);
+ MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hQueue;
+ MraAvatarsQueueClear(hQueue);
for (int i = 0; i < pmraaqAvatarsQueue->iThreadsCount; i++)
SetEvent(pmraaqAvatarsQueue->hThreadEvents[i]);
}
-void CMraProto::MraAvatarsQueueDestroy(HANDLE hAvatarsQueueHandle)
+void CMraProto::MraAvatarsQueueDestroy(HANDLE hQueue)
{
- if (!hAvatarsQueueHandle)
+ if (!hQueue)
return;
- MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hAvatarsQueueHandle;
+ MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hQueue;
Netlib_CloseHandle(pmraaqAvatarsQueue->hNetlibUser);
delete pmraaqAvatarsQueue;
}
-DWORD CMraProto::MraAvatarsQueueAdd(HANDLE hAvatarsQueueHandle, DWORD dwFlags, MCONTACT hContact, DWORD *pdwAvatarsQueueID)
+DWORD CMraProto::MraAvatarsQueueAdd(HANDLE hQueue, DWORD dwFlags, MCONTACT hContact, DWORD *pdwAvatarsQueueID)
{
- MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hAvatarsQueueHandle;
+ MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hQueue;
if (pmraaqAvatarsQueue == NULL || g_bShutdown)
return ERROR_INVALID_HANDLE;
@@ -463,10 +463,10 @@ void CMraProto::MraAvatarsSetContactTime(MCONTACT hContact, LPSTR lpszValueName, delSetting(hContact, lpszValueName);
}
-DWORD CMraProto::MraAvatarsGetFileName(HANDLE hAvatarsQueueHandle, MCONTACT hContact, DWORD dwFormat, CMStringW &res)
+DWORD CMraProto::MraAvatarsGetFileName(HANDLE hQueue, MCONTACT hContact, DWORD dwFormat, CMStringW &res)
{
res.Empty();
- if (hAvatarsQueueHandle == NULL)
+ if (hQueue == NULL)
return ERROR_INVALID_HANDLE;
if (IsContactChatAgent(hContact))
@@ -498,11 +498,11 @@ DWORD CMraProto::MraAvatarsGetFileName(HANDLE hAvatarsQueueHandle, MCONTACT hCon return ERROR_INSUFFICIENT_BUFFER;
}
-DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFlags, MCONTACT hContact, DWORD *pdwAvatarsQueueID, DWORD *pdwFormat, LPTSTR lpszPath)
+DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hQueue, DWORD dwFlags, MCONTACT hContact, DWORD *pdwAvatarsQueueID, DWORD *pdwFormat, LPTSTR lpszPath)
{
DWORD dwRetCode = GAIR_NOAVATAR;
- if ( !hAvatarsQueueHandle)
+ if ( !hQueue)
return GAIR_NOAVATAR;
if ( !db_get_b(NULL, MRA_AVT_SECT_NAME, "Enable", MRA_AVT_DEFAULT_ENABLE))
return GAIR_NOAVATAR;
@@ -522,7 +522,7 @@ DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFl (*((DWORDLONG*)&ftExpireTime)) += (FILETIME_MINUTE*(DWORDLONG)db_get_dw(NULL, MRA_AVT_SECT_NAME, "CheckInterval", MRA_AVT_DEFAULT_CHK_INTERVAL));
if ((*((DWORDLONG*)&ftExpireTime)) > (*((DWORDLONG*)&ftCurrentTime)))
- if (MraAvatarsGetFileName(hAvatarsQueueHandle, hContact, GetContactAvatarFormat(hContact, PA_FORMAT_DEFAULT), wszFileName) == NO_ERROR)
+ if (MraAvatarsGetFileName(hQueue, hContact, GetContactAvatarFormat(hContact, PA_FORMAT_DEFAULT), wszFileName) == NO_ERROR)
if (IsFileExist(wszFileName)) {
// файл с аватаром существует и не устарел/не было комманды обновлять(просто запрос имени)
if (lpszPath) {
@@ -539,21 +539,21 @@ DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFl }
if (bQueueAdd || (dwFlags & GAIF_FORCE))
- if (!MraAvatarsQueueAdd(hAvatarsQueueHandle, dwFlags, hContact, pdwAvatarsQueueID)) {
+ if (!MraAvatarsQueueAdd(hQueue, dwFlags, hContact, pdwAvatarsQueueID)) {
MraAvatarsSetContactTime(hContact, "AvatarLastCheckTime", NULL);
dwRetCode = GAIR_WAITFOR;
}
return dwRetCode;
}
-DWORD CMraProto::MraAvatarsQueueGetAvatarSimple(HANDLE hAvatarsQueueHandle, DWORD dwFlags, MCONTACT hContact)
+DWORD CMraProto::MraAvatarsQueueGetAvatarSimple(HANDLE hQueue, DWORD dwFlags, MCONTACT hContact)
{
- if ( !hAvatarsQueueHandle)
+ if ( !hQueue)
return GAIR_NOAVATAR;
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = hContact;
- DWORD dwRetCode = MraAvatarsQueueGetAvatar(hAvatarsQueueHandle, dwFlags, hContact, NULL, (DWORD*)&ai.format, ai.filename);
+ DWORD dwRetCode = MraAvatarsQueueGetAvatar(hQueue, dwFlags, hContact, NULL, (DWORD*)&ai.format, ai.filename);
if (dwRetCode != GAIR_SUCCESS)
return dwRetCode;
@@ -639,15 +639,15 @@ INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wPara }
-DWORD CMraProto::MraAvatarsDeleteContactAvatarFile(HANDLE hAvatarsQueueHandle, MCONTACT hContact)
+DWORD CMraProto::MraAvatarsDeleteContactAvatarFile(HANDLE hQueue, MCONTACT hContact)
{
- if (hAvatarsQueueHandle == NULL)
+ if (hQueue == NULL)
return ERROR_INVALID_HANDLE;
DWORD dwAvatarFormat = GetContactAvatarFormat(hContact, PA_FORMAT_UNKNOWN);
if (db_get_b(NULL, MRA_AVT_SECT_NAME, "DeleteAvtOnContactDelete", MRA_DELETE_AVT_ON_CONTACT_DELETE) && dwAvatarFormat != PA_FORMAT_DEFAULT) {
CMStringW szFileName;
- if (!MraAvatarsGetFileName(hAvatarsQueueHandle, hContact, dwAvatarFormat, szFileName))
+ if (!MraAvatarsGetFileName(hQueue, hContact, dwAvatarFormat, szFileName))
return DeleteFile(szFileName);
}
return NO_ERROR;
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp index 2d63e092ce..599308abb2 100644 --- a/protocols/MRA/src/MraChat.cpp +++ b/protocols/MRA/src/MraChat.cpp @@ -79,14 +79,14 @@ void CMraProto::MraChatSessionDestroy(MCONTACT hContact) CallServiceSync(MS_GC_EVENT, WINDOW_CLEARLOG, (LPARAM)&gce);
}
-INT_PTR CMraProto::MraChatSessionEventSendByHandle(MCONTACT hContactChatSession, DWORD dwType, DWORD dwFlags, const CMStringA &lpszUID, LPCWSTR lpwszStatus, LPCWSTR lpwszMessage, DWORD_PTR dwItemData, DWORD dwTime)
+INT_PTR CMraProto::MraChatSessionEventSendByHandle(MCONTACT hContactChatSession, int iType, DWORD dwFlags, const CMStringA &lpszUID, LPCWSTR lpwszStatus, LPCWSTR lpwszMessage, DWORD_PTR dwItemData, DWORD dwTime)
{
if (!bChatExists)
return 1;
CMStringW wszID, wszUID, wszNick;
- GCDEST gcd = { m_szModuleName, 0, dwType };
+ GCDEST gcd = { m_szModuleName, 0, iType };
if (hContactChatSession) {
mraGetStringW(hContactChatSession, "e-mail", wszID);
gcd.ptszID = (LPWSTR)wszID.c_str();
diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp index 448d344c8f..cc7c1621cc 100644 --- a/protocols/MRA/src/MraFilesQueue.cpp +++ b/protocols/MRA/src/MraFilesQueue.cpp @@ -50,7 +50,7 @@ struct MRA_FILES_THREADPROC_PARAMS MRA_FILES_QUEUE_ITEM *dat;
};
-DWORD MraFilesQueueItemFindByID(HANDLE hFilesQueueHandle, DWORD dwIDRequest, MRA_FILES_QUEUE_ITEM **ppmrafqFilesQueueItem);
+DWORD MraFilesQueueItemFindByID(HANDLE hQueue, DWORD dwIDRequest, MRA_FILES_QUEUE_ITEM **ppmrafqFilesQueueItem);
void MraFilesQueueItemFree(MRA_FILES_QUEUE_ITEM *dat);
/////////////////////////////////////////////////////////////////////////////////////////
@@ -150,12 +150,12 @@ DWORD MraFilesQueueInitialize(DWORD dwSendTimeOutInterval, HANDLE *phFilesQueueH return NO_ERROR;
}
-void MraFilesQueueDestroy(HANDLE hFilesQueueHandle)
+void MraFilesQueueDestroy(HANDLE hQueue)
{
- if (!hFilesQueueHandle)
+ if (!hQueue)
return;
- MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hFilesQueueHandle;
+ MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hQueue;
MRA_FILES_QUEUE_ITEM *dat;
{
mir_cslock l(pmrafqFilesQueue->cs);
@@ -165,12 +165,12 @@ void MraFilesQueueDestroy(HANDLE hFilesQueueHandle) delete pmrafqFilesQueue;
}
-DWORD MraFilesQueueItemFindByID(HANDLE hFilesQueueHandle, DWORD dwIDRequest, MRA_FILES_QUEUE_ITEM **ppmrafqFilesQueueItem)
+DWORD MraFilesQueueItemFindByID(HANDLE hQueue, DWORD dwIDRequest, MRA_FILES_QUEUE_ITEM **ppmrafqFilesQueueItem)
{
- if (!hFilesQueueHandle)
+ if (!hQueue)
return ERROR_INVALID_HANDLE;
- MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hFilesQueueHandle;
+ MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hQueue;
MRA_FILES_QUEUE_ITEM *dat;
LIST_MT_ITERATOR lmtiIterator;
@@ -189,10 +189,10 @@ DWORD MraFilesQueueItemFindByID(HANDLE hFilesQueueHandle, DWORD dwIDRequest, MRA return ERROR_NOT_FOUND;
}
-HANDLE MraFilesQueueItemProxyByID(HANDLE hFilesQueueHandle, DWORD dwIDRequest)
+HANDLE MraFilesQueueItemProxyByID(HANDLE hQueue, DWORD dwIDRequest)
{
MRA_FILES_QUEUE_ITEM *dat;
- if (!MraFilesQueueItemFindByID(hFilesQueueHandle, dwIDRequest, &dat))
+ if (!MraFilesQueueItemFindByID(hQueue, dwIDRequest, &dat))
return dat->hMraMrimProxyData;
return NULL;
@@ -257,16 +257,16 @@ size_t CMraProto::MraFilesQueueGetLocalAddressesList(LPSTR lpszBuff, size_t dwBu return lpszCurPos - lpszBuff;
}
-DWORD CMraProto::MraFilesQueueAccept(HANDLE hFilesQueueHandle, DWORD dwIDRequest, LPCWSTR lpwszPath, size_t dwPathSize)
+DWORD CMraProto::MraFilesQueueAccept(HANDLE hQueue, DWORD dwIDRequest, LPCWSTR lpwszPath, size_t dwPathSize)
{
- if (!hFilesQueueHandle || !lpwszPath || !dwPathSize)
+ if (!hQueue || !lpwszPath || !dwPathSize)
return ERROR_INVALID_HANDLE;
- MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hFilesQueueHandle;
+ MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hQueue;
MRA_FILES_QUEUE_ITEM *dat;
mir_cslock l(pmrafqFilesQueue->cs);
- DWORD dwRetErrorCode = MraFilesQueueItemFindByID(hFilesQueueHandle, dwIDRequest, &dat);
+ DWORD dwRetErrorCode = MraFilesQueueItemFindByID(hQueue, dwIDRequest, &dat);
if (dwRetErrorCode == NO_ERROR) {
MRA_FILES_THREADPROC_PARAMS *pmftpp = (MRA_FILES_THREADPROC_PARAMS*)mir_calloc(sizeof(MRA_FILES_THREADPROC_PARAMS));
dat->lpwszPath = (LPWSTR)mir_calloc((dwPathSize*sizeof(WCHAR)));
@@ -287,16 +287,16 @@ DWORD CMraProto::MraFilesQueueAccept(HANDLE hFilesQueueHandle, DWORD dwIDRequest return dwRetErrorCode;
}
-DWORD CMraProto::MraFilesQueueCancel(HANDLE hFilesQueueHandle, DWORD dwIDRequest, BOOL bSendDecline)
+DWORD CMraProto::MraFilesQueueCancel(HANDLE hQueue, DWORD dwIDRequest, BOOL bSendDecline)
{
- if (!hFilesQueueHandle)
+ if (!hQueue)
return ERROR_INVALID_HANDLE;
- MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hFilesQueueHandle;
+ MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hQueue;
MRA_FILES_QUEUE_ITEM *dat;
mir_cslock l(pmrafqFilesQueue->cs);
- DWORD dwRetErrorCode = MraFilesQueueItemFindByID(hFilesQueueHandle, dwIDRequest, &dat);
+ DWORD dwRetErrorCode = MraFilesQueueItemFindByID(hQueue, dwIDRequest, &dat);
if (dwRetErrorCode == NO_ERROR) { //***deb closesocket, send message to thread
InterlockedExchange((volatile LONG*)&dat->bIsWorking, FALSE);
@@ -319,28 +319,28 @@ DWORD CMraProto::MraFilesQueueCancel(HANDLE hFilesQueueHandle, DWORD dwIDRequest return dwRetErrorCode;
}
-DWORD CMraProto::MraFilesQueueStartMrimProxy(HANDLE hFilesQueueHandle, DWORD dwIDRequest)
+DWORD CMraProto::MraFilesQueueStartMrimProxy(HANDLE hQueue, DWORD dwIDRequest)
{
- if (!hFilesQueueHandle || !getByte("FileSendEnableMRIMProxyCons", MRA_DEF_FS_ENABLE_MRIM_PROXY_CONS))
+ if (!hQueue || !getByte("FileSendEnableMRIMProxyCons", MRA_DEF_FS_ENABLE_MRIM_PROXY_CONS))
return ERROR_INVALID_HANDLE;
- MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hFilesQueueHandle;
+ MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hQueue;
MRA_FILES_QUEUE_ITEM *dat;
mir_cslock l(pmrafqFilesQueue->cs);
- if (!MraFilesQueueItemFindByID(hFilesQueueHandle, dwIDRequest, &dat))
+ if (!MraFilesQueueItemFindByID(hQueue, dwIDRequest, &dat))
if (dat->bSending == FALSE)
SetEvent(dat->hWaitHandle);// cancel wait incomming connection
return 0;
}
-DWORD MraFilesQueueFree(HANDLE hFilesQueueHandle, DWORD dwIDRequest)
+DWORD MraFilesQueueFree(HANDLE hQueue, DWORD dwIDRequest)
{
- if (!hFilesQueueHandle)
+ if (!hQueue)
return ERROR_INVALID_HANDLE;
- MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hFilesQueueHandle;
+ MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hQueue;
MRA_FILES_QUEUE_ITEM *dat;
LIST_MT_ITERATOR lmtiIterator;
@@ -358,16 +358,16 @@ DWORD MraFilesQueueFree(HANDLE hFilesQueueHandle, DWORD dwIDRequest) return ERROR_NOT_FOUND;
}
-DWORD CMraProto::MraFilesQueueSendMirror(HANDLE hFilesQueueHandle, DWORD dwIDRequest, const CMStringA &szAddresses)
+DWORD CMraProto::MraFilesQueueSendMirror(HANDLE hQueue, DWORD dwIDRequest, const CMStringA &szAddresses)
{
- if (!hFilesQueueHandle)
+ if (!hQueue)
return ERROR_INVALID_HANDLE;
- MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hFilesQueueHandle;
+ MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hQueue;
MRA_FILES_QUEUE_ITEM *dat;
mir_cslock l(pmrafqFilesQueue->cs);
- DWORD dwRetErrorCode = MraFilesQueueItemFindByID(hFilesQueueHandle, dwIDRequest, &dat);
+ DWORD dwRetErrorCode = MraFilesQueueItemFindByID(hQueue, dwIDRequest, &dat);
if (dwRetErrorCode == NO_ERROR) {
MraAddrListGetFromBuff(szAddresses, &dat->malAddrList);
MraAddrListStoreToContact(dat->hContact, &dat->malAddrList);
@@ -609,12 +609,12 @@ void MraFilesQueueConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, vo /////////////////////////////////////////////////////////////////////////////////////////
// Receive files
-DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hFilesQueueHandle, DWORD dwFlags, MCONTACT hContact, DWORD dwIDRequest, const CMStringW &lpwszFiles, const CMStringA &szAddresses)
+DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hQueue, DWORD dwFlags, MCONTACT hContact, DWORD dwIDRequest, const CMStringW &lpwszFiles, const CMStringA &szAddresses)
{
- if (!hFilesQueueHandle || !dwIDRequest)
+ if (!hQueue || !dwIDRequest)
return ERROR_INVALID_HANDLE;
- MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hFilesQueueHandle;
+ MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hQueue;
MRA_FILES_QUEUE_ITEM *dat = (MRA_FILES_QUEUE_ITEM*)mir_calloc(sizeof(MRA_FILES_QUEUE_ITEM)+sizeof(LPSTR)+64);
if (!dat)
return GetLastError();
@@ -905,12 +905,12 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) /////////////////////////////////////////////////////////////////////////////////////////
// Send files
-DWORD CMraProto::MraFilesQueueAddSend(HANDLE hFilesQueueHandle, DWORD dwFlags, MCONTACT hContact, LPWSTR *plpwszFiles, size_t dwFilesCount, DWORD *pdwIDRequest)
+DWORD CMraProto::MraFilesQueueAddSend(HANDLE hQueue, DWORD dwFlags, MCONTACT hContact, LPWSTR *plpwszFiles, size_t dwFilesCount, DWORD *pdwIDRequest)
{
- if (!hFilesQueueHandle)
+ if (!hQueue)
return ERROR_INVALID_HANDLE;
- MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hFilesQueueHandle;
+ MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hQueue;
MRA_FILES_QUEUE_ITEM *dat = (MRA_FILES_QUEUE_ITEM*)mir_calloc(sizeof(MRA_FILES_QUEUE_ITEM)+sizeof(LPSTR)+64);
if (!dat)
return GetLastError();
@@ -951,7 +951,7 @@ DWORD CMraProto::MraFilesQueueAddSend(HANDLE hFilesQueueHandle, DWORD dwFlags, M ListMTItemAdd(pmrafqFilesQueue, dat, dat);
}
MRA_FILES_THREADPROC_PARAMS *pmftpp = (MRA_FILES_THREADPROC_PARAMS*)mir_calloc(sizeof(MRA_FILES_THREADPROC_PARAMS));
- pmftpp->hFilesQueueHandle = hFilesQueueHandle;
+ pmftpp->hFilesQueueHandle = hQueue;
pmftpp->dat = dat;
dat->hThread = ForkThreadEx(&CMraProto::MraFilesQueueSendThreadProc, pmftpp, 0);
diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp index e3ab42fa65..c92a183c2a 100644 --- a/protocols/MRA/src/MraIcons.cpp +++ b/protocols/MRA/src/MraIcons.cpp @@ -107,9 +107,9 @@ void InitXStatusIcons() hXStatusAdvancedStatusIcons[0] = NULL;
for (DWORD i = 1; i < MRA_XSTATUS_COUNT+1; i++) {
- char szBuff[MAX_PATH];
- mir_snprintf(szBuff, _countof(szBuff), "mra_xstatus%ld", i);
- sid.pszName = szBuff;
+ char szIconName[MAX_PATH];
+ mir_snprintf(szIconName, _countof(szIconName), "mra_xstatus%ld", i);
+ sid.pszName = szIconName;
int iCurIndex = i+IDI_XSTATUS1-1;
sid.description.t = (TCHAR*)lpcszXStatusNameDef[i];
diff --git a/protocols/MRA/src/MraMPop.cpp b/protocols/MRA/src/MraMPop.cpp index de0a8b9d35..74632cdf5e 100644 --- a/protocols/MRA/src/MraMPop.cpp +++ b/protocols/MRA/src/MraMPop.cpp @@ -15,8 +15,6 @@ struct MRA_MPOP_SESSION_QUEUE_ITEM : public FIFO_MT_ITEM size_t dwUrlSize;
};
-void MraMPopSessionQueueClear(HANDLE hMPopSessionQueue);
-
DWORD MraMPopSessionQueueInitialize(HANDLE *phMPopSessionQueue)
{
if (!phMPopSessionQueue)
@@ -32,12 +30,12 @@ DWORD MraMPopSessionQueueInitialize(HANDLE *phMPopSessionQueue) return NO_ERROR;
}
-void MraMPopSessionQueueClear(HANDLE hMPopSessionQueue)
+void MraMPopSessionQueueClear(HANDLE hQueue)
{
- if (!hMPopSessionQueue)
+ if (!hQueue)
return;
- MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue;
+ MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hQueue;
pmpsqMPopSessionQueue->bKeyValid = false;
mir_free(pmpsqMPopSessionQueue->lpszMPOPKey);
pmpsqMPopSessionQueue->lpszMPOPKey = NULL;
@@ -48,23 +46,23 @@ void MraMPopSessionQueueClear(HANDLE hMPopSessionQueue) mir_free(pmpsqi);
}
-void MraMPopSessionQueueDestroy(HANDLE hMPopSessionQueue)
+void MraMPopSessionQueueDestroy(HANDLE hQueue)
{
- if (!hMPopSessionQueue)
+ if (!hQueue)
return;
- MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue;
- MraMPopSessionQueueClear(hMPopSessionQueue);
+ MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hQueue;
+ MraMPopSessionQueueClear(hQueue);
delete pmpsqMPopSessionQueue;
}
-DWORD CMraProto::MraMPopSessionQueueAddUrl(HANDLE hMPopSessionQueue, const CMStringA &lpszUrl)
+DWORD CMraProto::MraMPopSessionQueueAddUrl(HANDLE hQueue, const CMStringA &lpszUrl)
{
- if (!hMPopSessionQueue)
+ if (!hQueue)
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 *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hQueue;
MRA_MPOP_SESSION_QUEUE_ITEM *pmpsqi;
if (!getByte("AutoAuthOnWebServices", MRA_DEFAULT_AUTO_AUTH_ON_WEB_SVCS) || !m_bLoggedIn) { /* Open without web auth. / Not loggedIn. */
@@ -80,13 +78,13 @@ DWORD CMraProto::MraMPopSessionQueueAddUrl(HANDLE hMPopSessionQueue, const CMStr pmpsqi->lpszUrl = (LPSTR)(pmpsqi + 1);
memcpy(pmpsqi->lpszUrl, lpszUrl, lpszUrl.GetLength());
FifoMTItemPush(pmpsqMPopSessionQueue, pmpsqi, (LPVOID)pmpsqi);
- MraMPopSessionQueueStart(hMPopSessionQueue);
+ MraMPopSessionQueueStart(hQueue);
return NO_ERROR;
}
-DWORD CMraProto::MraMPopSessionQueueAddUrlAndEMail(HANDLE hMPopSessionQueue, const CMStringA &lpszUrl, CMStringA &szEmail)
+DWORD CMraProto::MraMPopSessionQueueAddUrlAndEMail(HANDLE hQueue, const CMStringA &lpszUrl, CMStringA &szEmail)
{
- if (!hMPopSessionQueue)
+ if (!hQueue)
return ERROR_INVALID_HANDLE;
if (lpszUrl.IsEmpty() || szEmail.IsEmpty())
return ERROR_INVALID_DATA;
@@ -99,26 +97,26 @@ DWORD CMraProto::MraMPopSessionQueueAddUrlAndEMail(HANDLE hMPopSessionQueue, con CMStringA szUrl;
szUrl.Format("%s/%s/%s", lpszUrl.c_str(), szDomain.c_str(), szUser.c_str());
- return MraMPopSessionQueueAddUrl(hMPopSessionQueue, szUrl);
+ return MraMPopSessionQueueAddUrl(hQueue, szUrl);
}
-void CMraProto::MraMPopSessionQueueStart(HANDLE hMPopSessionQueue)
+void CMraProto::MraMPopSessionQueueStart(HANDLE hQueue)
{
- if (!hMPopSessionQueue)
+ if (!hQueue)
return;
- MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue;
+ MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hQueue;
MRA_MPOP_SESSION_QUEUE_ITEM *pmpsqi;
if (!getByte("AutoAuthOnWebServices", MRA_DEFAULT_AUTO_AUTH_ON_WEB_SVCS) || !m_bLoggedIn) { /* Open without web auth. / Not loggedIn. */
- MraMPopSessionQueueFlush(hMPopSessionQueue);
+ MraMPopSessionQueueFlush(hQueue);
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);
+ MraMPopSessionQueueFlush(hQueue);
return;
}
@@ -136,12 +134,12 @@ void CMraProto::MraMPopSessionQueueStart(HANDLE hMPopSessionQueue) }
}
-void CMraProto::MraMPopSessionQueueFlush(HANDLE hMPopSessionQueue)
+void CMraProto::MraMPopSessionQueueFlush(HANDLE hQueue)
{
- if (!hMPopSessionQueue)
+ if (!hQueue)
return;
- MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue;
+ MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hQueue;
MRA_MPOP_SESSION_QUEUE_ITEM *pmpsqi;
while (FifoMTItemPop(pmpsqMPopSessionQueue, NULL, (LPVOID*)&pmpsqi) == NO_ERROR) {
@@ -150,12 +148,12 @@ void CMraProto::MraMPopSessionQueueFlush(HANDLE hMPopSessionQueue) }
}
-DWORD MraMPopSessionQueueSetNewMPopKey(HANDLE hMPopSessionQueue, const CMStringA &szKey)
+DWORD MraMPopSessionQueueSetNewMPopKey(HANDLE hQueue, const CMStringA &szKey)
{
- if (!hMPopSessionQueue)
+ if (!hQueue)
return ERROR_INVALID_HANDLE;
- MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue;
+ MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hQueue;
if (pmpsqMPopSessionQueue->dwMPOPKeySize < (size_t)szKey.GetLength() || szKey.IsEmpty()) {
mir_free(pmpsqMPopSessionQueue->lpszMPOPKey);
pmpsqMPopSessionQueue->lpszMPOPKey = (LPSTR)mir_calloc(szKey.GetLength() + sizeof(size_t));
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 020ebc5c8a..012b3d0247 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -233,7 +233,7 @@ int CMraProto::AuthRecv(MCONTACT, PROTORECVEVENT* pre) HANDLE CMraProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR *szPath)
{
if (szPath != NULL)
- if (MraFilesQueueAccept(hFilesQueueHandle, (DWORD)hTransfer, szPath, mir_tstrlen(szPath)) == NO_ERROR)
+ if (MraFilesQueueAccept(hFilesQueueHandle, (DWORD_PTR)hTransfer, szPath, mir_tstrlen(szPath)) == NO_ERROR)
return hTransfer; // Success
return NULL;
@@ -242,7 +242,7 @@ HANDLE CMraProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR *szPath) int CMraProto::FileCancel(MCONTACT hContact, HANDLE hTransfer)
{
if (hContact && hTransfer) {
- MraFilesQueueCancel(hFilesQueueHandle, (DWORD)hTransfer, TRUE);
+ MraFilesQueueCancel(hFilesQueueHandle, (DWORD_PTR)hTransfer, TRUE);
return 0; // Success
}
@@ -536,13 +536,13 @@ HANDLE CMraProto::GetAwayMsg(MCONTACT hContact) return (HANDLE)iRet;
}
-int CMraProto::SetAwayMsg(int m_iStatus, const TCHAR* msg)
+int CMraProto::SetAwayMsg(int iStatus, const TCHAR *msg)
{
if (!m_bLoggedIn)
return 1;
size_t dwStatusDescSize = mir_tstrlen(msg);
- DWORD dwStatus = m_iStatus;
+ DWORD dwStatus = iStatus;
DWORD dwXStatus = m_iXStatus;
// не отправляем новый статусный текст для хстатусов, для хстатусов только эвей сообщения
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index 9d2d3e437a..1ce195d477 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -317,7 +317,7 @@ struct CMraProto : public PROTO<CMraProto> void MraChatSessionDestroy(MCONTACT hContactChatSession);
void MraChatSendPrivateMessage(LPSTR lpwszEMail);
- INT_PTR MraChatSessionEventSendByHandle(MCONTACT hContactChatSession, DWORD dwType, DWORD dwFlags, const CMStringA &szUID, LPCWSTR lpwszStatus, LPCWSTR lpwszMessage, DWORD_PTR dwItemData, DWORD dwTime);
+ INT_PTR MraChatSessionEventSendByHandle(MCONTACT hContactChatSession, int iType, DWORD dwFlags, const CMStringA &szUID, LPCWSTR lpwszStatus, LPCWSTR lpwszMessage, DWORD_PTR dwItemData, DWORD dwTime);
INT_PTR MraChatSessionInvite(MCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime);
INT_PTR MraChatSessionMembersAdd(MCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime);
INT_PTR MraChatSessionJoinUser(MCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime);
diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp index 1315e48778..0b3b289de4 100644 --- a/protocols/MRA/src/MraSendCommand.cpp +++ b/protocols/MRA/src/MraSendCommand.cpp @@ -14,7 +14,7 @@ public: void* Allocate(size_t len)
{
if (m_actual + len >= m_max) {
- size_t increment = (len > 4096) ? len+4096 : 4096;
+ size_t increment = (len > 4096) ? len + 4096 : 4096;
m_buf = (PBYTE)realloc(m_buf, m_max += increment);
}
@@ -43,14 +43,14 @@ public: void SetLPS(const CMStringA &str)
{
SetUL(str.GetLength());
- memcpy( Allocate(str.GetLength()), str, str.GetLength());
+ memcpy(Allocate(str.GetLength()), str, str.GetLength());
}
void SetLPSW(const CMStringW &str)
{
DWORD dwBytes = str.GetLength() * sizeof(WCHAR);
SetUL(dwBytes);
- memcpy( Allocate(dwBytes), str, dwBytes);
+ memcpy(Allocate(dwBytes), str, dwBytes);
}
void SetLPSLowerCase(const CMStringA &str)
@@ -106,7 +106,7 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType buf.SetLPS(lpszBuf);// сам мульт ANSI
buf.SetLPSW(lpwszMessage);// сам мульт UNICODE
- DWORD dwBufSize = (buf.Len() + 128);
+ DWORD dwBufSize = DWORD(buf.Len() + 128);
lpszBuf.Truncate(dwBufSize);
if (compress2((LPBYTE)(LPCSTR)lpszBuf, &dwBufSize, buf.Data(), (int)buf.Len(), Z_BEST_COMPRESSION) == Z_OK) {
lpszMessageRTF = mir_base64_encode((LPBYTE)(LPCSTR)lpszBuf, dwBufSize);
@@ -117,10 +117,10 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType else if ((dwFlags & (MESSAGE_FLAG_CONTACT | MESSAGE_FLAG_NOTIFY | MESSAGE_FLAG_SMS)) == 0) {
// Only if message is simple text message or RTF or ALARM
if (dwFlags & MESSAGE_FLAG_RTF) { // add RFT part
- CMStringA lpbRTFData; lpbRTFData.Truncate(lpwszMessage.GetLength()*16 + 4096);
+ CMStringA lpbRTFData; lpbRTFData.Truncate(lpwszMessage.GetLength() * 16 + 4096);
if (!MraConvertToRTFW(lpwszMessage, lpbRTFData)) {
DWORD dwBackColour = getDword("RTFBackgroundColour", MRA_DEFAULT_RTF_BACKGROUND_COLOUR);
-
+
OutBuffer buf;
buf.SetUL(2);
buf.SetLPS(lpbRTFData);
@@ -136,7 +136,7 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType }
}
- if (lpszMessageRTF == NULL || dwMessageRTFSize == 0) dwFlags &= ~(MESSAGE_FLAG_RTF|MESSAGE_FLAG_FLASH);
+ if (lpszMessageRTF == NULL || dwMessageRTFSize == 0) dwFlags &= ~(MESSAGE_FLAG_RTF | MESSAGE_FLAG_FLASH);
if (lpbMultiChatData == NULL || dwMultiChatDataSize == 0) dwFlags &= ~MESSAGE_FLAG_MULTICHAT;
OutBuffer buf;
@@ -253,7 +253,7 @@ DWORD CMraProto::MraOfflineMessageDel(DWORDLONG dwMsgUIDL) // autorize a user & add him to a roster
DWORD CMraProto::MraAuthorize(const CMStringA& szEmail)
{
- if ( szEmail.GetLength() <= 4)
+ if (szEmail.GetLength() <= 4)
return 0;
OutBuffer buf;
@@ -285,10 +285,10 @@ DWORD CMraProto::MraFileTransfer(const CMStringA &szEmail, DWORD dwIDRequest, DW buf.SetLPSLowerCase(szEmail);
buf.SetUL(dwIDRequest);
buf.SetUL(dwFilesTotalSize);
- buf.SetUL(sizeof(DWORD)*5 + szFiles.GetLength() + wszFiles.GetLength()*sizeof(WCHAR) + szAddresses.GetLength());
+ buf.SetUL(sizeof(DWORD) * 5 + szFiles.GetLength() + wszFiles.GetLength()*sizeof(WCHAR) + szAddresses.GetLength());
buf.SetLPS(szFiles);
- buf.SetUL(sizeof(DWORD)*2 + wszFiles.GetLength()*sizeof(WCHAR));
+ buf.SetUL(sizeof(DWORD) * 2 + wszFiles.GetLength()*sizeof(WCHAR));
buf.SetUL(1);
buf.SetLPSW(wszFiles);
@@ -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_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_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);
@@ -387,7 +387,7 @@ HANDLE CMraProto::MraWPRequestByEMail(MCONTACT hContact, DWORD dwAckType, CMStri return 0;
int iStart = 0;
- CMStringA szUser = szEmail.Tokenize("@", iStart);
+ CMStringA szUser = szEmail.Tokenize("@", iStart);
CMStringA szDomain = szEmail.Tokenize("@", iStart);
DWORD dwRequestFlags = 0;
@@ -498,7 +498,7 @@ DWORD CMraProto::MraChangeUserBlogStatus(DWORD dwFlags, const CMStringW &wszText return MraSendCMD(MRIM_CS_CHANGE_USER_BLOG_STATUS, buf.Data(), buf.Len());
}
-DWORD CMraProto::MraSendPacket(HANDLE hConnection, DWORD dwCMDNum, DWORD dwType, LPVOID lpData, size_t dwDataSize)
+DWORD CMraProto::MraSendPacket(HANDLE hConnection, DWORD dwCmdNum, DWORD dwType, LPVOID lpData, size_t dwDataSize)
{
LPBYTE lpbData = (LPBYTE)_alloca(dwDataSize + sizeof(mrim_packet_header_t));
@@ -506,10 +506,10 @@ DWORD CMraProto::MraSendPacket(HANDLE hConnection, DWORD dwCMDNum, DWORD dwType, memset(pmaHeader, 0, sizeof(mrim_packet_header_t));
pmaHeader->magic = CS_MAGIC;
pmaHeader->proto = (PROTO_VERSION_MAJOR << 16) + PROTO_VERSION_MINOR; // Версия протокола
- pmaHeader->seq = dwCMDNum;// Sequence
+ pmaHeader->seq = dwCmdNum;// Sequence
pmaHeader->msg = dwType;// Тип пакета
pmaHeader->dlen = (unsigned)dwDataSize;// Длина данных
-
+
debugLogA("Sending packet %08x\n", dwType);
memcpy((lpbData + sizeof(mrim_packet_header_t)), lpData, dwDataSize);
@@ -525,13 +525,13 @@ DWORD CMraProto::MraSendCMD(DWORD dwType, LPVOID lpData, size_t dwDataSize) }
-DWORD CMraProto::MraSendQueueCMD(HANDLE hSendQueueHandle, DWORD dwFlags, MCONTACT hContact, DWORD dwAckType, LPBYTE lpbDataQueue, size_t dwDataQueueSize, DWORD dwType, LPVOID lpData, size_t dwDataSize)
+DWORD CMraProto::MraSendQueueCMD(HANDLE hQueue, DWORD dwFlags, MCONTACT hContact, DWORD dwAckType, LPBYTE lpbDataQueue, size_t dwDataQueueSize, DWORD dwType, LPVOID lpData, size_t dwDataSize)
{
DWORD dwRet = InterlockedIncrement((LONG volatile*)&dwCMDNum);
- if ( !MraSendQueueAdd(hSendQueueHandle, dwRet, dwFlags, hContact, dwAckType, lpbDataQueue, dwDataQueueSize)) {
+ if (!MraSendQueueAdd(hQueue, dwRet, dwFlags, hContact, dwAckType, lpbDataQueue, dwDataQueueSize)) {
mir_cslock l(csCriticalSectionSend); // guarding winsock internal buffers
- if ( !MraSendPacket(m_hConnection, dwRet, dwType, lpData, dwDataSize)) {
- MraSendQueueFree(hSendQueueHandle, dwRet);
+ if (!MraSendPacket(m_hConnection, dwRet, dwType, lpData, dwDataSize)) {
+ MraSendQueueFree(hQueue, dwRet);
dwRet = 0;
}
}
diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp index 6edfcfb59e..909a1b94f9 100644 --- a/protocols/MRA/src/Mra_options.cpp +++ b/protocols/MRA/src/Mra_options.cpp @@ -3,17 +3,17 @@ INT_PTR CALLBACK DlgProcOptsAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
CMraProto *ppro = (CMraProto*)GetWindowLongPtr(hWndDlg, GWLP_USERDATA);
- CMStringW szBuff;
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hWndDlg);
SetWindowLongPtr(hWndDlg, GWLP_USERDATA, lParam);
ppro = (CMraProto*)lParam;
-
- if (ppro->mraGetStringW(NULL, "e-mail", szBuff))
- SetDlgItemText(hWndDlg, IDC_LOGIN, szBuff.c_str());
-
+ {
+ CMStringW szBuff;
+ if (ppro->mraGetStringW(NULL, "e-mail", szBuff))
+ SetDlgItemText(hWndDlg, IDC_LOGIN, szBuff.c_str());
+ }
SetDlgItemText(hWndDlg, IDC_PASSWORD, _T(""));
return TRUE;
@@ -54,17 +54,17 @@ INT_PTR CALLBACK DlgProcOptsAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARA INT_PTR CALLBACK DlgProcAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
CMraProto *ppro = (CMraProto*)GetWindowLongPtr(hWndDlg, GWLP_USERDATA);
- CMStringW szBuff;
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hWndDlg);
SetWindowLongPtr(hWndDlg, GWLP_USERDATA, lParam);
ppro = (CMraProto*)lParam;
-
- if (ppro->mraGetStringW(NULL, "e-mail", szBuff))
- SetDlgItemText(hWndDlg, IDC_LOGIN, szBuff.c_str());
-
+ {
+ CMStringW szBuff;
+ if (ppro->mraGetStringW(NULL, "e-mail", szBuff))
+ SetDlgItemText(hWndDlg, IDC_LOGIN, szBuff.c_str());
+ }
SetDlgItemText(hWndDlg, IDC_PASSWORD, _T(""));
return TRUE;
@@ -104,18 +104,19 @@ INT_PTR CALLBACK DlgProcAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lP INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
CMraProto *ppro = (CMraProto*)GetWindowLongPtr(hWndDlg, GWLP_USERDATA);
- CMStringW szBuff;
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hWndDlg);
SetWindowLongPtr(hWndDlg, GWLP_USERDATA, lParam);
ppro = (CMraProto*)lParam;
-
- if (ppro->mraGetStringW(NULL, "Server", szBuff))
- SetDlgItemText(hWndDlg, IDC_SERVER, szBuff.c_str());
- else
- SetDlgItemTextA(hWndDlg, IDC_SERVER, MRA_DEFAULT_SERVER);
+ {
+ CMStringW szBuff;
+ if (ppro->mraGetStringW(NULL, "Server", szBuff))
+ SetDlgItemText(hWndDlg, IDC_SERVER, szBuff.c_str());
+ else
+ SetDlgItemTextA(hWndDlg, IDC_SERVER, MRA_DEFAULT_SERVER);
+ }
SetDlgItemInt(hWndDlg, IDC_SERVERPORT, ppro->getWord("ServerPort", MRA_DEFAULT_SERVER_PORT), FALSE);
// if set SSL proxy, setting will ignored
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 6b42437dbf..0975551c5e 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -232,11 +232,11 @@ DWORD CMraProto::MraNetworkDispatcher() MraSendCMD(MRIM_CS_PING, NULL, 0);
}
{ /* Remove old items from send queue. */
- DWORD dwCMDNum, dwFlags, dwAckType;
+ DWORD dwCmdNum, dwFlags, dwAckType;
MCONTACT hContact;
LPBYTE lpbData;
size_t dwDataSize;
- while (!MraSendQueueFindOlderThan(hSendQueueHandle, SEND_QUEUE_TIMEOUT, &dwCMDNum, &dwFlags, &hContact, &dwAckType, &lpbData, &dwDataSize)) {
+ while (!MraSendQueueFindOlderThan(hSendQueueHandle, SEND_QUEUE_TIMEOUT, &dwCmdNum, &dwFlags, &hContact, &dwAckType, &lpbData, &dwDataSize)) {
switch (dwAckType) {
case ACKTYPE_ADDED:
case ACKTYPE_AUTHREQ:
@@ -244,20 +244,20 @@ DWORD CMraProto::MraNetworkDispatcher() //nothing to do
break;
case ACKTYPE_MESSAGE:
- ProtoBroadcastAck(hContact, dwAckType, ACKRESULT_FAILED, (HANDLE)dwCMDNum, (LPARAM)"Undefined message deliver error, time out");
+ ProtoBroadcastAck(hContact, dwAckType, ACKRESULT_FAILED, (HANDLE)dwCmdNum, (LPARAM)"Undefined message deliver error, time out");
break;
case ACKTYPE_GETINFO:
ProtoBroadcastAck(hContact, dwAckType, ACKRESULT_FAILED, (HANDLE)1, 0);
break;
case ACKTYPE_SEARCH:
- ProtoBroadcastAck(hContact, dwAckType, ACKRESULT_SUCCESS, (HANDLE)dwCMDNum, 0);
+ ProtoBroadcastAck(hContact, dwAckType, ACKRESULT_SUCCESS, (HANDLE)dwCmdNum, 0);
break;
case ICQACKTYPE_SMS:
- ProtoBroadcastAck(NULL, dwAckType, ACKRESULT_FAILED, (HANDLE)dwCMDNum, 0);
+ ProtoBroadcastAck(NULL, dwAckType, ACKRESULT_FAILED, (HANDLE)dwCmdNum, 0);
mir_free(lpbData);
break;
}
- MraSendQueueFree(hSendQueueHandle, dwCMDNum);
+ MraSendQueueFree(hSendQueueHandle, dwCmdNum);
}
}
@@ -691,10 +691,10 @@ bool CMraProto::CmdUserStatus(BinBuffer &buf) if (dwTemp == MraGetContactStatus(hContact)) {// меняем шило на шило, подозрительно? ;)
if (dwTemp == ID_STATUS_OFFLINE) { // was/now invisible
- CMStringW szEmail, szBuff;
- mraGetStringW(hContact, "e-mail", szEmail);
- szBuff.Format(L"%s <%s> - %s", pcli->pfnGetContactDisplayName(hContact, 0), szEmail, TranslateT("invisible status changed"));
- MraPopupShowFromContactW(hContact, MRA_POPUP_TYPE_INFORMATION, 0, szBuff);
+ CMStringW wszEmail, wszBuff;
+ mraGetStringW(hContact, "e-mail", wszEmail);
+ wszBuff.Format(L"%s <%s> - %s", pcli->pfnGetContactDisplayName(hContact, 0), wszEmail, TranslateT("invisible status changed"));
+ MraPopupShowFromContactW(hContact, MRA_POPUP_TYPE_INFORMATION, 0, wszBuff);
MraSetContactStatus(hContact, ID_STATUS_INVISIBLE);
}
@@ -1297,30 +1297,30 @@ bool CMraProto::CmdClist2(BinBuffer &buf) // post processing contact list
{
- CMStringA szEmail, szPhones;
- CMStringW wszAuthMessage, wszNick;
+ CMStringA email, phones;
+ CMStringW wszAuthMessage, nick;
if (mraGetStringW(NULL, "AuthMessage", wszAuthMessage) == FALSE) // def auth message
wszAuthMessage = TranslateT(MRA_DEFAULT_AUTH_MESSAGE);
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- if (GetContactBasicInfoW(hContact, &dwID, NULL, NULL, NULL, NULL, &szEmail, NULL, NULL) == NO_ERROR)
+ if (GetContactBasicInfoW(hContact, &dwID, NULL, NULL, NULL, NULL, &email, NULL, NULL) == NO_ERROR)
if (dwID == -1) {
- if (IsEMailChatAgent(szEmail)) {// чат: ещё раз запросим авторизацию, пометим как видимый в списке, постоянный
+ if (IsEMailChatAgent(email)) {// чат: ещё раз запросим авторизацию, пометим как видимый в списке, постоянный
db_unset(hContact, "CList", "Hidden");
db_unset(hContact, "CList", "NotOnList");
SetExtraIcons(hContact);
MraSetContactStatus(hContact, ID_STATUS_ONLINE);
CMStringW wszCustomName = pcli->pfnGetContactDisplayName(hContact, 0);
- MraAddContact(hContact, (CONTACT_FLAG_VISIBLE | CONTACT_FLAG_MULTICHAT), -1, szEmail, wszCustomName);
+ MraAddContact(hContact, (CONTACT_FLAG_VISIBLE | CONTACT_FLAG_MULTICHAT), -1, email, wszCustomName);
}
else {
if (db_get_b(hContact, "CList", "NotOnList", 0) == 0) { // set extra icons and upload contact
SetExtraIcons(hContact);
if (getByte("AutoAddContactsToServer", MRA_DEFAULT_AUTO_ADD_CONTACTS_TO_SERVER)) { //add all contacts to server
- GetContactBasicInfoW(hContact, NULL, &dwGroupID, NULL, NULL, NULL, NULL, &wszNick, &szPhones);
- MraAddContact(hContact, (CONTACT_FLAG_VISIBLE | CONTACT_FLAG_UNICODE_NAME), dwGroupID, szEmail, wszNick, &szPhones, &wszAuthMessage);
+ GetContactBasicInfoW(hContact, NULL, &dwGroupID, NULL, NULL, NULL, NULL, &nick, &phones);
+ MraAddContact(hContact, (CONTACT_FLAG_VISIBLE | CONTACT_FLAG_UNICODE_NAME), dwGroupID, email, nick, &phones, &wszAuthMessage);
}
}
}
@@ -1695,15 +1695,15 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, CMStringA & case MULTICHAT_MEMBERS:
{
DWORD dwMultiChatMembersCount;
- BinBuffer buf((PBYTE)lpsEMailInMultiChat.GetString(), lpsEMailInMultiChat.GetLength());
- buf >> dwMultiChatMembersCount;// count
- for (unsigned i = 0; i < dwMultiChatMembersCount && !buf.eof(); i++) {
- buf >> szString;
+ BinBuffer binBuf((PBYTE)lpsEMailInMultiChat.GetString(), lpsEMailInMultiChat.GetLength());
+ binBuf >> dwMultiChatMembersCount;// count
+ for (unsigned i = 0; i < dwMultiChatMembersCount && !binBuf.eof(); i++) {
+ binBuf >> szString;
MraChatSessionJoinUser(hContact, szString, ((dwMultiChatEventType == MULTICHAT_MEMBERS) ? 0 : dwTime));
}
if (dwMultiChatEventType == MULTICHAT_MEMBERS) {
- buf >> szString; // [ LPS owner ]
+ binBuf >> szString; // [ LPS owner ]
MraChatSessionSetOwner(hContact, szString);
}
}
|