diff options
Diffstat (limited to 'protocols/WhatsAppWeb/src/server.cpp')
-rw-r--r-- | protocols/WhatsAppWeb/src/server.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/protocols/WhatsAppWeb/src/server.cpp b/protocols/WhatsAppWeb/src/server.cpp index 1a66504532..ad3b94a64f 100644 --- a/protocols/WhatsAppWeb/src/server.cpp +++ b/protocols/WhatsAppWeb/src/server.cpp @@ -320,9 +320,6 @@ bool WhatsAppProto::ServerThreadWorker() continue; } - offset = 0; - debugLogA("Got packet: buffer = %d, opcode = %d, headerSize = %d, final = %d, masked = %d", bufSize, hdr.opCode, hdr.headerSize, hdr.bIsFinal, hdr.bIsMasked); - // we have some additional data, not only opcode if ((size_t)bufSize > hdr.headerSize) { netbuf.append(buf, bufSize); @@ -330,6 +327,9 @@ bool WhatsAppProto::ServerThreadWorker() break; } + offset = 0; + debugLogA("Got packet: buffer = %d, opcode = %d, headerSize = %d, final = %d, masked = %d", bufSize, hdr.opCode, hdr.headerSize, hdr.bIsFinal, hdr.bIsMasked); + // read all payloads from the current buffer, one by one size_t prevSize = 0; while (true) { @@ -424,6 +424,13 @@ bool WhatsAppProto::ServerThreadWorker() void WhatsAppProto::ProcessBinaryPacket(const MBinBuffer &buf) { + WAReader reader(buf.data(), buf.length()); + + JSONNode root; + if (!reader.readNode(root)) + return; + + debugLogA("packed JSON: %s", root.write().c_str()); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -447,7 +454,7 @@ void WhatsAppProto::ProcessBlocked(const JSONNode &node) for (auto &it : node["blocklist"]) { auto *pUser = AddUser(it.as_string().c_str(), false); Ignore_Ignore(pUser->hContact, IGNOREEVENT_ALL); - Contact_RemoveFromList(pUser->hContact); + Contact_Hide(pUser->hContact); } } |