summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2015-02-11 10:14:35 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2015-02-11 10:14:35 +0000
commite173a97cdc835e903d575de2b33fa95e9c94fa77 (patch)
treeac65f7d8c4b62747d58c6ce80afca73babc73c64 /protocols
parent85f31b137eb97138e81a185185882d445903f84d (diff)
VKontakte:
add 2-Step Verification support version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@12087 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/VKontakte/src/misc.cpp14
-rw-r--r--protocols/VKontakte/src/version.h2
-rw-r--r--protocols/VKontakte/src/vk_proto.h1
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp15
4 files changed, 27 insertions, 5 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index f1b78ad7aa..f29488d1a2 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -455,6 +455,8 @@ bool CVkProto::AutoFillForm(char *pBody, CMStringA &szAction, CMStringA& szResul
if (!RunCaptchaForm(getAttr(pCaptchaBeg, "src"), value))
return false;
}
+ else if (name == "code")
+ value = RunConfirmationCode();
if (!result.IsEmpty())
result.AppendChar('&');
@@ -468,6 +470,18 @@ bool CVkProto::AutoFillForm(char *pBody, CMStringA &szAction, CMStringA& szResul
return true;
}
+
+CMString CVkProto::RunConfirmationCode()
+{
+ ENTER_STRING pForm = { sizeof(pForm) };
+ pForm.type = ESF_PASSWORD;
+ pForm.caption = TranslateT("Enter confirmation code ");
+ pForm.ptszInitVal = NULL;
+ pForm.szModuleName = m_szModuleName;
+ pForm.szDataPrefix = "confirmcode_";
+ return (!EnterString(&pForm)) ? CMString() : CMString(pForm.ptszResult);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
void CVkProto::GrabCookies(NETLIBHTTPREQUEST *nhr)
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h
index 45028dc385..297890e4f4 100644
--- a/protocols/VKontakte/src/version.h
+++ b/protocols/VKontakte/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 45
+#define __BUILD_NUM 46
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index bf5132c03b..1d7a898f7c 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -399,6 +399,7 @@ struct CVkProto : public PROTO<CVkProto>
void OnReceiveSmth(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
bool AutoFillForm(char*, CMStringA&, CMStringA&);
+ CMString RunConfirmationCode();
void GrabCookies(NETLIBHTTPREQUEST *nhr);
void ApplyCookies(AsyncHttpRequest*);
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index a67b684c70..a99f131539 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -175,10 +175,13 @@ void CVkProto::OnOAuthAuthorize(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq
pReq->m_pFunc = &CVkProto::OnOAuthAuthorize;
pReq->AddHeader("Referer", m_prevUrl);
pReq->Redirect(reply);
- if (pReq->m_szUrl) {
+ if (!pReq->m_szUrl.IsEmpty()) {
+ if (pReq->m_szUrl.GetBuffer()[0] == '/')
+ pReq->m_szUrl = "https://m.vk.com" + pReq->m_szUrl;
ApplyCookies(pReq);
m_prevUrl = pReq->m_szUrl;
}
+
Push(pReq);
}
}
@@ -211,7 +214,11 @@ void CVkProto::OnOAuthAuthorize(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq
pReq->requestType = REQUEST_POST;
pReq->flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11;
pReq->m_szParam = szBody;
- pReq->m_szUrl = szAction; m_prevUrl = pReq->m_szUrl;
+ pReq->m_szUrl = szAction;
+ if (!pReq->m_szUrl.IsEmpty())
+ if (pReq->m_szUrl.GetBuffer()[0] == '/')
+ pReq->m_szUrl = "https://m.vk.com" + pReq->m_szUrl;
+ m_prevUrl = pReq->m_szUrl;
pReq->m_pFunc = &CVkProto::OnOAuthAuthorize;
pReq->AddHeader("Content-Type", "application/x-www-form-urlencoded");
pReq->Redirect(reply);
@@ -458,8 +465,8 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
LONG userID = getDword(hContact, "ID", -1);
if (userID == m_myUserId || userID == VK_FEED_USER)
continue;
- if (getWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- setWord(hContact, "Status", ID_STATUS_OFFLINE);
+ if (getWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ setWord(hContact, "Status", ID_STATUS_OFFLINE);
SetMirVer(hContact, -1);
db_unset(hContact, m_szModuleName, "ListeningTo");
}