diff options
Diffstat (limited to 'protocols/MRA')
-rw-r--r-- | protocols/MRA/src/Mra.cpp | 4 | ||||
-rw-r--r-- | protocols/MRA/src/MraAvatars.cpp | 30 | ||||
-rw-r--r-- | protocols/MRA/src/MraChat.cpp | 1 | ||||
-rw-r--r-- | protocols/MRA/src/MraConstans.h | 4 | ||||
-rw-r--r-- | protocols/MRA/src/MraFilesQueue.cpp | 37 | ||||
-rw-r--r-- | protocols/MRA/src/MraIcons.cpp | 2 | ||||
-rw-r--r-- | protocols/MRA/src/MraMPop.cpp | 4 | ||||
-rw-r--r-- | protocols/MRA/src/MraPopUp.cpp | 4 | ||||
-rw-r--r-- | protocols/MRA/src/MraProto.cpp | 71 | ||||
-rw-r--r-- | protocols/MRA/src/MraProto.h | 8 | ||||
-rw-r--r-- | protocols/MRA/src/MraRTFMsg.cpp | 12 | ||||
-rw-r--r-- | protocols/MRA/src/MraSendCommand.cpp | 7 | ||||
-rw-r--r-- | protocols/MRA/src/MraSendQueue.cpp | 12 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_functions.cpp | 150 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_menus.cpp | 44 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_proto.cpp | 18 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_svcs.cpp | 27 | ||||
-rw-r--r-- | protocols/MRA/src/Sdk/FIFOMT.h | 7 | ||||
-rw-r--r-- | protocols/MRA/src/Sdk/InternetTime.h | 2 | ||||
-rw-r--r-- | protocols/MRA/src/Sdk/ListMT.h | 47 | ||||
-rw-r--r-- | protocols/MRA/src/Sdk/timefuncs.h | 14 | ||||
-rw-r--r-- | protocols/MRA/src/version.h | 2 |
22 files changed, 219 insertions, 288 deletions
diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp index 13d8ee091f..9f609f4056 100644 --- a/protocols/MRA/src/Mra.cpp +++ b/protocols/MRA/src/Mra.cpp @@ -30,7 +30,7 @@ WCHAR g_szMirWorkDirPath[MAX_FILEPATH]; void IconsLoad();
-BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID Reserved)
+BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID)
{
switch (dwReason) {
case DLL_PROCESS_ATTACH:
@@ -47,7 +47,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID Reserved) extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_LAST};
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index 23f2d691b0..c8d3466d1c 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -60,7 +60,7 @@ DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle) if (pmraaqAvatarsQueue == NULL)
return GetLastError();
- DWORD dwRetErrorCode = FifoMTInitialize(pmraaqAvatarsQueue, 0);
+ DWORD dwRetErrorCode = ListMTInitialize(pmraaqAvatarsQueue);
if (dwRetErrorCode == NO_ERROR) {
char szBuffer[MAX_PATH];
mir_snprintf(szBuffer, SIZEOF(szBuffer), "%s %s", m_szModuleName, Translate("Avatars' plugin connections"));
@@ -129,7 +129,7 @@ void CMraProto::MraAvatarsQueueDestroy(HANDLE hAvatarsQueueHandle) MraAvatarsQueueClear(hAvatarsQueueHandle);
- FifoMTDestroy(pmraaqAvatarsQueue);
+ ListMTDestroy(pmraaqAvatarsQueue);
Netlib_CloseHandle(pmraaqAvatarsQueue->hNetlibUser);
mir_free(pmraaqAvatarsQueue);
}
@@ -162,9 +162,9 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) CMStringA szEmail, szServer;
CMStringW wszFileName;
- BOOL bContinue, bKeepAlive, bUseKeepAliveConn, bFailed, bDownloadNew, bDefaultAvt;
+ BOOL bContinue, bKeepAlive, bUseKeepAliveConn, bFailed, bDownloadNew;
BYTE btBuff[BUFF_SIZE_RCV];
- DWORD dwResultCode, dwAvatarFormat, dwReceived, dwServerPort, dwErrorCode;
+ DWORD dwResultCode, dwAvatarFormat = PA_FORMAT_DEFAULT, dwReceived, dwServerPort, dwErrorCode;
size_t dwAvatarSizeServer;
FILETIME ftLastModifiedTimeServer, ftLastModifiedTimeLocal;
SYSTEMTIME stAvatarLastModifiedTimeLocal;
@@ -188,7 +188,6 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) /* Try download. */
bFailed = TRUE;
bDownloadNew = FALSE;
- bDefaultAvt = FALSE;
if (!DB_GetStringA(NULL, MRA_AVT_SECT_NAME, "Server", szServer))
szServer = MRA_AVT_DEFAULT_SERVER;
@@ -240,8 +239,6 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) }
else//loading default avatar
bDownloadNew = TRUE;
-
- bDefaultAvt = TRUE;
}
break;
@@ -261,9 +258,6 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) if (hConnection) {
ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_DATA, NULL, 0);
if (MraAvatarsHttpTransaction(hConnection, REQUEST_GET, szUser, szDomain, szServer, MAHTRO_AVT, bUseKeepAliveConn, &dwResultCode, &bKeepAlive, &dwAvatarFormat, &dwAvatarSizeServer, &itAvatarLastModifiedTimeServer) == NO_ERROR && dwResultCode == 200) {
- if (bDefaultAvt)
- dwAvatarFormat = PA_FORMAT_DEFAULT;
-
if (!MraAvatarsGetFileName(pmraaqAvatarsQueue, pmraaqiAvatarsQueueItem->hContact, dwAvatarFormat, wszFileName)) {
HANDLE hFile = CreateFile(wszFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) {
@@ -336,7 +330,6 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) else
PathToRelativeT(wszFileName, pai.filename);
- if (bDefaultAvt) dwAvatarFormat = PA_FORMAT_DEFAULT;
SetContactAvatarFormat(pmraaqiAvatarsQueueItem->hContact, dwAvatarFormat);
MraAvatarsSetContactTime(pmraaqiAvatarsQueueItem->hContact, "AvatarLastModifiedTime", &itAvatarLastModifiedTimeServer.stTime);
// write owner avatar file name to DB
@@ -395,7 +388,7 @@ DWORD MraAvatarsHttpTransaction(HANDLE hConnection, DWORD dwRequestType, LPCSTR }
char szBuff[4096];
- DWORD dwBuffSize = mir_snprintf(szBuff, SIZEOF(szBuff), "http://%s/%s/%s/%s", lpszHost, lpszDomain, lpszUser, lpszReqObj);
+ mir_snprintf(szBuff, SIZEOF(szBuff), "http://%s/%s/%s/%s", lpszHost, lpszDomain, lpszUser, lpszReqObj);
CMStringA szSelfVersionString = MraGetSelfVersionString();
NETLIBHTTPHEADER nlbhHeaders[8] = { 0 };
@@ -493,8 +486,6 @@ DWORD CMraProto::MraAvatarsGetFileName(HANDLE hAvatarsQueueHandle, MCONTACT hCon if (IsContactChatAgent(hContact))
return ERROR_NOT_SUPPORTED;
- MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hAvatarsQueueHandle;
-
TCHAR tszBase[MAX_PATH];
mir_sntprintf(tszBase, SIZEOF(tszBase), _T("%s\\%s\\"), VARST(_T("%miranda_avatarcache%")), m_tszUserName);
res = tszBase;
@@ -533,7 +524,6 @@ DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFl return GAIR_NOAVATAR;
BOOL bQueueAdd = TRUE;// check for updates
- MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hAvatarsQueueHandle;
SYSTEMTIME stAvatarLastCheckTime;
if ((dwFlags & GAIF_FORCE) == 0)// если флаг принудит. обновления, то даже не проверяем времени последнего обновления
@@ -570,18 +560,18 @@ DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFl return dwRetCode;
}
-DWORD CMraProto::MraAvatarsQueueGetAvatarSimple(HANDLE hAvatarsQueueHandle, DWORD dwFlags, MCONTACT hContact, DWORD dwSourceID)
+DWORD CMraProto::MraAvatarsQueueGetAvatarSimple(HANDLE hAvatarsQueueHandle, DWORD dwFlags, MCONTACT hContact)
{
- DWORD dwRetCode;
-
if ( !hAvatarsQueueHandle)
return GAIR_NOAVATAR;
+
PROTO_AVATAR_INFORMATIONT pai = { 0 };
pai.cbSize = sizeof(pai);
pai.hContact = hContact;
- dwRetCode = MraAvatarsQueueGetAvatar(hAvatarsQueueHandle, dwFlags, hContact, NULL, (DWORD*)&pai.format, pai.filename);
+ DWORD dwRetCode = MraAvatarsQueueGetAvatar(hAvatarsQueueHandle, dwFlags, hContact, NULL, (DWORD*)&pai.format, pai.filename);
if (dwRetCode != GAIR_SUCCESS)
return dwRetCode;
+
// write owner avatar file name to DB
if (hContact == NULL)
CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)m_szModuleName, 0);
@@ -669,8 +659,6 @@ DWORD CMraProto::MraAvatarsDeleteContactAvatarFile(HANDLE hAvatarsQueueHandle, M if (hAvatarsQueueHandle == NULL)
return ERROR_INVALID_HANDLE;
- MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hAvatarsQueueHandle;
-
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;
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp index 3dd6251320..851fafe2e8 100644 --- a/protocols/MRA/src/MraChat.cpp +++ b/protocols/MRA/src/MraChat.cpp @@ -193,7 +193,6 @@ int CMraProto::MraChatGcEventHook(WPARAM, LPARAM lParam) switch (gch->pDest->iType) {
case GC_USER_MESSAGE:
if (gch->ptszText && mir_tstrlen(gch->ptszText)) {
- size_t dwMessageSize = mir_wstrlen(gch->ptszText);
CMStringA szEmail = gch->pDest->ptszID;
MCONTACT hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL);
BOOL bSlowSend = getByte("SlowSend", MRA_DEFAULT_SLOW_SEND);
diff --git a/protocols/MRA/src/MraConstans.h b/protocols/MRA/src/MraConstans.h index 96b7447022..ebfdf6e9aa 100644 --- a/protocols/MRA/src/MraConstans.h +++ b/protocols/MRA/src/MraConstans.h @@ -226,8 +226,8 @@ static const LPSTR lpcszMailRuDomains[] = #define DBSETTING_BLOGSTATUS "BlogStatus"
#define DBSETTING_BLOGSTATUSMUSIC "ListeningTo"
-extern const LPSTR lpcszStatusUri[];
-extern const LPWSTR lpcszXStatusNameDef[];
+extern LPCSTR lpcszStatusUri[];
+extern LPCWSTR lpcszXStatusNameDef[];
#define MRA_XSTATUS_COUNT 50 /* index = 0 - virtual status "none" */
#define MRA_XSTATUS_OFF_CLI_COUNT 49 /* MRA_XSTATUS_COUNT - dating */
diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp index 64ae8e554c..f795753d96 100644 --- a/protocols/MRA/src/MraFilesQueue.cpp +++ b/protocols/MRA/src/MraFilesQueue.cpp @@ -145,7 +145,7 @@ DWORD MraFilesQueueInitialize(DWORD dwSendTimeOutInterval, HANDLE *phFilesQueueH if (!pmrafqFilesQueue)
return GetLastError();
- DWORD dwRetErrorCode = ListMTInitialize(pmrafqFilesQueue, 0);
+ DWORD dwRetErrorCode = ListMTInitialize(pmrafqFilesQueue);
if (dwRetErrorCode == NO_ERROR) {
pmrafqFilesQueue->dwSendTimeOutInterval = dwSendTimeOutInterval;
*phFilesQueueHandle = (HANDLE)pmrafqFilesQueue;
@@ -163,7 +163,7 @@ void MraFilesQueueDestroy(HANDLE hFilesQueueHandle) MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hFilesQueueHandle;
MRA_FILES_QUEUE_ITEM *dat;
{
- mt_lock l(pmrafqFilesQueue);
+ mir_cslock l(pmrafqFilesQueue->cs);
while (ListMTItemGetFirst(pmrafqFilesQueue, NULL, (LPVOID*)&dat) == NO_ERROR)
MraFilesQueueItemFree(dat);
}
@@ -180,7 +180,7 @@ DWORD MraFilesQueueItemFindByID(HANDLE hFilesQueueHandle, DWORD dwIDRequest, MRA MRA_FILES_QUEUE_ITEM *dat;
LIST_MT_ITERATOR lmtiIterator;
- mt_lock l(pmrafqFilesQueue);
+ mir_cslock l(pmrafqFilesQueue->cs);
ListMTIteratorMoveFirst(pmrafqFilesQueue, &lmtiIterator);
do {
if (ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&dat) == NO_ERROR)
@@ -218,7 +218,7 @@ void MraFilesQueueItemFree(MRA_FILES_QUEUE_ITEM *dat) MraMrimProxyFree(dat->hMraMrimProxyData);
mir_free(dat->lpwszPath);
{
- mt_lock l(plmtListMT);
+ mir_cslock l(plmtListMT->cs);
ListMTItemDelete(plmtListMT, dat);
}
mir_free(dat);
@@ -271,7 +271,7 @@ DWORD CMraProto::MraFilesQueueAccept(HANDLE hFilesQueueHandle, DWORD dwIDRequest MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hFilesQueueHandle;
MRA_FILES_QUEUE_ITEM *dat;
- mt_lock l(pmrafqFilesQueue);
+ mir_cslock l(pmrafqFilesQueue->cs);
DWORD dwRetErrorCode = MraFilesQueueItemFindByID(hFilesQueueHandle, dwIDRequest, &dat);
if (dwRetErrorCode == NO_ERROR) {
MRA_FILES_THREADPROC_PARAMS *pmftpp = (MRA_FILES_THREADPROC_PARAMS*)mir_calloc(sizeof(MRA_FILES_THREADPROC_PARAMS));
@@ -301,7 +301,7 @@ DWORD CMraProto::MraFilesQueueCancel(HANDLE hFilesQueueHandle, DWORD dwIDRequest MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hFilesQueueHandle;
MRA_FILES_QUEUE_ITEM *dat;
- mt_lock l(pmrafqFilesQueue);
+ mir_cslock l(pmrafqFilesQueue->cs);
DWORD dwRetErrorCode = MraFilesQueueItemFindByID(hFilesQueueHandle, dwIDRequest, &dat);
if (dwRetErrorCode == NO_ERROR) { //***deb closesocket, send message to thread
InterlockedExchange((volatile LONG*)&dat->bIsWorking, FALSE);
@@ -309,7 +309,7 @@ DWORD CMraProto::MraFilesQueueCancel(HANDLE hFilesQueueHandle, DWORD dwIDRequest if (bSendDecline) {
CMStringA szEmail;
if (mraGetStringA(dat->hContact, "e-mail", szEmail))
- MraFileTransferAck(FILE_TRANSFER_STATUS_DECLINE, szEmail, dwIDRequest, NULL, 0);
+ MraFileTransferAck(FILE_TRANSFER_STATUS_DECLINE, szEmail, dwIDRequest, CMStringA());
}
MraMrimProxyCloseConnection(dat->hMraMrimProxyData);
@@ -333,7 +333,7 @@ DWORD CMraProto::MraFilesQueueStartMrimProxy(HANDLE hFilesQueueHandle, DWORD dwI MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hFilesQueueHandle;
MRA_FILES_QUEUE_ITEM *dat;
- mt_lock l(pmrafqFilesQueue);
+ mir_cslock l(pmrafqFilesQueue->cs);
if (!MraFilesQueueItemFindByID(hFilesQueueHandle, dwIDRequest, &dat))
if (dat->bSending == FALSE)
SetEvent(dat->hWaitHandle);// cancel wait incomming connection
@@ -350,7 +350,7 @@ DWORD MraFilesQueueFree(HANDLE hFilesQueueHandle, DWORD dwIDRequest) MRA_FILES_QUEUE_ITEM *dat;
LIST_MT_ITERATOR lmtiIterator;
- mt_lock l(pmrafqFilesQueue);
+ mir_cslock l(pmrafqFilesQueue->cs);
ListMTIteratorMoveFirst(pmrafqFilesQueue, &lmtiIterator);
do {
if (ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&dat) == NO_ERROR)
@@ -372,7 +372,7 @@ DWORD CMraProto::MraFilesQueueSendMirror(HANDLE hFilesQueueHandle, DWORD dwIDReq MRA_FILES_QUEUE *pmrafqFilesQueue = (MRA_FILES_QUEUE*)hFilesQueueHandle;
MRA_FILES_QUEUE_ITEM *dat;
- mt_lock l(pmrafqFilesQueue);
+ mir_cslock l(pmrafqFilesQueue->cs);
DWORD dwRetErrorCode = MraFilesQueueItemFindByID(hFilesQueueHandle, dwIDRequest, &dat);
if (dwRetErrorCode == NO_ERROR) {
MraAddrListGetFromBuff(szAddresses, &dat->malAddrList);
@@ -435,7 +435,7 @@ HANDLE CMraProto::MraFilesQueueConnectOut(MRA_FILES_QUEUE_ITEM *dat) if (getByte("FileSendEnableDirectConn", MRA_DEF_FS_ENABLE_DIRECT_CONN) && InterlockedExchangeAdd((volatile LONG*)&dat->bIsWorking, 0) && ((dat->bSending == FALSE && getByte("FileSendNoOutConnOnRcv", MRA_DEF_FS_NO_OUT_CONN_ON_RCV) == FALSE) || (dat->bSending == TRUE && getByte("FileSendNoOutConnOnSend", MRA_DEF_FS_NO_OUT_CONN_ON_SEND) == FALSE))) {
BOOL bFiltering = FALSE, bIsHTTPSProxyUsed = IsHTTPSProxyUsed(m_hNetlibUser);
DWORD dwLocalPort = 0, dwConnectReTryCount, dwCurConnectReTryCount;
- size_t dwAddrCount;
+ size_t dwAddrCount = 0;
NETLIBOPENCONNECTION nloc = { 0 };
if (getByte("FileSendIgnoryAdditionalPorts", MRA_DEF_FS_IGNORY_ADDITIONAL_PORTS) || bIsHTTPSProxyUsed) {// фильтруем порты для одного IP, вместо 3 будем коннектится только к одному
@@ -444,7 +444,6 @@ HANDLE CMraProto::MraFilesQueueConnectOut(MRA_FILES_QUEUE_ITEM *dat) else if ((dwLocalPort = getWord("ServerPort", MRA_DEFAULT_SERVER_PORT)) == MRA_SERVER_PORT_STANDART_NLB)
dwLocalPort = MRA_SERVER_PORT_STANDART;
- dwAddrCount = 0;
for (size_t i = 0; i < dat->malAddrList.dwAddrCount; i++) {
if (dwLocalPort == dat->malAddrList.pMailAddress[i].dwPort) {
bFiltering = TRUE;
@@ -555,7 +554,7 @@ HANDLE CMraProto::MraFilesQueueConnectIn(MRA_FILES_QUEUE_ITEM *dat) if (dwAddrListSize) {
dat->hWaitHandle = CreateEvent(NULL, TRUE, FALSE, NULL);
if (dat->bSending == FALSE) // запрашиваем зеркальное соединение, тк сами подключится не смогли
- MraFileTransferAck(FILE_TRANSFER_MIRROR, szEmail, dat->dwIDRequest, (LPBYTE)szAddrList, dwAddrListSize);
+ MraFileTransferAck(FILE_TRANSFER_MIRROR, szEmail, dat->dwIDRequest, szAddrList);
else { // здесь отправляем запрос на передачу(установление соединения)
// создаём текстовый список файлов для отправки другой стороне
LPWSTR lpwszFiles, lpwszCurPos;
@@ -693,7 +692,7 @@ DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hFilesQueueHandle, DWORD dwFlags MraAddrListGetFromBuff(szAddresses, &dat->malAddrList);
MraAddrListStoreToContact(dat->hContact, &dat->malAddrList);
{
- mt_lock l(pmrafqFilesQueue);
+ mir_cslock l(pmrafqFilesQueue->cs);
ListMTItemAdd(pmrafqFilesQueue, dat, dat);
}
@@ -898,13 +897,13 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) if (bFailed) {
CMStringA szEmail;
if (mraGetStringA(dat->hContact, "e-mail", szEmail))
- MraFileTransferAck(FILE_TRANSFER_STATUS_ERROR, szEmail, dat->dwIDRequest, NULL, 0);
+ MraFileTransferAck(FILE_TRANSFER_STATUS_ERROR, szEmail, dat->dwIDRequest, CMStringA());
ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)dat->dwIDRequest, 0);
}
else ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, (HANDLE)dat->dwIDRequest, 0);
- mt_lock l(pmrafqFilesQueue);
+ mir_cslock l(pmrafqFilesQueue->cs);
MraFilesQueueItemFree(dat);
}
}
@@ -954,7 +953,7 @@ DWORD CMraProto::MraFilesQueueAddSend(HANDLE hFilesQueueHandle, DWORD dwFlags, M if (pdwIDRequest) *pdwIDRequest = dat->dwIDRequest;
{
- mt_lock l(pmrafqFilesQueue);
+ mir_cslock l(pmrafqFilesQueue->cs);
ListMTItemAdd(pmrafqFilesQueue, dat, dat);
}
MRA_FILES_THREADPROC_PARAMS *pmftpp = (MRA_FILES_THREADPROC_PARAMS*)mir_calloc(sizeof(MRA_FILES_THREADPROC_PARAMS));
@@ -1140,12 +1139,12 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) if (bFailed) {
CMStringA szEmail;
if (mraGetStringA(dat->hContact, "e-mail", szEmail))
- MraFileTransferAck(FILE_TRANSFER_STATUS_ERROR, szEmail, dat->dwIDRequest, NULL, 0);
+ MraFileTransferAck(FILE_TRANSFER_STATUS_ERROR, szEmail, dat->dwIDRequest, CMStringA());
ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)dat->dwIDRequest, 0);
}
else ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, (HANDLE)dat->dwIDRequest, 0);
- mt_lock l(pmrafqFilesQueue);
+ mir_cslock l(pmrafqFilesQueue->cs);
MraFilesQueueItemFree(dat);
}
diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp index 0b6c61130d..22847daec3 100644 --- a/protocols/MRA/src/MraIcons.cpp +++ b/protocols/MRA/src/MraIcons.cpp @@ -113,7 +113,7 @@ void InitXStatusIcons() sid.pszName = szBuff;
int iCurIndex = i+IDI_XSTATUS1-1;
- sid.ptszDescription = lpcszXStatusNameDef[i];
+ sid.ptszDescription = (TCHAR*)lpcszXStatusNameDef[i];
sid.iDefaultIndex = -iCurIndex;
hXStatusAdvancedStatusIcons[i] = Skin_AddIcon(&sid);
diff --git a/protocols/MRA/src/MraMPop.cpp b/protocols/MRA/src/MraMPop.cpp index 4855d5bd10..9796744f29 100644 --- a/protocols/MRA/src/MraMPop.cpp +++ b/protocols/MRA/src/MraMPop.cpp @@ -31,7 +31,7 @@ DWORD MraMPopSessionQueueInitialize(HANDLE *phMPopSessionQueue) pmpsqMPopSessionQueue->bKeyValid = false;
pmpsqMPopSessionQueue->lpszMPOPKey = NULL;
pmpsqMPopSessionQueue->dwMPOPKeySize = 0;
- FifoMTInitialize(pmpsqMPopSessionQueue, 0);
+ ListMTInitialize(pmpsqMPopSessionQueue);
*phMPopSessionQueue = (HANDLE)pmpsqMPopSessionQueue;
return NO_ERROR;
}
@@ -59,7 +59,7 @@ void MraMPopSessionQueueDestroy(HANDLE hMPopSessionQueue) MRA_MPOP_SESSION_QUEUE *pmpsqMPopSessionQueue = (MRA_MPOP_SESSION_QUEUE*)hMPopSessionQueue;
MraMPopSessionQueueClear(hMPopSessionQueue);
- FifoMTDestroy(pmpsqMPopSessionQueue);
+ ListMTDestroy(pmpsqMPopSessionQueue);
mir_free(pmpsqMPopSessionQueue);
}
diff --git a/protocols/MRA/src/MraPopUp.cpp b/protocols/MRA/src/MraPopUp.cpp index e65805a267..bfbd29ee70 100644 --- a/protocols/MRA/src/MraPopUp.cpp +++ b/protocols/MRA/src/MraPopUp.cpp @@ -125,7 +125,7 @@ INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPAR return FALSE;
}
-int CMraProto::OnPopupOptInit(WPARAM wParam, LPARAM lParam)
+int CMraProto::OnPopupOptInit(WPARAM wParam, LPARAM)
{
if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
@@ -163,7 +163,7 @@ LRESULT CALLBACK MraPopupDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM l case UM_INITPOPUP:
if (dat->iPopupType == MRA_POPUP_TYPE_EMAIL_STATUS) {
// update/load avatar
- dat->ppro->MraAvatarsQueueGetAvatarSimple(dat->ppro->hAvatarsQueueHandle, GAIF_FORCE, PUGetContact(hWndDlg), 0);
+ dat->ppro->MraAvatarsQueueGetAvatarSimple(dat->ppro->hAvatarsQueueHandle, GAIF_FORCE, PUGetContact(hWndDlg));
// delete old email popup
if (dat->ppro->hWndEMailPopupStatus)
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 9bc974b01a..c7af6e4b1e 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -75,7 +75,7 @@ CMraProto::~CMraProto() DeleteCriticalSection(&csCriticalSectionSend);
}
-INT_PTR CMraProto::MraCreateAccMgrUI(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraCreateAccMgrUI(WPARAM, LPARAM lParam)
{
return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MRAACCOUNT),
(HWND)lParam, DlgProcAccount, LPARAM(this));
@@ -161,7 +161,7 @@ MCONTACT CMraProto::AddToList(int flags, PROTOSEARCHRESULT *psr) return AddToListByEmail(psr->email, psr->nick, psr->firstName, psr->lastName, flags);
}
-MCONTACT CMraProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent)
+MCONTACT CMraProto::AddToListByEvent(int, int, HANDLE hDbEvent)
{
DBEVENTINFO dbei = { 0 };
dbei.cbSize = sizeof(dbei);
@@ -233,20 +233,20 @@ int CMraProto::AuthDeny(HANDLE hDBEvent, const TCHAR* szReason) return 0;
}
-int CMraProto::AuthRecv(MCONTACT hContact, PROTORECVEVENT* pre)
+int CMraProto::AuthRecv(MCONTACT, PROTORECVEVENT* pre)
{
Proto_AuthRecv(m_szModuleName, pre);
return 0;
}
-int CMraProto::AuthRequest(MCONTACT hContact, const TCHAR *lptszMessage)
+int CMraProto::AuthRequest(MCONTACT, const TCHAR*)
{
return 1;
}
/////////////////////////////////////////////////////////////////////////////////////////
-HANDLE CMraProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath)
+HANDLE CMraProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR *szPath)
{
if (szPath != NULL)
if (MraFilesQueueAccept(hFilesQueueHandle, (DWORD)hTransfer, szPath, mir_tstrlen(szPath)) == NO_ERROR)
@@ -272,7 +272,7 @@ int CMraProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR*) /////////////////////////////////////////////////////////////////////////////////////////
-DWORD_PTR CMraProto::GetCaps(int type, MCONTACT hContact)
+DWORD_PTR CMraProto::GetCaps(int type, MCONTACT)
{
switch (type) {
case PFLAGNUM_1:
@@ -309,7 +309,7 @@ DWORD_PTR CMraProto::GetCaps(int type, MCONTACT hContact) }
}
-int CMraProto::GetInfo(MCONTACT hContact, int infoType)
+int CMraProto::GetInfo(MCONTACT hContact, int)
{
return MraUpdateContactInfo(hContact) != 0;
}
@@ -323,16 +323,16 @@ HANDLE CMraProto::SearchBasic(const TCHAR *id) HANDLE CMraProto::SearchByEmail(const TCHAR *email)
{
- if (m_bLoggedIn && email)
- return MraWPRequestByEMail(NULL, ACKTYPE_SEARCH, CMStringA(email));
+ if (m_bLoggedIn && email) {
+ CMStringA szEmail(email);
+ return MraWPRequestByEMail(NULL, ACKTYPE_SEARCH, szEmail);
+ }
return NULL;
}
HANDLE CMraProto::SearchByName(const TCHAR *pszNick, const TCHAR *pszFirstName, const TCHAR *pszLastName)
{
- INT_PTR iRet = 0;
-
if (m_bLoggedIn && (*pszNick || *pszFirstName || *pszLastName)) {
DWORD dwRequestFlags = 0;
if (*pszNick) SetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_NICKNAME);
@@ -371,7 +371,7 @@ int CMraProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) /////////////////////////////////////////////////////////////////////////////////////////
-int CMraProto::SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList)
+int CMraProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONTACT *hContactsList)
{
INT_PTR iRet = 0;
@@ -397,15 +397,16 @@ int CMraProto::SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTAC return iRet;
}
-HANDLE CMraProto::SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles)
+HANDLE CMraProto::SendFile(MCONTACT hContact, const TCHAR*, TCHAR **ppszFiles)
{
- INT_PTR iRet = 0;
+ if (!m_bLoggedIn || !hContact || !ppszFiles)
+ return NULL;
- if (m_bLoggedIn && hContact && ppszFiles) {
- size_t dwFilesCount;
- for (dwFilesCount = 0; ppszFiles[dwFilesCount]; dwFilesCount++);
- MraFilesQueueAddSend(hFilesQueueHandle, 0, hContact, ppszFiles, dwFilesCount, (DWORD*)&iRet);
- }
+ size_t dwFilesCount;
+ for (dwFilesCount = 0; ppszFiles[dwFilesCount]; dwFilesCount++);
+
+ DWORD iRet = 0;
+ MraFilesQueueAddSend(hFilesQueueHandle, 0, hContact, ppszFiles, dwFilesCount, &iRet);
return (HANDLE)iRet;
}
@@ -417,33 +418,31 @@ int CMraProto::SendMsg(MCONTACT hContact, int flags, const char *lpszMessage) }
DWORD dwFlags = 0;
- LPWSTR lpwszMessage = NULL;
- int iRet = 0;
+ CMStringW wszMessage;
if (flags & PREF_UNICODE)
- lpwszMessage = (LPWSTR)(lpszMessage + mir_strlen(lpszMessage) + 1);
+ wszMessage = (LPWSTR)(lpszMessage + mir_strlen(lpszMessage) + 1);
else if (flags & PREF_UTF)
- lpwszMessage = mir_utf8decodeT(lpszMessage);
+ wszMessage = ptrW(mir_utf8decodeT(lpszMessage));
else
- lpwszMessage = mir_a2t(lpszMessage);
+ wszMessage = ptrW(mir_a2t(lpszMessage));
- if (!lpwszMessage) {
+ if (wszMessage.IsEmpty()) {
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)"Cant allocate buffer for convert to unicode.");
return 0;
}
CMStringA szEmail;
- if (mraGetStringA(hContact, "e-mail", szEmail)) {
- BOOL bSlowSend = getByte("SlowSend", MRA_DEFAULT_SLOW_SEND);
- if (getByte("RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE) && (MraContactCapabilitiesGet(hContact) & FEATURE_FLAG_RTF_MESSAGE))
- dwFlags |= MESSAGE_FLAG_RTF;
-
- iRet = MraMessage(bSlowSend, hContact, ACKTYPE_MESSAGE, dwFlags, szEmail, lpwszMessage, NULL, 0);
- if (bSlowSend == FALSE)
- ProtoBroadcastAckAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)iRet, 0);
- }
-
- mir_free(lpwszMessage);
+ if (!mraGetStringA(hContact, "e-mail", szEmail))
+ return 0;
+
+ BOOL bSlowSend = getByte("SlowSend", MRA_DEFAULT_SLOW_SEND);
+ if (getByte("RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE) && (MraContactCapabilitiesGet(hContact) & FEATURE_FLAG_RTF_MESSAGE))
+ dwFlags |= MESSAGE_FLAG_RTF;
+
+ int iRet = MraMessage(bSlowSend, hContact, ACKTYPE_MESSAGE, dwFlags, szEmail, wszMessage, NULL, 0);
+ if (bSlowSend == FALSE)
+ ProtoBroadcastAckAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)iRet, 0);
return iRet;
}
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index 6f81a4a58a..aa076c20ec 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -211,11 +211,11 @@ struct CMraProto : public PROTO<CMraProto> DWORD MraAuthorize(const CMStringA &szEmail);
DWORD MraChangeStatus(DWORD dwStatus, const CMStringA &szStatusUri, const CMStringW &wszStatusTitle, const CMStringW &wszStatusDesc, DWORD dwFutureFlags);
DWORD MraFileTransfer(const CMStringA &szEmail, DWORD dwIdRequest, DWORD dwFilesTotalSize, const CMStringW &lpwszFiles, const CMStringA &szAddresses);
- DWORD MraFileTransferAck(DWORD dwStatus, const CMStringA &szEmail, DWORD dwIdRequest, LPBYTE lpbDescription, size_t dwDescriptionSize);
+ DWORD MraFileTransferAck(DWORD dwStatus, const CMStringA &szEmail, DWORD dwIdRequest, const CMStringA &szDescription);
HANDLE MraWPRequestW(MCONTACT hContact, DWORD dwAckType, DWORD dwRequestFlags, const CMStringA &szUser, const CMStringA &szDomain, const CMStringW &wszNickName, const CMStringW &wszFirstName, const CMStringW &wszLastName, DWORD dwSex, DWORD dwDate1, DWORD dwDate2, DWORD dwCityID, DWORD dwZodiak, DWORD dwBirthdayMonth, DWORD dwBirthdayDay, DWORD dwCountryID, DWORD dwOnline);
HANDLE MraWPRequestByEMail(MCONTACT hContact, DWORD dwAckType, CMStringA &szEmail);
DWORD MraGame(const CMStringA &szEmail, DWORD dwGameSessionID, DWORD dwGameMsg, DWORD dwGameMsgID, const CMStringA &lpszData);
- DWORD MraLogin2W(CMStringA &szLogin, CMStringA &szPassword, DWORD dwStatus, CMStringA &szStatusUri, CMStringW &wszStatusTitle, CMStringW &wszStatusDesc, DWORD dwFutureFlags, CMStringA &szUserAgentFormatted, CMStringA &szUserAgent);
+ DWORD MraLogin2W(const CMStringA &szLogin, const CMStringA &szPassword, DWORD dwStatus, const CMStringA &szStatusUri, CMStringW &wszStatusTitle, CMStringW &wszStatusDesc, DWORD dwFutureFlags, CMStringA &szUserAgentFormatted, CMStringA &szUserAgent);
DWORD MraSMSW(MCONTACT hContact, const CMStringA &lpszPhone, const CMStringW &lpwszMessage);
DWORD MraProxy(const CMStringA &szEmail, DWORD dwIDRequest, DWORD dwDataType, const CMStringA &lpszData, const CMStringA &szAddresses, MRA_GUID mguidSessionID);
DWORD MraProxyAck(DWORD dwStatus, const CMStringA &szEmail, DWORD dwIDRequest, DWORD dwDataType, const CMStringA &lpszData, const CMStringA &szAddresses, MRA_GUID mguidSessionID);
@@ -249,7 +249,7 @@ struct CMraProto : public PROTO<CMraProto> DWORD MraSetContactStatus(MCONTACT hContact, DWORD dwNewStatus);
DWORD MraContactCapabilitiesGet(MCONTACT hContact);
void MraContactCapabilitiesSet(MCONTACT hContact, DWORD dwFutureFlags);
- void MraUpdateEmailStatus(const CMStringA &szFrom, const CMStringA &szSubject, DWORD dwDate, DWORD dwUIDL, bool force_display);
+ void MraUpdateEmailStatus(const CMStringA &szFrom, const CMStringA &szSubject, bool force_display);
DWORD MraConvertToRTFW(const CMStringW &wszMessage, CMStringA &szMessageRTF);
DWORD StartConnect();
@@ -341,7 +341,7 @@ struct CMraProto : public PROTO<CMraProto> void MraAvatarsSetContactTime (MCONTACT hContact, LPSTR lpszValueName, SYSTEMTIME *pstTime);
DWORD MraAvatarsGetFileName(HANDLE hAvatarsQueueHandle, MCONTACT hContact, DWORD dwFormat, CMStringW &res);
DWORD MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFlags, MCONTACT hContact, DWORD *pdwAvatarsQueueID, DWORD *pdwFormat, LPTSTR lpszPath);
- DWORD MraAvatarsQueueGetAvatarSimple(HANDLE hAvatarsQueueHandle, DWORD dwFlags, MCONTACT hContact, DWORD dwSourceID);
+ DWORD MraAvatarsQueueGetAvatarSimple(HANDLE hAvatarsQueueHandle, DWORD dwFlags, MCONTACT hContact);
DWORD MraAvatarsDeleteContactAvatarFile(HANDLE hAvatarsQueueHandle, MCONTACT hContact);
void __cdecl MraAvatarsThreadProc(LPVOID lpParameter);
diff --git a/protocols/MRA/src/MraRTFMsg.cpp b/protocols/MRA/src/MraRTFMsg.cpp index ba61aae39f..f77901a825 100644 --- a/protocols/MRA/src/MraRTFMsg.cpp +++ b/protocols/MRA/src/MraRTFMsg.cpp @@ -138,7 +138,7 @@ DWORD MraTextToRTFData(LPSTR lpszMessage, size_t dwMessageSize, LPSTR lpszMessag return ERROR_INVALID_HANDLE;
}
-DWORD MraSymbolsToRTFTags(DWORD dwFlags, LPSTR lpszMessage, size_t dwMessageSize, LPSTR lpszMessageConverted, size_t dwMessageConvertedBuffSize, size_t *pdwMessageConvertedSize)
+DWORD MraSymbolsToRTFTags(LPSTR lpszMessage, size_t dwMessageSize, LPSTR lpszMessageConverted, size_t dwMessageConvertedBuffSize, size_t *pdwMessageConvertedSize)
{
DWORD dwRetErrorCode = NO_ERROR;
LPSTR lpszFounded[SYMBOLS_COUNT], lpszMessageConvertedCur, lpszMessageCur, lpszMessageCurPrev, lpszMessageConvertedMax;
@@ -229,12 +229,12 @@ DWORD CMraProto::MraConvertToRTFW(const CMStringW &wszMessage, CMStringA &szMess lpszStrikeOut = (lf.lfStrikeOut? "\\strike1":lpszNotfink);
lpszMessageRTFCur += mir_snprintf(lpszMessageRTFCur, (szMessageRTF.GetLength()-(lpszMessageRTFCur-lpszBase)), "\\viewkind4\\uc1\\pard\\cf1\\f0\\fs%lu%s%s%s%s", dwFontSize, lpszBold, lpszItalic, lpszUnderline, lpszStrikeOut);
- if ( !MraSymbolsToRTFTags(0, lpszMessage, wszMessage.GetLength(), lpszMessageRTFCur, (szMessageRTF.GetLength()-(lpszMessageRTFCur-lpszBase)), &dwtm)) {
+ if (!MraSymbolsToRTFTags(lpszMessage, wszMessage.GetLength(), lpszMessageRTFCur, (szMessageRTF.GetLength() - (lpszMessageRTFCur - lpszBase)), &dwtm)) {
lpszMessageRTFCur += dwtm;
- if ((lpszBase + szMessageRTF.GetLength()) >= (lpszMessageRTFCur+sizeof(PAR)+sizeof(CRLF)+2)) {
- memcpy(lpszMessageRTFCur, PAR, sizeof(PAR));lpszMessageRTFCur += (sizeof(PAR)-1);
- memcpy(lpszMessageRTFCur, CRLF, sizeof(CRLF));lpszMessageRTFCur += (sizeof(CRLF)-1);
- memcpy(lpszMessageRTFCur, "}", 2);lpszMessageRTFCur += 2;
+ if ((lpszBase + szMessageRTF.GetLength()) >= (lpszMessageRTFCur + sizeof(PAR) + sizeof(CRLF) + 2)) {
+ memcpy(lpszMessageRTFCur, PAR, sizeof(PAR)); lpszMessageRTFCur += (sizeof(PAR) - 1);
+ memcpy(lpszMessageRTFCur, CRLF, sizeof(CRLF)); lpszMessageRTFCur += (sizeof(CRLF) - 1);
+ memcpy(lpszMessageRTFCur, "}", 2); lpszMessageRTFCur += 2;
debugLogA("%s\n", szMessageRTF);
return NO_ERROR;
}
diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp index b25fb0033c..7dadd9cf3c 100644 --- a/protocols/MRA/src/MraSendCommand.cpp +++ b/protocols/MRA/src/MraSendCommand.cpp @@ -298,7 +298,7 @@ DWORD CMraProto::MraFileTransfer(const CMStringA &szEmail, DWORD dwIDRequest, DW }
// Ответ на отправку файлов
-DWORD CMraProto::MraFileTransferAck(DWORD dwStatus, const CMStringA &szEmail, DWORD dwIDRequest, LPBYTE lpbDescription, size_t dwDescriptionSize)
+DWORD CMraProto::MraFileTransferAck(DWORD dwStatus, const CMStringA &szEmail, DWORD dwIDRequest, const CMStringA &szDescription)
{
if (szEmail.GetLength() <= 4)
return 0;
@@ -307,7 +307,7 @@ DWORD CMraProto::MraFileTransferAck(DWORD dwStatus, const CMStringA &szEmail, DW buf.SetUL(dwStatus);
buf.SetLPSLowerCase(szEmail);
buf.SetUL(dwIDRequest);
- buf.SetLPS(lpbDescription);
+ buf.SetLPS(szDescription);
return MraSendCMD(MRIM_CS_FILE_TRANSFER_ACK, buf.Data(), buf.Len());
}
@@ -413,9 +413,8 @@ DWORD CMraProto::MraGame(const CMStringA &szEmail, DWORD dwGameSessionID, DWORD }
// Авторизация
-DWORD CMraProto::MraLogin2W(CMStringA &szLogin, CMStringA &szPassword, DWORD dwStatus, CMStringA &szStatusUri, CMStringW &wszStatusTitle, CMStringW &wszStatusDesc, DWORD dwFutureFlags, CMStringA &szUserAgentFormatted, CMStringA &szUserAgent)
+DWORD CMraProto::MraLogin2W(const CMStringA &szLogin, const CMStringA &szPassword, DWORD dwStatus, const CMStringA &szStatusUri, CMStringW &wszStatusTitle, CMStringW &wszStatusDesc, DWORD dwFutureFlags, CMStringA &szUserAgentFormatted, CMStringA &szUserAgent)
{
- if (szStatusUri.GetLength() > SPEC_STATUS_URI_MAX) szStatusUri.Truncate(SPEC_STATUS_URI_MAX);
if (wszStatusTitle.GetLength() > STATUS_TITLE_MAX) wszStatusTitle.Truncate(STATUS_TITLE_MAX);
if (wszStatusDesc.GetLength() > STATUS_DESC_MAX) wszStatusDesc.Truncate(STATUS_DESC_MAX);
if (szUserAgentFormatted.GetLength() > USER_AGENT_MAX) szUserAgentFormatted.Truncate(USER_AGENT_MAX);
diff --git a/protocols/MRA/src/MraSendQueue.cpp b/protocols/MRA/src/MraSendQueue.cpp index 41a90c55bc..4e17b3a4f0 100644 --- a/protocols/MRA/src/MraSendQueue.cpp +++ b/protocols/MRA/src/MraSendQueue.cpp @@ -31,7 +31,7 @@ DWORD MraSendQueueInitialize(DWORD dwSendTimeOutInterval, HANDLE *phSendQueueHan if (!pmrasqSendQueue)
return GetLastError();
- DWORD dwRetErrorCode = ListMTInitialize(pmrasqSendQueue, 0);
+ DWORD dwRetErrorCode = ListMTInitialize(pmrasqSendQueue);
if (dwRetErrorCode == NO_ERROR) {
pmrasqSendQueue->dwSendTimeOutInterval = dwSendTimeOutInterval;
*phSendQueueHandle = (HANDLE)pmrasqSendQueue;
@@ -47,7 +47,7 @@ void MraSendQueueDestroy(HANDLE hSendQueueHandle) MRA_SEND_QUEUE *pmrasqSendQueue = (MRA_SEND_QUEUE*)hSendQueueHandle;
MRA_SEND_QUEUE_ITEM *pmrasqiSendQueueItem;
{
- mt_lock l(pmrasqSendQueue);
+ mir_cslock l(pmrasqSendQueue->cs);
while ( !ListMTItemGetFirst(pmrasqSendQueue, NULL, (LPVOID*)&pmrasqiSendQueueItem)) {
ListMTItemDelete(pmrasqSendQueue, pmrasqiSendQueueItem);
mir_free(pmrasqiSendQueueItem);
@@ -79,7 +79,7 @@ DWORD MraSendQueueAdd(HANDLE hSendQueueHandle, DWORD dwCMDNum, DWORD dwFlags, MC pmrasqiSendQueueItem->lpbData = lpbData;
pmrasqiSendQueueItem->dwDataSize = dwDataSize;
- mt_lock l(pmrasqSendQueue);
+ mir_cslock l(pmrasqSendQueue->cs);
ListMTItemAdd(pmrasqSendQueue, pmrasqiSendQueueItem, pmrasqiSendQueueItem);
return 0;
}
@@ -93,7 +93,7 @@ DWORD MraSendQueueFree(HANDLE hSendQueueHandle, DWORD dwCMDNum) MRA_SEND_QUEUE_ITEM *pmrasqiSendQueueItem;
LIST_MT_ITERATOR lmtiIterator;
- mt_lock l(pmrasqSendQueue);
+ mir_cslock l(pmrasqSendQueue->cs);
ListMTIteratorMoveFirst(pmrasqSendQueue, &lmtiIterator);
do {
if ( !ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&pmrasqiSendQueueItem))
@@ -117,7 +117,7 @@ DWORD MraSendQueueFind(HANDLE hSendQueueHandle, DWORD dwCMDNum, DWORD *pdwFlags, MRA_SEND_QUEUE_ITEM *pmrasqiSendQueueItem;
LIST_MT_ITERATOR lmtiIterator;
- mt_lock l(pmrasqSendQueue);
+ mir_cslock l(pmrasqSendQueue->cs);
ListMTIteratorMoveFirst(pmrasqSendQueue, &lmtiIterator);
do {
if ( !ListMTIteratorGet(&lmtiIterator, NULL, (LPVOID*)&pmrasqiSendQueueItem))
@@ -145,7 +145,7 @@ DWORD MraSendQueueFindOlderThan(HANDLE hSendQueueHandle, DWORD dwTime, DWORD *pd (*((DWORDLONG*)&ftExpireTime))-=((DWORDLONG)dwTime*FILETIME_SECOND);
MRA_SEND_QUEUE *pmrasqSendQueue = (MRA_SEND_QUEUE*)hSendQueueHandle;
- mt_lock l(pmrasqSendQueue);
+ mir_cslock l(pmrasqSendQueue->cs);
LIST_MT_ITERATOR lmtiIterator;
ListMTIteratorMoveFirst(pmrasqSendQueue, &lmtiIterator);
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 54b57e5a4e..11f3e8d2a2 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -29,7 +29,7 @@ LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPA CMStringA MraGetSelfVersionString()
{
WORD v[4];
- DWORD dwMirVer = CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
+ CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
LPSTR lpszSecIM = ServiceExists("SecureIM/IsContactSecured") ? " + SecureIM" : "";
CMStringA szSelfVersion;
@@ -569,7 +569,7 @@ bool CMraProto::MraUpdateContactInfo(MCONTACT hContact) if (IsContactMra(hContact)) {
CMStringA szEmail;
if (mraGetStringA(hContact, "e-mail", szEmail)) {
- MraAvatarsQueueGetAvatarSimple(hAvatarsQueueHandle, GAIF_FORCE, hContact, 0);
+ MraAvatarsQueueGetAvatarSimple(hAvatarsQueueHandle, GAIF_FORCE, hContact);
if (MraWPRequestByEMail(hContact, ACKTYPE_GETINFO, szEmail))
return true;
}
@@ -623,7 +623,7 @@ DWORD CMraProto::MraSetContactStatus(MCONTACT hContact, DWORD dwNewStatus) if (bChatAgent)
MraChatSessionNew(hContact);
}
- MraAvatarsQueueGetAvatarSimple(hAvatarsQueueHandle, 0, hContact, 0);
+ MraAvatarsQueueGetAvatarSimple(hAvatarsQueueHandle, 0, hContact);
}
setWord(hContact, "Status", (WORD)dwNewStatus);
@@ -631,7 +631,7 @@ DWORD CMraProto::MraSetContactStatus(MCONTACT hContact, DWORD dwNewStatus) return dwOldStatus;
}
-void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA &pszSubject, DWORD dwDate, DWORD dwUIDL, bool force_display)
+void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA &pszSubject, bool force_display)
{
BOOL bTrayIconNewMailNotify;
WCHAR szStatusText[MAX_SECONDLINE];
@@ -1144,7 +1144,7 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w DWORDLONG dwBlogStatusID;
TCHAR szBuff[MICBLOG_STATUS_MAX];
- size_t dwBuffSize = GetDlgItemText(hWndDlg, IDC_MSG_TO_SEND, szBuff, SIZEOF(szBuff));
+ GetDlgItemText(hWndDlg, IDC_MSG_TO_SEND, szBuff, SIZEOF(szBuff));
if (dat->hContact) {
dwFlags = (MRIM_BLOG_STATUS_REPLY | MRIM_BLOG_STATUS_NOTIFY);
@@ -1224,85 +1224,83 @@ DWORD GetYears(CONST PSYSTEMTIME pcstSystemTime) DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD dwFileNameLen, LPWSTR lpszRetFilePathName, DWORD dwRetFilePathLen, DWORD *pdwRetFilePathLen)
{
- DWORD dwRetErrorCode;
-
- if (lpszFolder && dwFolderLen && lpszFileName && dwFileNameLen) {
- TCHAR szPath[32768];
- DWORD dwPathLen, dwRecDeepAllocated, dwRecDeepCurPos, dwFilePathLen;
- RECURSION_DATA_STACK_ITEM *prdsiItems;
-
- if (dwFolderLen == -1) dwFolderLen = mir_wstrlen(lpszFolder);
- if (dwFileNameLen == -1) dwFileNameLen = mir_wstrlen(lpszFileName);
-
- dwRecDeepCurPos = 0;
- dwRecDeepAllocated = RECURSION_DATA_STACK_ITEMS_MIN;
- prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_calloc(dwRecDeepAllocated*sizeof(RECURSION_DATA_STACK_ITEM));
- if (prdsiItems) {
- dwPathLen = dwFolderLen;
- memcpy(szPath, lpszFolder, (dwPathLen*sizeof(WCHAR)));
- if (szPath[(dwPathLen - 1)] != '\\') {
- szPath[dwPathLen] = '\\';
- dwPathLen++;
- }
- szPath[dwPathLen] = 0;
- mir_tstrcat(szPath, _T("*.*"));
-
- prdsiItems[dwRecDeepCurPos].dwFileNameLen = 0;
- prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0);
- if (prdsiItems[dwRecDeepCurPos].hFind != INVALID_HANDLE_VALUE) {
- dwRetErrorCode = ERROR_FILE_NOT_FOUND;
- do {
- dwPathLen -= prdsiItems[dwRecDeepCurPos].dwFileNameLen;
-
- while (dwRetErrorCode == ERROR_FILE_NOT_FOUND && FindNextFile(prdsiItems[dwRecDeepCurPos].hFind, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData)) {
- if (prdsiItems[dwRecDeepCurPos].w32fdFindFileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {// folder
- if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T("."), 1) != CSTR_EQUAL)
- if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T(".."), 2) != CSTR_EQUAL) {
- prdsiItems[dwRecDeepCurPos].dwFileNameLen = (mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName) + 1);
- memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, (prdsiItems[dwRecDeepCurPos].dwFileNameLen*sizeof(WCHAR)));
- mir_tstrcat(szPath, _T("\\*.*"));
- dwPathLen += prdsiItems[dwRecDeepCurPos].dwFileNameLen;
-
- dwRecDeepCurPos++;
- if (dwRecDeepCurPos == dwRecDeepAllocated) { // need more space
- dwRecDeepAllocated += RECURSION_DATA_STACK_ITEMS_MIN;
- prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_realloc(prdsiItems, dwRecDeepAllocated*sizeof(RECURSION_DATA_STACK_ITEM));
- if (prdsiItems == NULL) {
- dwRecDeepCurPos = 0;
- dwRetErrorCode = GetLastError();
- break;
- }
- }
- prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0);
- }
- }
- else {// file
- if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, lpszFileName, dwFileNameLen) == CSTR_EQUAL) {
- prdsiItems[dwRecDeepCurPos].dwFileNameLen = mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName);
- memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, ((prdsiItems[dwRecDeepCurPos].dwFileNameLen + 1)*sizeof(WCHAR)));
- dwFilePathLen = (dwPathLen + prdsiItems[dwRecDeepCurPos].dwFileNameLen);
-
- if (pdwRetFilePathLen) (*pdwRetFilePathLen) = dwFilePathLen;
- if (lpszRetFilePathName && dwRetFilePathLen) {
- dwFilePathLen = min(dwFilePathLen, dwRetFilePathLen);
- memcpy(lpszRetFilePathName, szPath, ((dwFilePathLen + 1)*sizeof(WCHAR)));
- }
-
- dwRetErrorCode = NO_ERROR;
+ if (!lpszFolder || !dwFolderLen || !lpszFileName || !dwFileNameLen)
+ return ERROR_INVALID_HANDLE;
+
+ TCHAR szPath[32768];
+ DWORD dwPathLen, dwRecDeepAllocated, dwRecDeepCurPos, dwFilePathLen;
+ RECURSION_DATA_STACK_ITEM *prdsiItems;
+
+ if (dwFolderLen == -1) dwFolderLen = mir_wstrlen(lpszFolder);
+ if (dwFileNameLen == -1) dwFileNameLen = mir_wstrlen(lpszFileName);
+
+ dwRecDeepCurPos = 0;
+ dwRecDeepAllocated = RECURSION_DATA_STACK_ITEMS_MIN;
+ prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_calloc(dwRecDeepAllocated*sizeof(RECURSION_DATA_STACK_ITEM));
+ if (prdsiItems == NULL)
+ return GetLastError();
+
+ DWORD dwRetErrorCode = ERROR_FILE_NOT_FOUND;
+ dwPathLen = dwFolderLen;
+ memcpy(szPath, lpszFolder, (dwPathLen*sizeof(WCHAR)));
+ if (szPath[(dwPathLen - 1)] != '\\') {
+ szPath[dwPathLen] = '\\';
+ dwPathLen++;
+ }
+ szPath[dwPathLen] = 0;
+ mir_tstrcat(szPath, _T("*.*"));
+
+ prdsiItems[dwRecDeepCurPos].dwFileNameLen = 0;
+ prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0);
+ if (prdsiItems[dwRecDeepCurPos].hFind != INVALID_HANDLE_VALUE) {
+ do {
+ dwPathLen -= prdsiItems[dwRecDeepCurPos].dwFileNameLen;
+
+ while (dwRetErrorCode == ERROR_FILE_NOT_FOUND && FindNextFile(prdsiItems[dwRecDeepCurPos].hFind, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData)) {
+ if (prdsiItems[dwRecDeepCurPos].w32fdFindFileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {// folder
+ if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T("."), 1) != CSTR_EQUAL)
+ if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T(".."), 2) != CSTR_EQUAL) {
+ prdsiItems[dwRecDeepCurPos].dwFileNameLen = (mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName) + 1);
+ memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, (prdsiItems[dwRecDeepCurPos].dwFileNameLen*sizeof(WCHAR)));
+ mir_tstrcat(szPath, _T("\\*.*"));
+ dwPathLen += prdsiItems[dwRecDeepCurPos].dwFileNameLen;
+
+ dwRecDeepCurPos++;
+ if (dwRecDeepCurPos == dwRecDeepAllocated) { // need more space
+ dwRecDeepAllocated += RECURSION_DATA_STACK_ITEMS_MIN;
+ prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_realloc(prdsiItems, dwRecDeepAllocated*sizeof(RECURSION_DATA_STACK_ITEM));
+ if (prdsiItems == NULL) {
+ dwRecDeepCurPos = 0;
+ dwRetErrorCode = GetLastError();
+ break;
}
}
+ prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0);
}
+ }
+ else {// file
+ if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, lpszFileName, dwFileNameLen) == CSTR_EQUAL) {
+ prdsiItems[dwRecDeepCurPos].dwFileNameLen = mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName);
+ memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, ((prdsiItems[dwRecDeepCurPos].dwFileNameLen + 1)*sizeof(WCHAR)));
+ dwFilePathLen = (dwPathLen + prdsiItems[dwRecDeepCurPos].dwFileNameLen);
+
+ if (pdwRetFilePathLen) (*pdwRetFilePathLen) = dwFilePathLen;
+ if (lpszRetFilePathName && dwRetFilePathLen) {
+ dwFilePathLen = min(dwFilePathLen, dwRetFilePathLen);
+ memcpy(lpszRetFilePathName, szPath, ((dwFilePathLen + 1)*sizeof(WCHAR)));
+ }
- if (prdsiItems) FindClose(prdsiItems[dwRecDeepCurPos].hFind);
- dwRecDeepCurPos--;
+ dwRetErrorCode = NO_ERROR;
+ }
}
- while (dwRecDeepCurPos != -1);
}
- mir_free(prdsiItems);
+
+ if (prdsiItems) FindClose(prdsiItems[dwRecDeepCurPos].hFind);
+ dwRecDeepCurPos--;
}
- else dwRetErrorCode = GetLastError();
+ while (dwRecDeepCurPos != -1);
}
- else dwRetErrorCode = ERROR_INVALID_HANDLE;
+ mir_free(prdsiItems);
return dwRetErrorCode;
}
diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp index 5371cec28c..30c114b49b 100644 --- a/protocols/MRA/src/Mra_menus.cpp +++ b/protocols/MRA/src/Mra_menus.cpp @@ -1,31 +1,31 @@ #include "Mra.h"
#include "proto.h"
-INT_PTR CMraProto::MraGotoInbox(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraGotoInbox(WPARAM, LPARAM)
{
MraMPopSessionQueueAddUrl(hMPopSessionQueue, MRA_WIN_INBOX_URL);
return 0;
}
-INT_PTR CMraProto::MraShowInboxStatus(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraShowInboxStatus(WPARAM, LPARAM)
{
- MraUpdateEmailStatus("", "", 0, 0, true);
+ MraUpdateEmailStatus("", "", true);
return 0;
}
-INT_PTR CMraProto::MraEditProfile(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraEditProfile(WPARAM, LPARAM)
{
MraMPopSessionQueueAddUrl(hMPopSessionQueue, MRA_EDIT_PROFILE_URL);
return 0;
}
-INT_PTR CMraProto::MraWebSearch(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraWebSearch(WPARAM, LPARAM)
{
CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)MRA_SEARCH_URL);
return 0;
}
-INT_PTR CMraProto::MraUpdateAllUsersInfo(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraUpdateAllUsersInfo(WPARAM, LPARAM)
{
if (!m_bLoggedIn)
return 0;
@@ -40,20 +40,20 @@ INT_PTR CMraProto::MraUpdateAllUsersInfo(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR CMraProto::MraCheckUpdatesUsersAvt(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraCheckUpdatesUsersAvt(WPARAM, LPARAM)
{
if (MessageBox(NULL, TranslateT("Are you sure?"), TranslateT(MRA_CHK_USERS_AVATARS_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
CMStringA szEmail;
if (mraGetStringA(hContact, "e-mail", szEmail))
if (!IsEMailChatAgent(szEmail))
- MraAvatarsQueueGetAvatarSimple(hAvatarsQueueHandle, 0, hContact, 0);
+ MraAvatarsQueueGetAvatarSimple(hAvatarsQueueHandle, 0, hContact);
}
}
return 0;
}
-INT_PTR CMraProto::MraRequestAuthForAll(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraRequestAuthForAll(WPARAM, LPARAM)
{
if (!m_bLoggedIn)
return 0;
@@ -69,7 +69,7 @@ INT_PTR CMraProto::MraRequestAuthForAll(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR CMraProto::MraRequestAuthorization(WPARAM hContact, LPARAM lParam)
+INT_PTR CMraProto::MraRequestAuthorization(WPARAM hContact, LPARAM)
{
if (!hContact || !m_bLoggedIn)
return 0;
@@ -93,7 +93,7 @@ INT_PTR CMraProto::MraRequestAuthorization(WPARAM hContact, LPARAM lParam) return 1;
}
-INT_PTR CMraProto::MraGrantAuthorization(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraGrantAuthorization(WPARAM wParam, LPARAM)
{
if (!m_bLoggedIn || !wParam)
return 0;
@@ -106,7 +106,7 @@ INT_PTR CMraProto::MraGrantAuthorization(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR CMraProto::MraSendEmail(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraSendEmail(WPARAM wParam, LPARAM)
{
DWORD dwContactEMailCount = GetContactEMailCount(wParam, FALSE);
if (dwContactEMailCount) {
@@ -123,7 +123,7 @@ INT_PTR CMraProto::MraSendEmail(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR CMraProto::MraSendPostcard(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraSendPostcard(WPARAM wParam, LPARAM)
{
DWORD dwContactEMailCount = GetContactEMailCount(wParam, FALSE);
if (dwContactEMailCount) {
@@ -140,7 +140,7 @@ INT_PTR CMraProto::MraSendPostcard(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR CMraProto::MraViewAlbum(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraViewAlbum(WPARAM wParam, LPARAM)
{
DWORD dwContactEMailMRCount = GetContactEMailCount(wParam, TRUE);
if (dwContactEMailMRCount) {
@@ -154,7 +154,7 @@ INT_PTR CMraProto::MraViewAlbum(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR CMraProto::MraReplyBlogStatus(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraReplyBlogStatus(WPARAM wParam, LPARAM)
{
if (!m_bLoggedIn)
return 0;
@@ -167,7 +167,7 @@ INT_PTR CMraProto::MraReplyBlogStatus(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR CMraProto::MraViewVideo(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraViewVideo(WPARAM wParam, LPARAM)
{
DWORD dwContactEMailMRCount = GetContactEMailCount(wParam, TRUE);
if (dwContactEMailMRCount) {
@@ -181,7 +181,7 @@ INT_PTR CMraProto::MraViewVideo(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR CMraProto::MraAnswers(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraAnswers(WPARAM wParam, LPARAM)
{
DWORD dwContactEMailMRCount = GetContactEMailCount(wParam, TRUE);
if (dwContactEMailMRCount) {
@@ -195,7 +195,7 @@ INT_PTR CMraProto::MraAnswers(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR CMraProto::MraWorld(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraWorld(WPARAM wParam, LPARAM)
{
DWORD dwContactEMailMRCount = GetContactEMailCount(wParam, TRUE);
if (dwContactEMailMRCount) {
@@ -211,7 +211,7 @@ INT_PTR CMraProto::MraWorld(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-int CMraProto::MraRebuildContactMenu(WPARAM hContact, LPARAM lParam)
+int CMraProto::MraRebuildContactMenu(WPARAM hContact, LPARAM)
{
bool bIsContactMRA, bHasEMail, bHasEMailMR, bChatAgent;
DWORD dwContactSeverFlags = 0;
@@ -275,7 +275,7 @@ int CMraProto::MraRebuildContactMenu(WPARAM hContact, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-int CMraProto::MraRebuildStatusMenu(WPARAM wParam, LPARAM lParam)
+int CMraProto::MraRebuildStatusMenu(WPARAM, LPARAM)
{
CHAR szServiceFunction[MAX_PATH * 2], *pszServiceFunctionName, szValueName[MAX_PATH];
strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction));
@@ -305,12 +305,12 @@ int CMraProto::MraRebuildStatusMenu(WPARAM wParam, LPARAM lParam) if (mraGetStringW(NULL, szValueName, szStatusTitle))
mi.ptszName = (TCHAR*)szStatusTitle.c_str();
else
- mi.ptszName = lpcszXStatusNameDef[i];
+ mi.ptszName = (TCHAR*)lpcszXStatusNameDef[i];
mi.icolibItem = hXStatusAdvancedStatusIcons[i];
}
else {
- mi.ptszName = lpcszXStatusNameDef[i];
+ mi.ptszName = (TCHAR*)lpcszXStatusNameDef[i];
mi.hIcon = NULL;
}
hXStatusMenuItems[i] = Menu_AddStatusMenuItem(&mi);
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 948d62cb46..596fe4d1b9 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -30,10 +30,8 @@ DWORD CMraProto::StartConnect() return ERROR_OPERATION_ABORTED;
}
-void CMraProto::MraThreadProc(LPVOID lpParameter)
+void CMraProto::MraThreadProc(LPVOID)
{
- DWORD dwRetErrorCode = NO_ERROR;
-
BOOL bConnected = FALSE;
CMStringA szHost;
DWORD dwConnectReTryCount, dwCurConnectReTryCount;
@@ -371,7 +369,7 @@ bool CMraProto::CmdHelloAck(BinBuffer &buf) if (!mraGetStringA(NULL, "e-mail", szEmail))
return false;
- MraLogin2W(szEmail, szPass, dwStatus, CMStringA(lpcszStatusUri[dwXStatus]), wszStatusTitle, wszStatusDesc, dwFutureFlags, szUserAgentFormatted, szSelfVersionString);
+ MraLogin2W(szEmail, szPass, dwStatus, lpcszStatusUri[dwXStatus], wszStatusTitle, wszStatusDesc, dwFutureFlags, szUserAgentFormatted, szSelfVersionString);
return true;
}
@@ -382,7 +380,7 @@ bool CMraProto::CmdLoginAck() m_dwNextPingSendTickTime = 0; // force send ping
MraSendCMD(MRIM_CS_PING, NULL, 0);
SetStatus(m_iDesiredStatus);
- MraAvatarsQueueGetAvatarSimple(hAvatarsQueueHandle, GAIF_FORCE, NULL, 0);
+ MraAvatarsQueueGetAvatarSimple(hAvatarsQueueHandle, GAIF_FORCE, NULL);
return true;
}
@@ -518,7 +516,7 @@ bool CMraProto::CmdUserInfo(BinBuffer &buf) }
else _CrtDbgBreak();
}
- MraUpdateEmailStatus("", "", 0, 0, false);
+ MraUpdateEmailStatus("", "", false);
return true;
}
@@ -1052,7 +1050,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) if (dwTemp == GET_CONTACTS_OK) { // received contact list
m_groups.destroy();
- DWORD dwGroupsCount, dwContactFlag, dwGroupID, dwContactSeverFlags, dwStatus, dwXStatus, dwFutureFlags, dwBlogStatusTime;
+ DWORD dwGroupsCount, dwContactFlag = 0, dwGroupID = 0, dwContactSeverFlags = 0, dwStatus = 0, dwXStatus, dwFutureFlags = 0, dwBlogStatusTime = 0;
ULARGE_INTEGER dwBlogStatusID;
CMStringA szGroupMask, szContactMask, szEmail, szString;
CMStringA szCustomPhones, szSpecStatusUri, szUserAgentFormatted;
@@ -1425,7 +1423,7 @@ bool CMraProto::CmdNewMail(BinBuffer &buf) DWORD dwSave = m_dwEmailMessagesUnread;
m_dwEmailMessagesUnread = dwUnreadCount;// store new value
if (getByte("IncrementalNewMailNotify", MRA_DEFAULT_INC_NEW_MAIL_NOTIFY) == 0 || dwSave < dwUnreadCount || dwUnreadCount == 0)
- MraUpdateEmailStatus(szEmail, szString, dwDate, dwUIDL, false);
+ MraUpdateEmailStatus(szEmail, szString, false);
return true;
}
@@ -1506,7 +1504,7 @@ bool CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader) dwAckType = m_dwEmailMessagesUnread;// save old value
m_dwEmailMessagesUnread = dwTemp;// store new value
if (getByte("IncrementalNewMailNotify", MRA_DEFAULT_INC_NEW_MAIL_NOTIFY) == 0 || dwAckType < dwTemp || dwTemp == 0)
- MraUpdateEmailStatus("", "", 0, 0, false);
+ MraUpdateEmailStatus("", "", false);
break;
case MRIM_CS_SMS_ACK:
@@ -1551,7 +1549,7 @@ bool CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader) // Сообщение
DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, CMStringA &plpsFrom, CMStringA &plpsText, CMStringA &plpsRFTText, CMStringA &plpsMultiChatData)
{
- DWORD dwRetErrorCode = NO_ERROR, dwBackColour;
+ DWORD dwBackColour;
CMStringA lpszMessageExt;
CMStringW wszMessage;
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index f114c956fe..3c34bdb147 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -1,7 +1,7 @@ #include "Mra.h"
#include "proto.h"
-const LPSTR lpcszStatusUri[] =
+LPCSTR lpcszStatusUri[] =
{
"", // offline // "status_0",
"STATUS_ONLINE", // "status_1",
@@ -64,7 +64,7 @@ const LPSTR lpcszStatusUri[] = NULL
};
-const LPWSTR lpcszXStatusNameDef[] =
+LPCWSTR lpcszXStatusNameDef[] =
{
LPGENT("None"),
LPGENT("Sick"),
@@ -159,7 +159,7 @@ void CMraProto::SetExtraIcons(MCONTACT hContact) ExtraIcon_SetIcon(hExtraInfo, hContact, (dwIconID != -1) ? gdiExtraStatusIconsItems[dwIconID].hIcolib : NULL);
}
-INT_PTR CMraProto::MraXStatusMenu(WPARAM wParam, LPARAM lParam, LPARAM param)
+INT_PTR CMraProto::MraXStatusMenu(WPARAM, LPARAM, LPARAM param)
{
if (MraRequestXStatusDetails(param) == FALSE)
MraSetXStatusInternal(param);
@@ -168,7 +168,7 @@ INT_PTR CMraProto::MraXStatusMenu(WPARAM wParam, LPARAM lParam, LPARAM param) /////////////////////////////////////////////////////////////////////////////////////////
-int CMraProto::MraContactDeleted(WPARAM hContact, LPARAM lParam)
+int CMraProto::MraContactDeleted(WPARAM hContact, LPARAM)
{
if (!m_bLoggedIn || !hContact)
return 0;
@@ -293,13 +293,13 @@ int CMraProto::MraDbSettingChanged(WPARAM hContact, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// Extra icons
-int CMraProto::MraExtraIconsApply(WPARAM wParam, LPARAM lParam)
+int CMraProto::MraExtraIconsApply(WPARAM wParam, LPARAM)
{
SetExtraIcons(wParam);
return 0;
}
-INT_PTR CMraProto::MraSetListeningTo(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraSetListeningTo(WPARAM, LPARAM lParam)
{
LISTENINGTOINFO *pliInfo = (LISTENINGTOINFO*)lParam;
@@ -379,7 +379,7 @@ DWORD CMraProto::MraSetXStatusInternal(DWORD dwXStatus) return dwOldStatusMode;
}
-INT_PTR CMraProto::MraSetXStatusEx(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraSetXStatusEx(WPARAM, LPARAM lParam)
{
INT_PTR iRet = 1;
DWORD dwXStatus;
@@ -564,31 +564,30 @@ INT_PTR CMraProto::MraSendSMS(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR CMraProto::MraSendNudge(WPARAM hContact, LPARAM lParam)
+INT_PTR CMraProto::MraSendNudge(WPARAM hContact, LPARAM)
{
if (m_bLoggedIn && hContact) {
LPWSTR lpwszAlarmMessage = TranslateW(MRA_ALARM_MESSAGE);
CMStringA szEmail;
if (mraGetStringA(hContact, "e-mail", szEmail))
- if (MraMessage(FALSE, hContact, 0, (MESSAGE_FLAG_RTF | MESSAGE_FLAG_ALARM), szEmail, lpwszAlarmMessage, NULL, 0))
- return 0;
+ if (MraMessage(FALSE, hContact, 0, (MESSAGE_FLAG_RTF | MESSAGE_FLAG_ALARM), szEmail, lpwszAlarmMessage, NULL, 0))
+ return 0;
}
return 1;
}
-INT_PTR CMraProto::GetUnreadEmailCount(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::GetUnreadEmailCount(WPARAM, LPARAM)
{
- if ( !m_bLoggedIn )
+ if (!m_bLoggedIn)
return 0;
return m_dwEmailMessagesUnread;
}
-
/////////////////////////////////////////////////////////////////////////////////////////
// Avatars
-INT_PTR CMraProto::MraGetAvatarCaps(WPARAM wParam, LPARAM lParam)
+INT_PTR CMraProto::MraGetAvatarCaps(WPARAM wParam, LPARAM)
{
switch (wParam) {
case AF_MAXSIZE:
diff --git a/protocols/MRA/src/Sdk/FIFOMT.h b/protocols/MRA/src/Sdk/FIFOMT.h index 3c6c250d87..0cff1914d5 100644 --- a/protocols/MRA/src/Sdk/FIFOMT.h +++ b/protocols/MRA/src/Sdk/FIFOMT.h @@ -44,13 +44,10 @@ typedef PCLIST_MT_ITEM PCFIFO_MT_ITEM, LPCFIFO_MT_ITEM; typedef LIST_MT_ITERATOR FIFO_MT_ITERATOR, *PFIFO_MT_ITERATOR, *LPFIFO_MT_ITERATOR;
typedef PCLIST_MT_ITERATOR PCFIFO_MT_ITERATOR, LPCFIFO_MT_ITERATOR;
-#define FifoMTInitialize(pcpmtFifoMT,dwSpinCount) ListMTInitialize(pcpmtFifoMT,dwSpinCount)
-#define FifoMTDestroy(pcpmtFifoMT) ListMTDestroy(pcpmtFifoMT)
-
__inline size_t FifoMTItemPush(PCFIFO_MT pcpmtFifoMT,PCFIFO_MT_ITEM pcffmtiFifoItem,LPVOID lpData)
{
- mt_lock l(pcpmtFifoMT);
+ mir_cslock l(pcpmtFifoMT->cs);
return ListMTItemAdd(pcpmtFifoMT,pcffmtiFifoItem,lpData);
}
@@ -60,7 +57,7 @@ __inline DWORD FifoMTItemPop(PCFIFO_MT pcpmtFifoMT,PFIFO_MT_ITEM *ppffmtiFifoIte DWORD dwRetErrorCode;
PLIST_MT_ITEM plmtiItem;
- mt_lock l(pcpmtFifoMT);
+ mir_cslock l(pcpmtFifoMT->cs);
if ((dwRetErrorCode=ListMTItemGetFirst(pcpmtFifoMT,&plmtiItem,plpData))==NO_ERROR)
{
if (ppffmtiFifoItem) (*ppffmtiFifoItem)=plmtiItem;
diff --git a/protocols/MRA/src/Sdk/InternetTime.h b/protocols/MRA/src/Sdk/InternetTime.h index fbb1233e8e..8052bb9ea6 100644 --- a/protocols/MRA/src/Sdk/InternetTime.h +++ b/protocols/MRA/src/Sdk/InternetTime.h @@ -127,8 +127,6 @@ __inline void InternetTimeGetCurrentTime(INTERNET_TIME *pitTime) // Переводит время из MAILTIME в строковое
__inline CMStringA InternetTimeGetString(INTERNET_TIME *pitTime)
{
- DWORD dwRet=NO_ERROR;
-
char lpszBuff[100];
LPSTR lpszCurPos = lpszBuff;
size_t dwTimeLen=0,dwtm;
diff --git a/protocols/MRA/src/Sdk/ListMT.h b/protocols/MRA/src/Sdk/ListMT.h index 63cd54b9fb..399765fba2 100644 --- a/protocols/MRA/src/Sdk/ListMT.h +++ b/protocols/MRA/src/Sdk/ListMT.h @@ -57,10 +57,10 @@ typedef CONST PLIST_MT_ITEM PCLIST_MT_ITEM, LPCLIST_MT_ITEM; // структура для работы со списком, заголовок списка
typedef struct _LIST_MT
{
- size_t nCount; // *колличество элементов в списке
- PLIST_MT_ITEM plmtiFirst; // *указывает на первый элемент в списке
- PLIST_MT_ITEM plmtiLast; // *указывает на последний элемент в списке
- CRITICAL_SECTION cs; // *section for exclysive access to List
+ size_t nCount; // *количество элементов в списке
+ PLIST_MT_ITEM plmtiFirst; // *указывает на первый элемент в списке
+ PLIST_MT_ITEM plmtiLast; // *указывает на последний элемент в списке
+ mir_cs cs; // *section for exclysive access to List
}LIST_MT, *PLIST_MT, *LPLIST_MT;
typedef CONST PLIST_MT PCLIST_MT, LPCLIST_MT;
@@ -76,25 +76,12 @@ typedef CONST PLIST_MT_ITERATOR PCLIST_MT_ITERATOR, LPCLIST_MT_ITERATOR; -__inline DWORD ListMTInitialize(PCLIST_MT pclmtListMT,DWORD dwSpinCount)
+__inline DWORD ListMTInitialize(PCLIST_MT pclmtListMT)
{
- DWORD dwRetErrorCode;
-
-#if (_WIN32_WINNT >= 0x0403)
- if (InitializeCriticalSectionAndSpinCount(&pclmtListMT->cs,((dwSpinCount)? (dwSpinCount | 0x80000000):0L)))
-#else
- InitializeCriticalSection(&pclmtListMT->cs);
- if (TRUE)
-#endif
- {
- InterlockedExchangePointer((volatile PVOID*)&pclmtListMT->nCount,NULL);
- pclmtListMT->plmtiFirst=NULL;
- pclmtListMT->plmtiLast=NULL;
- dwRetErrorCode=NO_ERROR;
- }else{
- dwRetErrorCode=GetLastError();
- }
-return(dwRetErrorCode);
+ InterlockedExchangePointer((volatile PVOID*)&pclmtListMT->nCount,NULL);
+ pclmtListMT->plmtiFirst=NULL;
+ pclmtListMT->plmtiLast=NULL;
+ return NO_ERROR;
}
@@ -103,26 +90,10 @@ __inline void ListMTDestroy(PCLIST_MT pclmtListMT) InterlockedExchangePointer((volatile PVOID*)&pclmtListMT->nCount,NULL);
pclmtListMT->plmtiFirst=NULL;
pclmtListMT->plmtiLast=NULL;
- DeleteCriticalSection(&pclmtListMT->cs);
SecureZeroMemory(&pclmtListMT->cs,sizeof(CRITICAL_SECTION));
}
-class mt_lock
-{
- PCLIST_MT m_list;
-
-public:
- __forceinline mt_lock(PCLIST_MT _pList) :
- m_list( _pList )
- { EnterCriticalSection(&_pList->cs);
- }
-
- __forceinline ~mt_lock()
- { LeaveCriticalSection(&m_list->cs);
- }
-};
-
__inline size_t ListMTGetCount(PCLIST_MT pclmtListMT)
{
return((size_t)InterlockedCompareExchangePointer((LPVOID*)&pclmtListMT->nCount,NULL,NULL));
diff --git a/protocols/MRA/src/Sdk/timefuncs.h b/protocols/MRA/src/Sdk/timefuncs.h index 8ac5a80edf..eaee4a7e80 100644 --- a/protocols/MRA/src/Sdk/timefuncs.h +++ b/protocols/MRA/src/Sdk/timefuncs.h @@ -51,20 +51,6 @@ typedef union { } FT;
-static inline __time32_t __cdecl _time32(__time32_t *timeptr)
-{
- __time64_t tim;
- FT nt_time;
-
- GetSystemTimeAsFileTime(&(nt_time.ft_struct));
- tim=(__time64_t)((nt_time.ft_scalar-EPOCH_BIAS)/10000000i64);
- if (tim > (__time64_t)(_MAX__TIME32_T)) tim=(__time64_t)(-1);
- if (timeptr) *timeptr = (__time32_t)(tim);// store time if requested
-
-return(__time32_t)(tim);
-}
-
-
inline __time32_t MakeTime32FromLocalSystemTime(CONST PSYSTEMTIME pcstSystemTime)
{
__time64_t tim=0;
diff --git a/protocols/MRA/src/version.h b/protocols/MRA/src/version.h index 8334cfee24..fc8129e421 100644 --- a/protocols/MRA/src/version.h +++ b/protocols/MRA/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 2
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 8
+#define __BUILD_NUM 9
#include <stdver.h>
|