summaryrefslogtreecommitdiff
path: root/protocols/ICQ-WIM
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-01-28 23:08:28 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-01-28 23:08:28 +0300
commit0ae0ccdec97de5e60f1e37299c8858b8f4887c29 (patch)
treecdc9c8dcd876fc6d3e7bb442a594543c3d4fa4af /protocols/ICQ-WIM
parent24b5718cb9f3e02f262230b1acddabb311437644 (diff)
fixes #1799 (if a contact isn't in your server list, only one message is loaded from the history)
Diffstat (limited to 'protocols/ICQ-WIM')
-rw-r--r--protocols/ICQ-WIM/src/server.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp
index 2393d94ab2..6ba6a3ca13 100644
--- a/protocols/ICQ-WIM/src/server.cpp
+++ b/protocols/ICQ-WIM/src/server.cpp
@@ -234,7 +234,7 @@ void CIcqProto::ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNo
CMStringW wszText;
CMStringW type(it["mediaType"].as_mstring());
- if (type == "text")
+ if (type == "text" || type.IsEmpty())
wszText = it["text"].as_mstring();
else if (type == "sticker") {
CMStringW wszUrl, wszSticker(it["sticker"]["id"].as_mstring());
@@ -848,14 +848,12 @@ void CIcqProto::ProcessHistData(const JSONNode &ev)
else hContact = CreateContact(_wtol(wszId), true);
__int64 lastMsgId = getId(hContact, DB_KEY_LASTMSGID);
- __int64 srvLastId = _wtoi64(ev["lastMsgId"].as_mstring());
-
- // on first start we don't load history not to create dups
if (lastMsgId == 0)
- setId(hContact, DB_KEY_LASTMSGID, srvLastId);
+ lastMsgId = _wtoi64(ev["yours"]["lastRead"].as_mstring());
+
// or load missing messages if any
- else if (ev["unreadCnt"].as_int() > 0)
- RetrieveUserHistory(hContact, lastMsgId, srvLastId);
+ if (ev["unreadCnt"].as_int() > 0)
+ RetrieveUserHistory(hContact, lastMsgId, _wtoi64(ev["lastMsgId"].as_mstring()));
// check remote read
if (g_bMessageState) {