diff options
author | George Hazan <ghazan@miranda.im> | 2019-01-17 18:37:22 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-01-17 18:37:22 +0300 |
commit | 19696f68061ce3d0996ec276bd65f286b7940260 (patch) | |
tree | fbbff985d5d513289f4a4f94839d181bec716daa /protocols/ICQ-WIM/src | |
parent | db8d126a7b973b38c52f646748c866ba9fe32eb3 (diff) |
fixes #1773 (MessageState: add ICQ support)
Diffstat (limited to 'protocols/ICQ-WIM/src')
-rw-r--r-- | protocols/ICQ-WIM/src/server.cpp | 21 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/stdafx.h | 1 |
2 files changed, 14 insertions, 8 deletions
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index 73676491e2..a1e847e998 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -755,15 +755,8 @@ void CIcqProto::ProcessHistData(const JSONNode &ev) else LoadChatInfo(si); } } - else { - hContact = CreateContact(_wtol(wszId), true); + else hContact = CreateContact(_wtol(wszId), true); - if (g_bMessageState) { - MessageReadData data(time(0), MRD_TYPE_READTIME); - CallService(MS_MESSAGESTATE_UPDATE, hContact, (LPARAM)&data); - } - } - __int64 lastMsgId = getId(hContact, DB_KEY_LASTMSGID); __int64 srvLastId = _wtoi64(ev["lastMsgId"].as_mstring()); __int64 srvUnreadId = _wtoi64(ev["yours"]["lastRead"].as_mstring()); @@ -775,6 +768,18 @@ void CIcqProto::ProcessHistData(const JSONNode &ev) else if (ev["unreadCnt"].as_int() > 0) RetrieveUserHistory(hContact, min(srvUnreadId, lastMsgId), srvLastId); + // check remote read + if (g_bMessageState) { + __int64 srvRemoteRead = _wtoi64(ev["theirs"]["lastRead"].as_mstring()); + __int64 lastRemoteRead = getId(hContact, DB_KEY_REMOTEREAD); + if (srvRemoteRead > lastRemoteRead) { + setId(hContact, DB_KEY_REMOTEREAD, srvRemoteRead); + + MessageReadData data(time(0), MRD_TYPE_READTIME); + CallService(MS_MESSAGESTATE_UPDATE, hContact, (LPARAM)&data); + } + } + for (auto &it : ev["tail"]["messages"]) ParseMessage(hContact, lastMsgId, it); setId(hContact, DB_KEY_LASTMSGID, lastMsgId); diff --git a/protocols/ICQ-WIM/src/stdafx.h b/protocols/ICQ-WIM/src/stdafx.h index 8351f37ef6..59e77234f8 100644 --- a/protocols/ICQ-WIM/src/stdafx.h +++ b/protocols/ICQ-WIM/src/stdafx.h @@ -84,6 +84,7 @@ #define DB_KEY_ATOKEN "AToken" #define DB_KEY_RCLIENTID "RClientID" #define DB_KEY_LASTMSGID "LastMsgId" +#define DB_KEY_REMOTEREAD "RemoteReadId" #define DB_KEY_SESSIONKEY "SessionKey" #include "http.h" |