diff options
author | George Hazan <ghazan@miranda.im> | 2022-11-18 16:34:58 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-11-18 16:34:58 +0300 |
commit | 2501ef6a104326fe14ad13bf3023ba7a62d2da46 (patch) | |
tree | 3283c9dff156e4ea7f4443e350e945061cf2153f /protocols/WhatsApp | |
parent | a55799c07bc5d1fddd51f22683710d31c19376cd (diff) |
WhatsApp: blocklist analysis added for AppSync handler
Diffstat (limited to 'protocols/WhatsApp')
-rw-r--r-- | protocols/WhatsApp/src/iq.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/protocols/WhatsApp/src/iq.cpp b/protocols/WhatsApp/src/iq.cpp index 5e31f71372..474a54a376 100644 --- a/protocols/WhatsApp/src/iq.cpp +++ b/protocols/WhatsApp/src/iq.cpp @@ -11,9 +11,17 @@ void WhatsAppProto::OnAccountSync(const WANode &node) { m_arDevices.destroy(); - for (auto &it : node.getChild("devices")->getChildren()) - if (it->title == "device") - m_arDevices.insert(new WAJid(it->getAttr("jid"), it->getAttrInt("key-index"))); + if (auto *pList = node.getChild("devices")) + for (auto &it : pList->getChildren()) + if (it->title == "device") + m_arDevices.insert(new WAJid(it->getAttr("jid"), it->getAttrInt("key-index"))); + + if (auto *pList = node.getChild("blocklist")) + for (auto &it : pList->getChildren()) + if (it->title == "item") { + auto *pUser = AddUser(it->getAttr("jid"), false); + Contact::Hide(pUser->hContact, 0 == mir_strcmp(it->getAttr("action"), "block")); + } SendAck(node); } |