summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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");
}