diff options
author | Rozhuk Ivan <rozhuk.im@gmail.com> | 2015-07-11 02:57:04 +0000 |
---|---|---|
committer | Rozhuk Ivan <rozhuk.im@gmail.com> | 2015-07-11 02:57:04 +0000 |
commit | bf4ae174716355279cb4f56c396bd436953215e6 (patch) | |
tree | 36032140b2e747d7efc878e64f50c6c4642cd176 /protocols | |
parent | 0c25d82fbea363b8ca544a49dbb1d02c33fbbb8f (diff) |
MRA: fix flash animation messages
git-svn-id: http://svn.miranda-ng.org/main/trunk@14531 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/MRA/src/MraRTFMsg.cpp | 2 | ||||
-rw-r--r-- | protocols/MRA/src/MraSendCommand.cpp | 20 |
2 files changed, 11 insertions, 11 deletions
diff --git a/protocols/MRA/src/MraRTFMsg.cpp b/protocols/MRA/src/MraRTFMsg.cpp index 41473cfef3..61d305d08e 100644 --- a/protocols/MRA/src/MraRTFMsg.cpp +++ b/protocols/MRA/src/MraRTFMsg.cpp @@ -100,7 +100,7 @@ DWORD MraTextToRTFData(LPSTR lpszMessage, size_t dwMessageSize, LPSTR lpszMessag bool MraIsMessageFlashAnimation(const CMStringW &lpwszMessage)
{
- int iStart = lpwszMessage.Find(_T("<SMILE>id = flas"));
+ int iStart = lpwszMessage.Find(_T("<SMILE>id=flas"));
if (iStart != -1)
if (lpwszMessage.Find(_T("'</SMILE>"), iStart) != -1)
return true;
diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp index 873394ba0e..1315e48778 100644 --- a/protocols/MRA/src/MraSendCommand.cpp +++ b/protocols/MRA/src/MraSendCommand.cpp @@ -80,7 +80,7 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType LPSTR lpszMessageRTF = NULL;
size_t dwMessageConvertedSize = lpwszMessage.GetLength()*sizeof(WCHAR), dwMessageRTFSize = 0;
- if ( MraIsMessageFlashAnimation(lpwszMessage))
+ if (MraIsMessageFlashAnimation(lpwszMessage))
dwFlags |= MESSAGE_FLAG_FLASH;
// pack auth message
@@ -96,20 +96,20 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType else if (dwFlags & MESSAGE_FLAG_FLASH) {
dwFlags |= MESSAGE_FLAG_RTF;
- DWORD dwBackColour = getDword("RTFBackgroundColour", MRA_DEFAULT_RTF_BACKGROUND_COLOUR);
- char lpbRTFData[10000];
+ CMStringA lpszBuf(mir_u2a(lpwszMessage));
OutBuffer buf;
buf.SetUL(4);
- buf.SetLPS(lpbRTFData);// сообщение что у собеседника плохая версия :)
+ buf.SetLPS(lpszBuf);// сообщение что у собеседника плохая версия :)
buf.SetUL(4);
- buf.SetUL(dwBackColour);
- buf.SetLPS(lpbRTFData);// сам мульт ANSI
+ buf.SetUL(getDword("RTFBackgroundColour", MRA_DEFAULT_RTF_BACKGROUND_COLOUR));
+ buf.SetLPS(lpszBuf);// сам мульт ANSI
buf.SetLPSW(lpwszMessage);// сам мульт UNICODE
- DWORD dwRTFDataSize = (DWORD)buf.Len();
- if (compress2((LPBYTE)lpbRTFData, &dwRTFDataSize, buf.Data(), (int)buf.Len(), Z_BEST_COMPRESSION) == Z_OK) {
- lpszMessageRTF = mir_base64_encode((LPBYTE)lpbRTFData, dwRTFDataSize);
+ DWORD dwBufSize = (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);
dwMessageRTFSize = mir_strlen(lpszMessageRTF);
}
}
@@ -118,7 +118,7 @@ DWORD CMraProto::MraMessage(BOOL bAddToQueue, MCONTACT hContact, DWORD dwAckType // 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);
- if ( !MraConvertToRTFW(lpwszMessage, lpbRTFData)) {
+ if (!MraConvertToRTFW(lpwszMessage, lpbRTFData)) {
DWORD dwBackColour = getDword("RTFBackgroundColour", MRA_DEFAULT_RTF_BACKGROUND_COLOUR);
OutBuffer buf;
|