summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/iq.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-11-18 20:16:14 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-11-18 20:16:14 +0300
commite11b467c11b01de711d5641b7aaa2f3bdb3fd398 (patch)
tree4cdcd2f3cc692041baae35333299e6d1d0972840 /protocols/WhatsApp/src/iq.cpp
parentb3061e352adfb4620fe407e59bcbe91d766669b9 (diff)
WhatsApp: fix for the requests' queue processing
Diffstat (limited to 'protocols/WhatsApp/src/iq.cpp')
-rw-r--r--protocols/WhatsApp/src/iq.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/protocols/WhatsApp/src/iq.cpp b/protocols/WhatsApp/src/iq.cpp
index 6700b4e04a..c3f4ba2a38 100644
--- a/protocols/WhatsApp/src/iq.cpp
+++ b/protocols/WhatsApp/src/iq.cpp
@@ -97,7 +97,7 @@ void WhatsAppProto::OnIqGetKeys(const WANode &node, void *pUserInfo)
m_signalStore.injectSession(it);
// don't forget to send delayed message when all keys are retrieved
- if (pUserInfo != INVALID_HANDLE_VALUE)
+ if (pUserInfo)
SendTask((WASendTask *)pUserInfo);
}
@@ -122,7 +122,7 @@ void WhatsAppProto::OnIqGetUsync(const WANode &node)
pKey->addChild("user")->addAttr("jid", it->toString());
}
if (pKey->getChildren().getCount() > 0)
- WSSendNode(iq, &WhatsAppProto::OnIqGetKeys, INVALID_HANDLE_VALUE);
+ WSSendNode(iq, &WhatsAppProto::OnIqGetKeys, nullptr);
}
}
@@ -252,13 +252,15 @@ void WhatsAppProto::OnIqPairSuccess(const WANode &node)
void WhatsAppProto::OnIqResult(const WANode &node)
{
- if (auto *pszId = node.getAttr("id"))
- for (auto &it : m_arPacketQueue)
- if (it->szPacketId == pszId)
- if (it->pUserInfo)
- (this->*it->pHandlerFull)(node, it->pUserInfo);
- else
- (this->*it->pHandler)(node);
+ if (auto *pszId = node.getAttr("id")) {
+ for (auto &it : m_arPacketQueue) {
+ if (it->szPacketId == pszId) {
+ it->Execute(this, node);
+ m_arPacketQueue.remove(it);
+ break;
+ }
+ }
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////