diff options
author | George Hazan <ghazan@miranda.im> | 2022-10-19 20:42:14 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-10-19 20:42:21 +0300 |
commit | f58bf1b1c32a62f3b6f3d5dd309a86140ac2964d (patch) | |
tree | 1a72765af19a64cbb1f3a99c0acfe3287b0f62a6 /protocols/WhatsAppWeb/src/server.cpp | |
parent | e9a5f03334b340ebd9e893874425f59ec6fe2f5d (diff) |
WhatsApp: basic message processing
Diffstat (limited to 'protocols/WhatsAppWeb/src/server.cpp')
-rw-r--r-- | protocols/WhatsAppWeb/src/server.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/protocols/WhatsAppWeb/src/server.cpp b/protocols/WhatsAppWeb/src/server.cpp index 3a83bc8f28..91f36b7df7 100644 --- a/protocols/WhatsAppWeb/src/server.cpp +++ b/protocols/WhatsAppWeb/src/server.cpp @@ -283,6 +283,27 @@ void WhatsAppProto::SendKeepAlive() } } +void WhatsAppProto::SendReceipt(const char *pszTo, const char *pszParticipant, const char *pszId, const char *pszType) +{ + WANode receipt("receipt"); + receipt << CHAR_PARAM("id", pszId); + + if (!mir_strcmp(pszType, "read") || !mir_strcmp(pszType, "read-self")) + receipt << INT_PARAM("t", time(0)); + + if (!mir_strcmp(pszType, "sender") && WAJid(pszTo).isUser()) + receipt << CHAR_PARAM("to", pszParticipant) << CHAR_PARAM("recipient", pszTo); + else { + receipt << CHAR_PARAM("to", pszTo); + if (pszParticipant) + receipt << CHAR_PARAM("participant", pszParticipant); + } + + if (pszType) + receipt << CHAR_PARAM("type", pszType); + WSSendNode(receipt, &WhatsAppProto::OnIqDoNothing); +} + void WhatsAppProto::SetServerStatus(int iStatus) { if (mir_wstrlen(m_wszNick)) |