summaryrefslogtreecommitdiff
path: root/protocols/WhatsAppWeb/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-04-21 20:10:48 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-04-21 20:10:48 +0300
commitffaa25f519acd93da704bf1347de4bcadd065c73 (patch)
tree32595dbf03cb9f4faf71e134e4bd2510bbede4fb /protocols/WhatsAppWeb/src
parentcefe13e9c64aa74f2a9e1b2d7bd6115267911a06 (diff)
we shouldn't mark messages as read automatically when they come online
Diffstat (limited to 'protocols/WhatsAppWeb/src')
-rw-r--r--protocols/WhatsAppWeb/src/proto.h2
-rw-r--r--protocols/WhatsAppWeb/src/server.cpp8
2 files changed, 5 insertions, 5 deletions
diff --git a/protocols/WhatsAppWeb/src/proto.h b/protocols/WhatsAppWeb/src/proto.h
index 7ab3bd2921..3d66a8f3ff 100644
--- a/protocols/WhatsAppWeb/src/proto.h
+++ b/protocols/WhatsAppWeb/src/proto.h
@@ -128,7 +128,7 @@ class WhatsAppProto : public PROTO<WhatsAppProto>
// binary packets
void ProcessBinaryPacket(const MBinBuffer &buf);
- void ProcessAdd(const JSONNode &node);
+ void ProcessAdd(const CMStringA &type, const JSONNode &node);
void ProcessChats(const JSONNode &node);
void ProcessContacts(const JSONNode &node);
diff --git a/protocols/WhatsAppWeb/src/server.cpp b/protocols/WhatsAppWeb/src/server.cpp
index 9c7bd92832..db2403034a 100644
--- a/protocols/WhatsAppWeb/src/server.cpp
+++ b/protocols/WhatsAppWeb/src/server.cpp
@@ -444,15 +444,15 @@ void WhatsAppProto::ProcessBinaryPacket(const MBinBuffer &buf)
else if (szType == "chat")
ProcessChats(root["$list$"]);
else {
- CMStringW szAdd = root["add"].as_mstring();
+ CMStringA szAdd = root["add"].as_mstring();
if (!szAdd.IsEmpty())
- ProcessAdd(root["$list$"]);
+ ProcessAdd(szAdd, root["$list$"]);
}
}
/////////////////////////////////////////////////////////////////////////////////////////
-void WhatsAppProto::ProcessAdd(const JSONNode &list)
+void WhatsAppProto::ProcessAdd(const CMStringA &type, const JSONNode &list)
{
for (auto &it : list) {
std::string buf = it["$bin$"].as_string();
@@ -508,7 +508,7 @@ void WhatsAppProto::ProcessAdd(const JSONNode &list)
PROTORECVEVENT pre = { 0 };
pre.timestamp = dwTimestamp;
pre.szMessage = szMsgText.GetBuffer();
- pre.flags = PREF_CREATEREAD;
+ pre.flags = (type == "relay" ? 0 : PREF_CREATEREAD);
pre.szMsgId = key.id().c_str();
if (key.fromme())
pre.flags |= PREF_SENT;