From e9cb7ff7a1c115d63ed4e6af5f8fbd29f29459fe Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 13 Mar 2018 22:39:40 +0300 Subject: additional fix for #1143 (message with non-latin chars is stored as garbage being sent from the command line) --- plugins/CmdLine/src/mimcmd_handlers.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'plugins/CmdLine/src') diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 10caca7621..ad5a1cb216 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -742,7 +742,8 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re if (hContact) { bShouldProcessAcks = TRUE; - HANDLE hProcess = (HANDLE)ProtoChainSend(hContact, PSS_MESSAGE, 0, ptrA(Utf8EncodeW(message))); + ptrA szMessage(Utf8EncodeW(message)); + HANDLE hProcess = (HANDLE)ProtoChainSend(hContact, PSS_MESSAGE, 0, szMessage); const int MAX_COUNT = 60; int counter = 0; while (((ack = GetAck(hProcess)) == nullptr) && (counter < MAX_COUNT)) { @@ -759,10 +760,10 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re DBEVENTINFO e = {}; char module[128]; e.eventType = EVENTTYPE_MESSAGE; - e.flags = DBEF_SENT; + e.flags = DBEF_SENT | DBEF_UTF; - e.pBlob = (PBYTE)message; - e.cbBlob = (DWORD)mir_strlen((char *)message) + 1; + e.pBlob = (PBYTE)szMessage.get(); + e.cbBlob = (DWORD)mir_strlen(szMessage) + 1; strncpy_s(module, ack->szModule, _countof(module)); e.szModule = module; -- cgit v1.2.3