From 6b1c0b2c99d9ebc1dbb7b7e5e8268af6f911bbff Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Mon, 13 Apr 2015 11:33:17 +0000 Subject: Tox: fixed receiving of messages from old api clients git-svn-id: http://svn.miranda-ng.org/main/trunk@12783 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/src/tox_messages.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'protocols/Tox/src/tox_messages.cpp') diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index ddcf5fa2f8..afa7c6e445 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -12,7 +12,14 @@ void CToxProto::OnFriendMessage(Tox*, uint32_t friendNumber, TOX_MESSAGE_TYPE ty return; char *rawMessage = (char*)mir_alloc(length + 1); - mir_strncpy(rawMessage, (const char*)message, length); + // old api support + if (message[0] == 0 && length > 0) + { + length -= 3; + mir_strncpy(rawMessage, (const char*)&message[4], length); + } + else + mir_strncpy(rawMessage, (const char*)message, length); rawMessage[length] = 0; PROTORECVEVENT recv = { 0 }; -- cgit v1.2.3