From 4b848ca78f303353e07b8b9ee49cfc7797304a5d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 2 May 2025 17:22:39 +0300 Subject: WhatsApp: prevent protocol from being disconnected if there was a phone call handled by another device --- protocols/WhatsApp/src/iq.cpp | 8 ++++++++ protocols/WhatsApp/src/proto.h | 1 + 2 files changed, 9 insertions(+) (limited to 'protocols/WhatsApp/src') diff --git a/protocols/WhatsApp/src/iq.cpp b/protocols/WhatsApp/src/iq.cpp index 4584bd59de..aa37ad20d9 100644 --- a/protocols/WhatsApp/src/iq.cpp +++ b/protocols/WhatsApp/src/iq.cpp @@ -490,6 +490,13 @@ void WhatsAppProto::OnReceiveInfo(const WANode &node) ///////////////////////////////////////////////////////////////////////////////////////// +void WhatsAppProto::OnReceiveCall(const WANode &node) +{ + SendAck(node); +} + +///////////////////////////////////////////////////////////////////////////////////////// + void WhatsAppProto::ProcessReceipt(MCONTACT hContact, const char *msgId, bool bRead) { MEVENT hEvent = db_event_getById(m_szModuleName, msgId); @@ -557,6 +564,7 @@ void WhatsAppProto::InitPersistentHandlers() m_arPersistent.insert(new WAPersistentHandler("ack", 0, 0, 0, &WhatsAppProto::OnReceiveAck)); m_arPersistent.insert(new WAPersistentHandler("ib", 0, 0, 0, &WhatsAppProto::OnReceiveInfo)); + m_arPersistent.insert(new WAPersistentHandler("call", 0, 0, 0, &WhatsAppProto::OnReceiveCall)); m_arPersistent.insert(new WAPersistentHandler("failure", 0, 0, 0, &WhatsAppProto::OnReceiveFailure)); m_arPersistent.insert(new WAPersistentHandler("message", 0, 0, 0, &WhatsAppProto::OnReceiveMessage)); m_arPersistent.insert(new WAPersistentHandler("receipt", 0, 0, 0, &WhatsAppProto::OnReceiveReceipt)); diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h index 44b4d6de92..ff2179f84f 100644 --- a/protocols/WhatsApp/src/proto.h +++ b/protocols/WhatsApp/src/proto.h @@ -422,6 +422,7 @@ class WhatsAppProto : public PROTO void OnNotifyEncrypt(const WANode &node); void OnNotifyPicture(const WANode &node); void OnReceiveAck(const WANode &node); + void OnReceiveCall(const WANode &node); void OnReceiveChatState(const WANode &node); void OnReceiveFailure(const WANode &node); void OnReceiveInfo(const WANode &node); -- cgit v1.2.3