From de6c7df3c362fa0104e7d908c29614266caaa9d6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 26 Jan 2015 16:19:13 +0000 Subject: fixed user search & addition git-svn-id: http://svn.miranda-ng.org/main/trunk@11918 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp | 44 +++++++++++++-------------- 1 file changed, 22 insertions(+), 22 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 40471ae559..dd29850885 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp @@ -22,7 +22,7 @@ const std::string WALogin::NONCE_KEY = "nonce=\""; WALogin::WALogin(WAConnection* connection, const std::string& password) { - this->connection = connection; + m_pConnection = connection; this->password = password; this->account_kind = -1; this->expire_date = 0L; @@ -30,21 +30,21 @@ WALogin::WALogin(WAConnection* connection, const std::string& password) std::vector* WALogin::login(const std::vector& authBlob) { - connection->out->streamStart(connection->domain, connection->resource); + m_pConnection->out->streamStart(m_pConnection->domain, m_pConnection->resource); - connection->logData("sent stream start"); + m_pConnection->logData("sent stream start"); sendFeatures(); - connection->logData("sent features"); + m_pConnection->logData("sent features"); sendAuth(authBlob); - connection->logData("send auth, auth blob size %d", authBlob.size()); + m_pConnection->logData("send auth, auth blob size %d", authBlob.size()); - connection->in->streamStart(); + m_pConnection->in->streamStart(); - connection->logData("read stream start"); + m_pConnection->logData("read stream start"); return this->readFeaturesUntilChallengeOrSuccess(); } @@ -52,7 +52,7 @@ std::vector* WALogin::login(const std::vector& aut void WALogin::sendResponse(const std::vector& challengeData) { std::vector* authBlob = this->getAuthBlob(challengeData); - connection->out->write(ProtocolTreeNode("response", authBlob)); + m_pConnection->out->write(ProtocolTreeNode("response", authBlob)); } void WALogin::sendFeatures() @@ -64,7 +64,7 @@ void WALogin::sendFeatures() ProtocolTreeNode* pictureChild = new ProtocolTreeNode("w:profile:picture") << XATTR("type", "all"); children->push_back(pictureChild); - connection->out->write(ProtocolTreeNode("stream:features", NULL, children), true); + m_pConnection->out->write(ProtocolTreeNode("stream:features", NULL, children), true); } void WALogin::sendAuth(const std::vector& existingChallenge) @@ -73,8 +73,8 @@ void WALogin::sendAuth(const std::vector& existingChallenge) if (!existingChallenge.empty()) data = this->getAuthBlob(existingChallenge); - connection->out->write(ProtocolTreeNode("auth", data) << - XATTR("mechanism", "WAUTH-2") << XATTR("user", connection->user), true); + m_pConnection->out->write(ProtocolTreeNode("auth", data) << + XATTR("mechanism", "WAUTH-2") << XATTR("user", m_pConnection->user), true); } std::vector* WALogin::getAuthBlob(const std::vector& nonce) @@ -82,31 +82,31 @@ std::vector* WALogin::getAuthBlob(const std::vectorpassword, nonce, out); - this->connection->inputKey.init(out + 40, out + 60); - this->connection->outputKey.init(out, out + 20); + m_pConnection->inputKey.init(out + 40, out + 60); + m_pConnection->outputKey.init(out, out + 20); std::vector* list = new std::vector(0); for (int i = 0; i < 4; i++) list->push_back(0); - list->insert(list->end(), connection->user.begin(), connection->user.end()); + list->insert(list->end(), m_pConnection->user.begin(), m_pConnection->user.end()); list->insert(list->end(), nonce.begin(), nonce.end()); - this->connection->outputKey.encodeMessage(&((*list)[0]), 0, 4, (int)list->size() - 4); + m_pConnection->outputKey.encodeMessage(&((*list)[0]), 0, 4, (int)list->size() - 4); return list; } std::vector* WALogin::readFeaturesUntilChallengeOrSuccess() { - while (ProtocolTreeNode *root = connection->in->nextTree()) { + while (ProtocolTreeNode *root = m_pConnection->in->nextTree()) { #ifdef _DEBUG { string tmp = root->toString(); - connection->logData(tmp.c_str()); + m_pConnection->logData(tmp.c_str()); } #endif if (ProtocolTreeNode::tagEquals(root, "stream:features")) { - connection->supports_receipt_acks = root->getChild("receipt_acks") != NULL; + m_pConnection->supports_receipt_acks = root->getChild("receipt_acks") != NULL; delete root; continue; } @@ -114,9 +114,9 @@ std::vector* WALogin::readFeaturesUntilChallengeOrSuccess() std::vector challengedata(root->data->begin(), root->data->end()); delete root; this->sendResponse(challengedata); - connection->logData("Send response"); + m_pConnection->logData("Send response"); std::vector data = this->readSuccess(); - connection->logData("Read success"); + m_pConnection->logData("Read success"); return new std::vector(data.begin(), data.end()); } if (ProtocolTreeNode::tagEquals(root, "success")) { @@ -131,7 +131,7 @@ std::vector* WALogin::readFeaturesUntilChallengeOrSuccess() void WALogin::parseSuccessNode(ProtocolTreeNode* node) { - connection->out->setSecure(); + m_pConnection->out->setSecure(); const string &expiration = node->getAttributeValue("expiration"); if (!expiration.empty()) { @@ -151,7 +151,7 @@ void WALogin::parseSuccessNode(ProtocolTreeNode* node) std::vector WALogin::readSuccess() { - ProtocolTreeNode *node = connection->in->nextTree(); + ProtocolTreeNode *node = m_pConnection->in->nextTree(); if (ProtocolTreeNode::tagEquals(node, "failure")) { delete node; -- cgit v1.2.3