summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_proto.cpp
diff options
context:
space:
mode:
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");