summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_proto.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-08-28 18:08:32 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-08-28 18:08:32 +0000
commit900cb3561405d385c70fc57c94e46bc1e4fa178b (patch)
tree3f77c180f15589b7911ac4b3ea52eba8c8ab8e03 /protocols/Tox/src/tox_proto.cpp
parent3a124f929481fbb59c5cb49618fc19c01cd63833 (diff)
Tox: actions support (messages started with '/me')
git-svn-id: http://svn.miranda-ng.org/main/trunk@10334 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_proto.cpp')
-rw-r--r--protocols/Tox/src/tox_proto.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp
index 9547b33f90..3693cfc741 100644
--- a/protocols/Tox/src/tox_proto.cpp
+++ b/protocols/Tox/src/tox_proto.cpp
@@ -30,6 +30,15 @@ CToxProto::CToxProto(const char* protoName, const TCHAR* userName) :
sid.ptszDescription = LPGENT("Protocol icon");
sid.iDefaultIndex = -IDI_TOX;
Skin_AddIcon(&sid);
+
+ // custom event
+ DBEVENTTYPEDESCR dbEventType = { sizeof(dbEventType) };
+ dbEventType.module = this->m_szModuleName;
+ dbEventType.flags = DETF_HISTORY | DETF_MSGWINDOW;
+
+ dbEventType.eventType = TOX_DB_EVENT_TYPE_ACTION;
+ dbEventType.descr = "Tox action";
+ CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
}
CToxProto::~CToxProto()
@@ -235,7 +244,16 @@ int __cdecl CToxProto::SendMsg(MCONTACT hContact, int flags, const char* msg)
uint32_t number = tox_get_friend_number(tox, clientId.data());
- int result = tox_send_message(tox, number, (uint8_t*)msg, (uint16_t)strlen(msg));
+ int result = 0;
+ if (strncmp(msg, "/me ", 4) != 0)
+ {
+ result = tox_send_message(tox, number, (uint8_t*)msg, (uint16_t)strlen(msg));
+ }
+ else
+ {
+ result = tox_send_action(tox, number, (uint8_t*)&msg[4], (uint16_t)strlen(msg) - 4);
+ }
+
if (result == 0)
{
debugLogA("CToxProto::SendMsg: could not to send message");