summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-01-26 00:17:21 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-01-26 00:17:21 +0000
commit0072a0880c077fc0a21fd57214e6c5bf8497402a (patch)
treea4c4a2667fbca02b195ebc5c268752ab3a407aea /protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp
parentd32c7402ad63175d48579a2779d47800a2dd74c2 (diff)
first version that logs in
git-svn-id: http://svn.miranda-ng.org/main/trunk@11913 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp')
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp20
1 files changed, 13 insertions, 7 deletions
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<unsigned char>* WALogin::login(const std::vector<unsigned char>& 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<unsigned char>* WALogin::getAuthBlob(const std::vector<unsigned char
std::vector<unsigned char>* 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<unsigned char>* WALogin::readFeaturesUntilChallengeOrSuccess()
std::vector<unsigned char> challengedata(root->data->begin(), root->data->end());
delete root;
this->sendResponse(challengedata);
- _LOGDATA("Send response");
+ connection->logData("Send response");
std::vector<unsigned char> data = this->readSuccess();
- _LOGDATA("Read success");
+ connection->logData("Read success");
return new std::vector<unsigned char>(data.begin(), data.end());
}
if (ProtocolTreeNode::tagEquals(root, "success")) {
@@ -125,7 +131,7 @@ std::vector<unsigned char>* WALogin::readFeaturesUntilChallengeOrSuccess()
void WALogin::parseSuccessNode(ProtocolTreeNode* node)
{
- connection->out->setLoggedIn();
+ connection->out->setSecure();
const string &expiration = node->getAttributeValue("expiration");
if (!expiration.empty()) {