From 8834935d6dbfd190b0a39ac8f30cce571f08750e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 23 Oct 2022 13:01:28 +0300 Subject: WhatsApp: sending acks & read receipts --- protocols/WhatsApp/src/server.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'protocols/WhatsApp/src/server.cpp') diff --git a/protocols/WhatsApp/src/server.cpp b/protocols/WhatsApp/src/server.cpp index efe293c5b0..f5590a4e77 100644 --- a/protocols/WhatsApp/src/server.cpp +++ b/protocols/WhatsApp/src/server.cpp @@ -262,6 +262,23 @@ void WhatsAppProto::OnLoggedOut(void) setAllContactStatuses(ID_STATUS_OFFLINE, false); } +///////////////////////////////////////////////////////////////////////////////////////// +// Service packets sending + +void WhatsAppProto::SendAck(const WANode &node) +{ + WANode ack("ack"); + ack << CHAR_PARAM("to", node.getAttr("from")) << CHAR_PARAM("id", node.getAttr("id")) << CHAR_PARAM("class", node.title); + if (node.title != "message") + if (auto *param = node.getAttr("type")) + ack << CHAR_PARAM("type", param); + if (auto *param = node.getAttr("participant")) + ack << CHAR_PARAM("participant", param); + if (auto *param = node.getAttr("recipient")) + ack << CHAR_PARAM("recipient", param); + WSSendNode(ack); +} + void WhatsAppProto::SendKeepAlive() { time_t now = time(0); -- cgit v1.2.3