From 44ac2cea0d7dee5b2fdd085d3a4051d844b18728 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Mon, 23 Nov 2015 19:15:20 +0000 Subject: Tox: updated tox core git-svn-id: http://svn.miranda-ng.org/main/trunk@15761 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/src/tox_messages.cpp | 5 ++--- protocols/Tox/src/tox_proto.h | 1 + protocols/Tox/src/tox_utils.cpp | 21 +++++++++++++++++++++ protocols/Tox/src/version.h | 4 ++-- 4 files changed, 26 insertions(+), 5 deletions(-) (limited to 'protocols/Tox/src') diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index f6a1dd8102..aa5f2a1935 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -46,7 +46,7 @@ void CToxProto::SendMessageAsync(void *arg) int32_t friendNumber = GetToxFriendNumber(param->hContact); if (friendNumber == UINT32_MAX) - ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)param->hMessage, 0); + ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)param->hMessage, (LPARAM)_T2A(ToxErrorToString(TOX_ERR_FRIEND_SEND_MESSAGE_FRIEND_NOT_FOUND))); size_t msgLen = mir_strlen(param->message); uint8_t *msg = (uint8_t*)param->message; @@ -62,9 +62,8 @@ void CToxProto::SendMessageAsync(void *arg) if (sendError != TOX_ERR_FRIEND_SEND_MESSAGE_OK) { logger->Log(__FUNCTION__": failed to send message for %d (%d)", friendNumber, sendError); - ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)param->hMessage, 0); + ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)param->hMessage, (LPARAM)_T2A(ToxErrorToString(sendError))); } - uint64_t messageId = (((int64_t)friendNumber) << 32) | ((int64_t)messageNumber); messages[messageId] = param->hMessage; diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index aebf85148e..b12488e2b3 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -278,6 +278,7 @@ private: static int ToxToMirandaStatus(TOX_USER_STATUS userstatus); static TCHAR* ToxErrorToString(TOX_ERR_NEW error); + static TCHAR* ToxErrorToString(TOX_ERR_FRIEND_SEND_MESSAGE error); static void ShowNotification(const TCHAR *message, int flags = 0, MCONTACT hContact = NULL); static void ShowNotification(const TCHAR *caption, const TCHAR *message, int flags = 0, MCONTACT hContact = NULL); diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp index da18be8bdb..0ad5015340 100644 --- a/protocols/Tox/src/tox_utils.cpp +++ b/protocols/Tox/src/tox_utils.cpp @@ -82,6 +82,27 @@ TCHAR* CToxProto::ToxErrorToString(TOX_ERR_NEW error) } } +TCHAR* CToxProto::ToxErrorToString(TOX_ERR_FRIEND_SEND_MESSAGE error) +{ + switch (error) + { + case TOX_ERR_FRIEND_SEND_MESSAGE_NULL: + return TranslateT("One of the arguments is missing"); + case TOX_ERR_FRIEND_SEND_MESSAGE_FRIEND_NOT_FOUND: + return TranslateT("The friend number did not designate a valid friend"); + case TOX_ERR_FRIEND_SEND_MESSAGE_FRIEND_NOT_CONNECTED: + return TranslateT("This client is currently not connected to the friend"); + case TOX_ERR_FRIEND_SEND_MESSAGE_SENDQ: + return TranslateT("An allocation error occurred while increasing the send queue size"); + case TOX_ERR_FRIEND_SEND_MESSAGE_TOO_LONG: + return TranslateT("Message length exceeded TOX_MAX_MESSAGE_LENGTH"); + case TOX_ERR_FRIEND_SEND_MESSAGE_EMPTY: + return TranslateT("Attempted to send a zero-length message"); + default: + return TranslateT("Unknown error"); + } +} + void CToxProto::ShowNotification(const TCHAR *caption, const TCHAR *message, int flags, MCONTACT hContact) { if (Miranda_Terminated()) diff --git a/protocols/Tox/src/version.h b/protocols/Tox/src/version.h index 977e7295a4..32e80a4155 100644 --- a/protocols/Tox/src/version.h +++ b/protocols/Tox/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 11 #define __RELEASE_NUM 1 -#define __BUILD_NUM 15 +#define __BUILD_NUM 16 #include @@ -11,4 +11,4 @@ #define __AUTHOR "Miranda NG Team" #define __AUTHOREMAIL "" #define __AUTHORWEB "http://miranda-ng.org/p/Tox/" -#define __COPYRIGHT "© 2014-15 Miranda NG Team" +#define __COPYRIGHT "� 2014-15 Miranda NG Team" -- cgit v1.2.3