diff options
Diffstat (limited to 'protocols/VKontakte/src/vk_captcha.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_captcha.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/protocols/VKontakte/src/vk_captcha.cpp b/protocols/VKontakte/src/vk_captcha.cpp index 3969850fe8..58d212fd8c 100644 --- a/protocols/VKontakte/src/vk_captcha.cpp +++ b/protocols/VKontakte/src/vk_captcha.cpp @@ -1,5 +1,5 @@ /*
-Copyright (c) 2013-24 Miranda NG team (https://miranda-ng.org)
+Copyright (c) 2013-25 Miranda NG team (https://miranda-ng.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -69,20 +69,39 @@ bool CVkProto::RunCaptchaForm(LPCSTR szUrl, CMStringA &result) bool CVkProto::ApplyCaptcha(AsyncHttpRequest *pReq, const JSONNode &jnErrorNode)
{
debugLogA("CVkProto::ApplyCaptcha");
- if (!IsOnline())
- return false;
+ if (m_bCaptchaReqInProgress)
+ return true;
+
+ m_bCaptchaReqInProgress = true;
CMStringA szUrl(jnErrorNode["captcha_img"].as_mstring());
CMStringA szSid(jnErrorNode["captcha_sid"].as_mstring());
- if (szUrl.IsEmpty() || szSid.IsEmpty())
+ if (szUrl.IsEmpty() || szSid.IsEmpty()) {
+ m_bCaptchaReqInProgress = false;
return false;
+ }
CMStringA userReply;
- if (!RunCaptchaForm(szUrl, userReply))
+ if (!RunCaptchaForm(szUrl, userReply)) {
+ m_bCaptchaReqInProgress = false;
return false;
+ }
+
+ Push(new AsyncHttpRequest(this,
+ REQUEST_GET,
+ (m_iStatus == ID_STATUS_INVISIBLE) ? "/method/account.setOffline" : "/method/account.setOnline",
+ true,
+ &CVkProto::OnReceiveSmth,
+ AsyncHttpRequest::rpCaptcha
+ )
+ << CHAR_PARAM("captcha_sid", szSid)
+ << CHAR_PARAM("captcha_key", userReply.GetString())
+ );
- pReq << CHAR_PARAM("captcha_sid", szSid) << CHAR_PARAM("captcha_key", userReply.GetString());
pReq->bNeedsRestart = true;
+ debugLogA("CVkProto::ApplyCaptcha for %s", pReq->m_szUrl.c_str());
+ m_bCaptchaReqInProgress = false;
+
return true;
}
\ No newline at end of file |