From 0072a0880c077fc0a21fd57214e6c5bf8497402a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 26 Jan 2015 00:17:21 +0000 Subject: first version that logs in git-svn-id: http://svn.miranda-ng.org/main/trunk@11913 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp') diff --git a/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp b/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp index e009968b59..40471ae559 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp @@ -32,19 +32,19 @@ std::vector* WALogin::login(const std::vector& aut { connection->out->streamStart(connection->domain, connection->resource); - _LOGDATA("sent stream start"); + connection->logData("sent stream start"); sendFeatures(); - _LOGDATA("sent features"); + connection->logData("sent features"); sendAuth(authBlob); - _LOGDATA("send auth, auth blob size %d", authBlob.size()); + connection->logData("send auth, auth blob size %d", authBlob.size()); connection->in->streamStart(); - _LOGDATA("read stream start"); + connection->logData("read stream start"); return this->readFeaturesUntilChallengeOrSuccess(); } @@ -99,6 +99,12 @@ std::vector* WALogin::getAuthBlob(const std::vector* WALogin::readFeaturesUntilChallengeOrSuccess() { while (ProtocolTreeNode *root = connection->in->nextTree()) { + #ifdef _DEBUG + { + string tmp = root->toString(); + connection->logData(tmp.c_str()); + } + #endif if (ProtocolTreeNode::tagEquals(root, "stream:features")) { connection->supports_receipt_acks = root->getChild("receipt_acks") != NULL; delete root; @@ -108,9 +114,9 @@ std::vector* WALogin::readFeaturesUntilChallengeOrSuccess() std::vector challengedata(root->data->begin(), root->data->end()); delete root; this->sendResponse(challengedata); - _LOGDATA("Send response"); + connection->logData("Send response"); std::vector data = this->readSuccess(); - _LOGDATA("Read success"); + connection->logData("Read success"); return new std::vector(data.begin(), data.end()); } if (ProtocolTreeNode::tagEquals(root, "success")) { @@ -125,7 +131,7 @@ std::vector* WALogin::readFeaturesUntilChallengeOrSuccess() void WALogin::parseSuccessNode(ProtocolTreeNode* node) { - connection->out->setLoggedIn(); + connection->out->setSecure(); const string &expiration = node->getAttributeValue("expiration"); if (!expiration.empty()) { -- cgit v1.2.3