summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-03-03 21:48:14 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-03-03 21:48:14 +0300
commit0e32b148b70e4bc454c608f07b21e3e62cc0e942 (patch)
tree9b97aeec80f32671307f71458ac7e4eb3dfe3c87
parent4a18c4e02bbe291db8fc7c58ed565fa8afe6725f (diff)
MessageState: inside local networks only one check could be displayed sometimes (if message delivery takes less than 55ms)
-rw-r--r--plugins/MessageState/src/global.h2
-rw-r--r--plugins/MessageState/src/messagestate.cpp2
-rw-r--r--plugins/MessageState/src/services.cpp4
-rw-r--r--plugins/MessageState/src/utils.cpp12
-rw-r--r--plugins/MessageState/src/version.h2
5 files changed, 12 insertions, 10 deletions
diff --git a/plugins/MessageState/src/global.h b/plugins/MessageState/src/global.h
index 0413f2535d..a689701802 100644
--- a/plugins/MessageState/src/global.h
+++ b/plugins/MessageState/src/global.h
@@ -36,7 +36,7 @@ void InitServices();
void IconsUpdate(MCONTACT);
void SetSRMMIcon(MCONTACT hContact, int type, time_t time = 0);
-time_t GetLastSentMessageTime(MCONTACT hContact);
+__int64 GetPreciousTime(void);
int OnModulesLoaded(WPARAM, LPARAM);
bool HasUnread(MCONTACT hContact);
diff --git a/plugins/MessageState/src/messagestate.cpp b/plugins/MessageState/src/messagestate.cpp
index 61a2885639..99e47ced00 100644
--- a/plugins/MessageState/src/messagestate.cpp
+++ b/plugins/MessageState/src/messagestate.cpp
@@ -81,7 +81,7 @@ static int OnEventFilterAdd(WPARAM hContact, LPARAM lParam)
{
DBEVENTINFO *dbei = (DBEVENTINFO *)lParam;
if ((dbei->flags & DBEF_SENT) && CheckProtoSupport(dbei->szModule)) {
- __time64_t dwTime = _time64(0);
+ __time64_t dwTime = GetPreciousTime();
FindContact(hContact)->setSent(dwTime);
if (db_mc_isSub(hContact))
FindContact(db_mc_getMeta(hContact))->setSent(dwTime);
diff --git a/plugins/MessageState/src/services.cpp b/plugins/MessageState/src/services.cpp
index 8e7b6dbe17..8dc3fa46a3 100644
--- a/plugins/MessageState/src/services.cpp
+++ b/plugins/MessageState/src/services.cpp
@@ -12,8 +12,8 @@ static IconItem Icons[] =
static INT_PTR UpdateService(WPARAM hContact, LPARAM lParam)
{
auto *p = FindContact(hContact);
-
- __time64_t currTime = _time64(0);
+
+ __time64_t currTime = GetPreciousTime();
if (currTime > p->dwLastReadTime) {
p->dwLastReadTime = currTime;
p->type = lParam;
diff --git a/plugins/MessageState/src/utils.cpp b/plugins/MessageState/src/utils.cpp
index 683e4f8a98..40371be1a5 100644
--- a/plugins/MessageState/src/utils.cpp
+++ b/plugins/MessageState/src/utils.cpp
@@ -15,11 +15,6 @@ ContactData* FindContact(MCONTACT hContact)
return p;
}
-time_t GetLastSentMessageTime(MCONTACT hContact)
-{
- return FindContact(hContact)->dwLastSentTime;
-}
-
bool HasUnread(MCONTACT hContact)
{
if (!CheckProtoSupport(Proto_GetBaseAccountName(hContact)))
@@ -31,3 +26,10 @@ bool HasUnread(MCONTACT hContact)
return p->dwLastReadTime != 0;
}
+
+__int64 GetPreciousTime()
+{
+ LARGE_INTEGER li;
+ QueryPerformanceCounter(&li);
+ return li.QuadPart;
+}
diff --git a/plugins/MessageState/src/version.h b/plugins/MessageState/src/version.h
index 489f6ab568..c637f41008 100644
--- a/plugins/MessageState/src/version.h
+++ b/plugins/MessageState/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>