summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_messages.cpp
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2018-01-17 22:34:45 +0300
committeraunsane <aunsane@gmail.com>2018-01-17 22:34:45 +0300
commitbf928bd6cfa3df39b4cfda0ff5a5825105cf4a56 (patch)
tree3c7ce179ea9f6a43e671c96186fcbec804170c9a /protocols/Tox/src/tox_messages.cpp
parent5f96f1919d2d8210c4a67fe5a4fd9c0f84f9ee27 (diff)
Tox: updated libtox to 0.2.0
- support of message correction - version bump
Diffstat (limited to 'protocols/Tox/src/tox_messages.cpp')
-rw-r--r--protocols/Tox/src/tox_messages.cpp44
1 files changed, 41 insertions, 3 deletions
diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp
index 0d7ad78b04..6ab66e8186 100644
--- a/protocols/Tox/src/tox_messages.cpp
+++ b/protocols/Tox/src/tox_messages.cpp
@@ -9,6 +9,34 @@ void CToxProto::InitCustomDbEvents()
dbEventType.eventType = DB_EVENT_ACTION;
dbEventType.descr = Translate("Action");
DbEvent_RegisterType(&dbEventType);
+
+ dbEventType.eventType = DB_EVENT_CORRECTION;
+ dbEventType.descr = Translate("Correction");
+ DbEvent_RegisterType(&dbEventType);
+}
+
+INT_PTR CToxProto::EventGetIcon(WPARAM wParam, LPARAM lParam)
+{
+ DBEVENTINFO *dbei = (DBEVENTINFO*)lParam;
+ HICON icon = nullptr;
+
+ switch (dbei->eventType) {
+ case DB_EVENT_ACTION:
+ icon = GetIcon(IDI_ME);
+ break;
+
+ case DB_EVENT_CORRECTION:
+ icon = GetIcon(IDI_EDIT);
+ break;
+
+ default:
+ icon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
+ break;
+ }
+
+ return (INT_PTR)((wParam & LR_SHARED)
+ ? icon
+ : CopyIcon(icon));
}
/* MESSAGE RECEIVING */
@@ -34,7 +62,17 @@ void CToxProto::OnFriendMessage(Tox *tox, uint32_t friendNumber, TOX_MESSAGE_TYP
PROTORECVEVENT recv = { 0 };
recv.timestamp = time(nullptr);
recv.szMessage = rawMessage;
- recv.lParam = type == TOX_MESSAGE_TYPE_NORMAL ? EVENTTYPE_MESSAGE : DB_EVENT_ACTION;
+ switch (type) {
+ case TOX_MESSAGE_TYPE_NORMAL:
+ recv.lParam = EVENTTYPE_MESSAGE;
+ break;
+ case TOX_MESSAGE_TYPE_ACTION:
+ recv.lParam = DB_EVENT_ACTION;
+ break;
+ case TOX_MESSAGE_TYPE_CORRECTION:
+ recv.lParam = DB_EVENT_CORRECTION;
+ break;
+ }
ProtoChainRecvMsg(hContact, &recv);
CallService(MS_PROTO_CONTACTISTYPING, hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_OFF);
@@ -52,7 +90,7 @@ struct SendMessageParam
void CToxProto::SendMessageAsync(void *arg)
{
- Thread_SetName("TOX: SendMessageAsync");
+ Thread_SetName(MODULE ": SendMessageThread");
SendMessageParam *param = (SendMessageParam*)arg;
@@ -138,7 +176,7 @@ int CToxProto::OnPreCreateMessage(WPARAM, LPARAM lParam)
/* STATUS MESSAGE */
void CToxProto::GetStatusMessageAsync(void* arg)
{
- Thread_SetName("TOX: GetStatusMessageAsync");
+ Thread_SetName(MODULE ": GetStatusMessageThread");
MCONTACT hContact = (UINT_PTR)arg;