summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/WhatsApp/src')
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp b/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp
index efcb9551fb..8e0c4a2983 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp
@@ -102,30 +102,28 @@ std::vector<unsigned char>* WALogin::getAuthBlob(const std::vector<unsigned char
std::vector<unsigned char> WALogin::readFeaturesUntilChallengeOrSuccess()
{
while (ProtocolTreeNode *root = m_pConnection->in.nextTree()) {
- string tmp = root->toString();
- m_pConnection->logData(tmp.c_str());
-
- if (ProtocolTreeNode::tagEquals(root, "stream:features")) {
- m_pConnection->supports_receipt_acks = root->getChild("receipt_acks") != NULL;
- delete root;
- }
- else if (ProtocolTreeNode::tagEquals(root, "challenge")) {
+ if (ProtocolTreeNode::tagEquals(root, "challenge")) {
std::vector<unsigned char> challengedata(root->data->begin(), root->data->end());
delete root;
+
this->sendResponse(challengedata);
m_pConnection->logData("Send response");
std::vector<unsigned char> data = this->readSuccess();
m_pConnection->logData("Read success");
return std::vector<unsigned char>(data.begin(), data.end());
}
- else if (ProtocolTreeNode::tagEquals(root, "success")) {
+
+ if (ProtocolTreeNode::tagEquals(root, "success")) {
std::vector<unsigned char> ret(root->data->begin(), root->data->end());
this->parseSuccessNode(root);
delete root;
return ret;
}
- else
- delete root;
+
+ if (ProtocolTreeNode::tagEquals(root, "stream:features"))
+ m_pConnection->supports_receipt_acks = root->getChild("receipt_acks") != NULL;
+
+ delete root;
}
throw WAException("fell out of loop in readFeaturesAndChallenge", WAException::CORRUPT_STREAM_EX, 0);
}