From c90272a48520b1937624c0058f94b06e536f5ff6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 30 Sep 2024 13:35:41 +0300 Subject: code cleaning --- plugins/MessageState/src/global.h | 4 ++-- plugins/MessageState/src/messagestate.cpp | 7 +++++++ plugins/MessageState/src/services.cpp | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'plugins/MessageState/src') diff --git a/plugins/MessageState/src/global.h b/plugins/MessageState/src/global.h index 21b12b27dc..60f87f3d37 100644 --- a/plugins/MessageState/src/global.h +++ b/plugins/MessageState/src/global.h @@ -12,9 +12,9 @@ struct ContactData MCONTACT hContact; int type = -1, bHidden = true; - __time64_t dwLastReadTime = 0, dwLastSentTime = 0; + time_t dwLastReadTime = 0, dwLastSentTime = 0; - void __forceinline setSent(__time64_t _time) + void __forceinline setSent(time_t _time) { dwLastSentTime = _time; type = 0; diff --git a/plugins/MessageState/src/messagestate.cpp b/plugins/MessageState/src/messagestate.cpp index f5981729c2..2dbe670043 100644 --- a/plugins/MessageState/src/messagestate.cpp +++ b/plugins/MessageState/src/messagestate.cpp @@ -77,6 +77,12 @@ static int OnProtoAck(WPARAM, LPARAM lParam) return 0; } +static int OnEventDelivered(WPARAM hContact, LPARAM) +{ + CallService(MS_MESSAGESTATE_UPDATE, hContact, MRD_TYPE_DELIVERED); + return 0; +} + static int OnEventFilterAdd(WPARAM hContact, LPARAM lParam) { DBEVENTINFO *dbei = (DBEVENTINFO *)lParam; @@ -112,6 +118,7 @@ int OnModulesLoaded(WPARAM, LPARAM) HookEvent(ME_PROTO_ACK, OnProtoAck); HookEvent(ME_DB_EVENT_FILTER_ADD, OnEventFilterAdd); + HookEvent(ME_DB_EVENT_DELIVERED, OnEventDelivered); HookEvent(ME_MC_DEFAULTTCHANGED, OnMetaChanged); HookEvent(ME_MC_SUBCONTACTSCHANGED, OnMetaChanged); HookEvent(ME_MSG_WINDOWEVENT, OnSrmmWindowOpened); diff --git a/plugins/MessageState/src/services.cpp b/plugins/MessageState/src/services.cpp index bc0efb54d8..12474e6685 100644 --- a/plugins/MessageState/src/services.cpp +++ b/plugins/MessageState/src/services.cpp @@ -14,7 +14,7 @@ static INT_PTR UpdateService(WPARAM hContact, LPARAM lParam) auto *p = FindContact(hContact); time_t currTime = time(0); - if (currTime > p->dwLastReadTime) { + if (currTime >= p->dwLastReadTime) { p->dwLastReadTime = currTime; p->type = lParam; -- cgit v1.2.3