diff options
author | ElzorFox <elzorfox@ya.ru> | 2021-05-19 08:38:22 +0500 |
---|---|---|
committer | ElzorFox <elzorfox@ya.ru> | 2021-05-19 08:38:22 +0500 |
commit | 676ff2e0bd23d7fe6b958ab3253d2dc1ccbe5eef (patch) | |
tree | a15bc55931a1dafc4a69f07e41165c9323e9698a /protocols/VKontakte | |
parent | 3e5db6cadd0d09294ce7f0123647edccd0d6859f (diff) |
VKontakte:
authorization fix
version bump
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r-- | protocols/VKontakte/src/version.h | 4 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 26 |
2 files changed, 27 insertions, 3 deletions
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index f354b5f967..fe73c99beb 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 11
-#define __BUILD_NUM 8
+#define __RELEASE_NUM 12
+#define __BUILD_NUM 0
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 3c90ec5872..013fadba8b 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -247,11 +247,35 @@ void CVkProto::OnOAuthAuthorize(NETLIBHTTPREQUEST *reply, AsyncHttpRequest*) return;
}
- if (reply->resultCode != 200 || !reply->pData || !strstr(reply->pData, "form method=\"post\"")) { // something went wrong
+ if (reply->resultCode != 200 || !reply->pData || (!strstr(reply->pData, "form method=\"post\"") && !strstr(reply->pData, "meta http-equiv=\"refresh\""))) { // something went wrong
ConnectionFailed(LOGINERR_NOSERVER);
return;
}
+ LPCSTR pBlankUrl = strstr(reply->pData, szBlankUrl);
+ if (pBlankUrl) {
+ debugLogA("CVkProto::OnOAuthAuthorize blank ulr found");
+ m_szAccessToken = nullptr;
+ LPCSTR p = strstr(pBlankUrl, VK_TOKEN_BEG);
+ if (p) {
+ p += sizeof(VK_TOKEN_BEG) - 1;
+ for (LPCSTR q = p + 1; *q; q++) {
+ if (*q == '&' || *q == '=' || *q == '\"') {
+ m_szAccessToken = mir_strndup(p, q - p);
+ break;
+ }
+ }
+ setString("AccessToken", m_szAccessToken);
+ RetrieveMyInfo();
+ }
+ else {
+ debugLogA("CVkProto::OnOAuthAuthorize blank ulr found, access_token not found");
+ delSetting("AccessToken");
+ ConnectionFailed(LOGINERR_NOSERVER);
+ }
+ return;
+ }
+
char *pMsgWarning = strstr(reply->pData, "service_msg_warning");
if (pMsgWarning) {
char *p1 = strchr(pMsgWarning, '>');
|