From 4ac4df14e007a71bf195183a92113e29f984e31c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 20 Sep 2012 11:01:54 +0000 Subject: fix for the message length git-svn-id: http://svn.miranda-ng.org/main/trunk@1606 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MRA/MraProto.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'protocols') diff --git a/protocols/MRA/MraProto.cpp b/protocols/MRA/MraProto.cpp index c17e7f0d4d..563d2d3ca1 100644 --- a/protocols/MRA/MraProto.cpp +++ b/protocols/MRA/MraProto.cpp @@ -552,16 +552,13 @@ int CMraProto::SendMsg(HANDLE hContact, int flags, const char *lpszMessage) return 0; } - BOOL bMemAllocated = FALSE; CHAR szEMail[MAX_EMAIL_LEN]; DWORD dwFlags = 0; LPWSTR lpwszMessage = NULL; - size_t dwEMailSize, dwMessageSize = 0; int iRet = 0; - dwMessageSize = lstrlenA(lpszMessage); if (flags & PREF_UNICODE) - lpwszMessage = (LPWSTR)(lpszMessage+dwMessageSize+1); + lpwszMessage = (LPWSTR)(lpszMessage + lstrlenA(lpszMessage)+1 ); else if (flags & PREF_UTF) lpwszMessage = mir_utf8decodeT(lpszMessage); else @@ -572,12 +569,13 @@ int CMraProto::SendMsg(HANDLE hContact, int flags, const char *lpszMessage) return 0; } + size_t dwEMailSize; if ( mraGetStaticStringA(hContact, "e-mail", szEMail, SIZEOF(szEMail), &dwEMailSize)) { BOOL bSlowSend = mraGetByte(NULL, "SlowSend", MRA_DEFAULT_SLOW_SEND); if ( mraGetByte(NULL, "RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE) && (MraContactCapabilitiesGet(hContact) & FEATURE_FLAG_RTF_MESSAGE)) dwFlags |= MESSAGE_FLAG_RTF; - iRet = MraMessageW(bSlowSend, hContact, ACKTYPE_MESSAGE, dwFlags, szEMail, dwEMailSize, lpwszMessage, dwMessageSize, NULL, 0); + iRet = MraMessageW(bSlowSend, hContact, ACKTYPE_MESSAGE, dwFlags, szEMail, dwEMailSize, lpwszMessage, lstrlen(lpwszMessage), NULL, 0); if (bSlowSend == FALSE) ProtoBroadcastAckAsynchEx(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)iRet, (LPARAM)NULL, 0); } -- cgit v1.2.3