summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_proto.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-08-12 17:23:41 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-08-12 17:23:41 +0000
commitc1fdf24779e15d5a1063340b35a4f7b2e3bf9d6a (patch)
tree533ad0b608c12d5d68019bc1f5a40be6522e4b95 /protocols/Tox/src/tox_proto.cpp
parent5a5db63d2250396ea17b194e4dc7b455cdd521fd (diff)
Tox: added message receiving
git-svn-id: http://svn.miranda-ng.org/main/trunk@10166 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_proto.cpp')
-rw-r--r--protocols/Tox/src/tox_proto.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp
index e2734d8aca..676039ce76 100644
--- a/protocols/Tox/src/tox_proto.cpp
+++ b/protocols/Tox/src/tox_proto.cpp
@@ -21,6 +21,8 @@ CToxProto::CToxProto(const char* protoName, const TCHAR* userName) :
tox_callback_connection_status(tox, OnConnectionStatusChanged, this);
CreateProtoService(PS_CREATEACCMGRUI, &CToxProto::OnAccountManagerInit);
+
+ hMessageProcess = 1;
}
CToxProto::~CToxProto()
@@ -93,7 +95,10 @@ HWND __cdecl CToxProto::CreateExtendedSearchUI(HWND owner) { return 0; }
int __cdecl CToxProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT*) { return 0; }
int __cdecl CToxProto::RecvFile(MCONTACT hContact, PROTOFILEEVENT*) { return 0; }
-int __cdecl CToxProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT*) { return 0; }
+int __cdecl CToxProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
+{
+ return (INT_PTR)AddDbEvent(hContact, EVENTTYPE_MESSAGE, pre->timestamp, DBEF_UTF, lstrlenA(pre->szMessage), (BYTE*)pre->szMessage);
+}
int __cdecl CToxProto::RecvUrl(MCONTACT hContact, PROTORECVEVENT*) { return 0; }
int __cdecl CToxProto::SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT* hContactsList) { return 0; }
@@ -111,7 +116,9 @@ int __cdecl CToxProto::SendMsg(MCONTACT hContact, int flags, const char* msg)
uint32_t number = tox_get_friend_number(tox, clientId.data());
- int messageId = tox_send_message(tox, number, (uint8_t*)msg, strlen(msg));
+ ULONG messageId = InterlockedIncrement(&hMessageProcess);
+
+ tox_send_message_withid(tox, number, messageId, (uint8_t*)msg, strlen(msg));
return messageId;
}