summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-10-12 12:22:16 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-10-12 12:22:16 +0000
commita652830f2ec1d44c9e61b1164a878662798ad460 (patch)
tree09bf57eed53c2b7d85ac4817aabf1c6ab7b51a84 /protocols/WhatsApp/src
parentf1de324ffe4bef703a4b1b8f1ea43eb7396f9db3 (diff)
fix for a rare crash
git-svn-id: http://svn.miranda-ng.org/main/trunk@15537 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
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);
}