summaryrefslogtreecommitdiff
path: root/plugins/MessageState/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-09-30 13:35:41 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-09-30 13:35:41 +0300
commitc90272a48520b1937624c0058f94b06e536f5ff6 (patch)
tree61eb1096c0565273a08a54a9f528b1260fc5bddb /plugins/MessageState/src
parent5d016227186f7f272e2d423f0628e705187a2dc3 (diff)
code cleaning
Diffstat (limited to 'plugins/MessageState/src')
-rw-r--r--plugins/MessageState/src/global.h4
-rw-r--r--plugins/MessageState/src/messagestate.cpp7
-rw-r--r--plugins/MessageState/src/services.cpp2
3 files changed, 10 insertions, 3 deletions
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;