diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-08-12 18:56:09 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-08-12 18:56:09 +0000 |
commit | e530b1be3a65296d2324b2299897367ee14d4a3d (patch) | |
tree | 12a5f019b133bebf61a26f76b4841075f6162ebd /protocols/Tox/src/tox_messages.cpp | |
parent | 9c4e02916ad863a7fdd95d2668f29714997d61c5 (diff) |
Tox: contact status message support
git-svn-id: http://svn.miranda-ng.org/main/trunk@14926 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_messages.cpp')
-rw-r--r-- | protocols/Tox/src/tox_messages.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index 895e4e9aa1..b52bcbbe8a 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -111,6 +111,38 @@ int CToxProto::OnPreCreateMessage(WPARAM, LPARAM lParam) return 0;
}
+/* STATUS MESSAGE */
+void CToxProto::GetStatusMessageAsync(void* arg)
+{
+ MCONTACT hContact = (MCONTACT)arg;
+
+ int32_t friendNumber = GetToxFriendNumber(hContact);
+ if (friendNumber == UINT32_MAX)
+ {
+ ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_FAILED, (HANDLE)hContact, 0);
+ return;
+ }
+
+ TOX_ERR_FRIEND_QUERY error;
+ size_t size = tox_friend_get_status_message_size(tox, friendNumber, &error);
+ if (error != TOX_ERR_FRIEND_QUERY::TOX_ERR_FRIEND_QUERY_OK)
+ {
+ debugLogA(__FUNCTION__": failed to get status message for (%d) (%d)", friendNumber, error);
+ ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_FAILED, (HANDLE)hContact, 0);
+ return;
+ }
+
+ ptrA statusMessage((char*)mir_calloc(size + 1));
+ if (!tox_friend_get_status_message(tox, friendNumber, (uint8_t*)(char*)statusMessage, &error))
+ {
+ debugLogA(__FUNCTION__": failed to get status message for (%d) (%d)", friendNumber, error);
+ ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_FAILED, (HANDLE)hContact, 0);
+ return;
+ }
+
+ ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)hContact, ptrT(mir_utf8decodeT(statusMessage)));
+}
+
/* TYPING */
int CToxProto::OnUserIsTyping(MCONTACT hContact, int type)
|