From 83ba72066d0c993e882ee617cad8bb0f47e960d3 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 15 Jun 2013 17:44:43 +0000 Subject: reverted mra code + lparam fix for nxsn git-svn-id: http://svn.miranda-ng.org/main/trunk@4959 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MRA/src/MraProto.cpp | 2 +- protocols/MRA/src/MraProto.h | 2 +- protocols/MRA/src/Mra_functions.cpp | 23 +++++++++++++---------- protocols/MRA/src/Mra_proto.cpp | 17 +++++++++-------- 4 files changed, 24 insertions(+), 20 deletions(-) (limited to 'protocols/MRA/src') diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 6ae83f0a7e..bc36693813 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -653,7 +653,7 @@ HANDLE CMraProto::GetAwayMsg(HANDLE hContact) dwStatusDescSize = mir_sntprintf(szStatusDesc, SIZEOF(szStatusDesc), _T("%s%s"), szTime, szBlogStatus); iRet = GetTickCount(); - ProtoBroadcastAckAsync(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)iRet, (LPARAM)szStatusDesc); + ProtoBroadcastAckAsync(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)iRet, (LPARAM)szStatusDesc, (dwStatusDescSize+1)*sizeof(TCHAR)); } return (HANDLE)iRet; } diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index e299e57be6..9af64edb8c 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -301,7 +301,7 @@ struct CMraProto : public PROTO_INTERFACE void InitContactMenu(); void CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMainIcon, LPSTR pszContactOwner, BOOL bIsStatus, const struct GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HGENMENU *hResult); - int ProtoBroadcastAckAsync(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam); + DWORD ProtoBroadcastAckAsync(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam, size_t paramSize = 0); DWORD CreateBlobFromContact(HANDLE hContact, LPWSTR lpwszRequestReason, size_t dwRequestReasonSize, LPBYTE lpbBuff, size_t dwBuffSize, size_t *pdwBuffSizeRet); BOOL SetPassDB(LPSTR lpszBuff, size_t dwBuffSize); diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index f7b5ab93a5..a10ebcbaae 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -1081,17 +1081,20 @@ static void FakeThread(void* param) mir_free(param); } -int CMraProto::ProtoBroadcastAckAsync(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam) +DWORD CMraProto::ProtoBroadcastAckAsync(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam, size_t paramSize) { - ACKDATA ack = {0}; - ack.cbSize = sizeof(ACKDATA); - ack.szModule = m_szModuleName; - ack.hContact = hContact; - ack.type = type; - ack.result = hResult; - ack.hProcess = hProcess; - ack.lParam = lParam; - return CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack); + ACKDATA *ack = (ACKDATA *)::mir_calloc(sizeof(ACKDATA) + paramSize); + ack->cbSize = sizeof(ACKDATA); + ack->szModule = m_szModuleName; + ack->hContact = hContact; + ack->type = type; + ack->result = hResult; + ack->hProcess = hProcess; + ack->lParam = lParam; + if (paramSize) + memcpy(ack+1, (void*)lParam, paramSize); + mir_forkthread(FakeThread, ack); + return 0; } DWORD CMraProto::CreateBlobFromContact(HANDLE hContact, LPWSTR lpwszRequestReason, size_t dwRequestReasonSize, LPBYTE lpbBuff, size_t dwBuffSize, size_t *pdwBuffSizeRet) diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 54da354561..82dbb828d4 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -511,8 +511,8 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd ProtoBroadcastAckAsync(hContact, dwAckType, ACKRESULT_FAILED, (HANDLE)pmaHeader->seq, (LPARAM)"User does not accept offline flash animation"); break; default: - mir_snprintf((LPSTR)szBuff, SIZEOF(szBuff), "Undefined message delivery error, code: %lu", dwTemp); - ProtoBroadcastAckAsync(hContact, dwAckType, ACKRESULT_FAILED, (HANDLE)pmaHeader->seq, (LPARAM)szBuff); + dwTemp = mir_snprintf((LPSTR)szBuff, SIZEOF(szBuff), "Undefined message delivery error, code: %lu", dwTemp); + ProtoBroadcastAckAsync(hContact, dwAckType, ACKRESULT_FAILED, (HANDLE)pmaHeader->seq, (LPARAM)szBuff, dwTemp+1); break; } MraSendQueueFree(hSendQueueHandle, pmaHeader->seq); @@ -1562,6 +1562,7 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd break; case MRIM_CS_SMS_ACK: + dwTemp = GetUL(&lpbDataCurrent); if ( MraSendQueueFind(hSendQueueHandle, pmaHeader->seq, NULL, &hContact, &dwAckType, (LPBYTE*)&lpsString.lpszData, &lpsString.dwSize) == NO_ERROR) { char szEMail[MAX_EMAIL_LEN]; LPSTR lpszPhone; @@ -1574,8 +1575,8 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd lpszPhone = (lpsString.lpszData+sizeof(DWORD)); lpwszMessage = (LPWSTR)(lpszPhone+dwPhoneSize+1); - mir_snprintf((LPSTR)szBuff, SIZEOF(szBuff), "Mail.ruYesMail.ru, Russia%s-1-1955988055-%s%s0\r\n", szEMail, lpszPhone, lpszPhone); - ProtoBroadcastAckAsync(NULL, dwAckType, ACKRESULT_SENTREQUEST, (HANDLE)pmaHeader->seq, (LPARAM)szBuff); + dwTemp = mir_snprintf((LPSTR)szBuff, SIZEOF(szBuff), "Mail.ruYesMail.ru, Russia%s-1-1955988055-%s%s0\r\n", szEMail, lpszPhone, lpszPhone); + ProtoBroadcastAckAsync(NULL, dwAckType, ACKRESULT_SENTREQUEST, (HANDLE)pmaHeader->seq, (LPARAM)szBuff, dwTemp+1); } mir_free(lpsString.lpszData); @@ -1897,12 +1898,12 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl lpszBuff = (LPSTR)lpwszMessageXMLEncoded; if (dwFlags & MESSAGE_SMS_DELIVERY_REPORT) { - mir_snprintf(lpszBuff, (dwBuffLen*sizeof(WCHAR)), "%s-1-1955988055-%s%sNo%s015%s", szEMail, szPhone, szPhone, szTime, lpszMessageUTF); - ProtoBroadcastAckAsync(NULL, ICQACKTYPE_SMS, ACKRESULT_FAILED, (HANDLE)0, (LPARAM)lpszBuff); + dwBuffLen = mir_snprintf(lpszBuff, (dwBuffLen*sizeof(WCHAR)), "%s-1-1955988055-%s%sNo%s015%s", szEMail, szPhone, szPhone, szTime, lpszMessageUTF); + ProtoBroadcastAckAsync(NULL, ICQACKTYPE_SMS, ACKRESULT_FAILED, (HANDLE)0, (LPARAM)lpszBuff, dwBuffLen+1); } else { // new sms - mir_snprintf(lpszBuff, (dwBuffLen*sizeof(WCHAR)), "Mail.ru%s%sMail.ru%s", szEMail, szPhone, lpszMessageUTF, szTime); - ProtoBroadcastAckAsync(NULL, ICQACKTYPE_SMS, ACKRESULT_SUCCESS, (HANDLE)0, (LPARAM)lpszBuff); + dwBuffLen = mir_snprintf(lpszBuff, (dwBuffLen*sizeof(WCHAR)), "Mail.ru%s%sMail.ru%s", szEMail, szPhone, lpszMessageUTF, szTime); + ProtoBroadcastAckAsync(NULL, ICQACKTYPE_SMS, ACKRESULT_SUCCESS, (HANDLE)0, (LPARAM)lpszBuff, dwBuffLen+1); } } else dwRetErrorCode = GetLastError(); -- cgit v1.2.3