summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/server.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-10-23 13:01:28 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-10-23 13:01:28 +0300
commit8834935d6dbfd190b0a39ac8f30cce571f08750e (patch)
treed04ee1d79df3b535aa5b502b18933cd77c0ff467 /protocols/WhatsApp/src/server.cpp
parentee4c113c7ce309a92b39e2d8f9fcb8c73877aa65 (diff)
WhatsApp: sending acks & read receipts
Diffstat (limited to 'protocols/WhatsApp/src/server.cpp')
-rw-r--r--protocols/WhatsApp/src/server.cpp17
1 files changed, 17 insertions, 0 deletions
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);