From c7c1a75a0748eb688cc87796f6bd0d1dfd2923a1 Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Sun, 28 Dec 2014 10:53:32 +0000 Subject: Vkontakte: add access denied error processing access token auto requered if permission was change git-svn-id: http://svn.miranda-ng.org/main/trunk@11662 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/misc.cpp | 12 ++++++++++++ protocols/VKontakte/src/vk.h | 1 + 2 files changed, 13 insertions(+) diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index cb28afb644..83231b2228 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -248,6 +248,17 @@ bool CVkProto::CheckJsonResult(AsyncHttpRequest *pReq, JSONNODE *pNode) case VKERR_AUTHORIZATION_FAILED: ConnectionFailed(LOGINERR_WRONGPASSWORD); break; + case VKERR_ACCESS_DENIED: + if (time(NULL) - getDword("LastAccessTokenTime", 0) > 60 * 60 * 24) { + debugLogA("CVkProto::CheckJsonResult VKERR_ACCESS_DENIED (AccessToken fail?)"); + setDword("LastAccessTokenTime", (DWORD)time(NULL)); + delSetting("AccessToken"); + ShutdownSession(); + return false; + } + debugLogA("CVkProto::CheckJsonResult VKERR_ACCESS_DENIED"); + MsgPopup(NULL, TranslateT("Access denied! Data will not be sent or received."), TranslateT("Error"), true); + break; case VKERR_CAPTCHA_NEEDED: ApplyCaptcha(pReq, pError); break; @@ -886,6 +897,7 @@ CMString CVkProto::SetBBCString(TCHAR *tszString, VKBBCType bbcType, TCHAR *tszA CMString res; if (ptszFormat == NULL) return CMString(tszString); + if (bbcType == vkbbcUrl && m_iBBCForNews != bbcAdvanced) res.AppendFormat(ptszFormat, tszString ? tszString : _T(""), tszAddString ? tszAddString : _T("")); else if (m_iBBCForNews == bbcAdvanced && bbcType >= vkbbcUrl) diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h index ff1914446f..296fcc3b19 100644 --- a/protocols/VKontakte/src/vk.h +++ b/protocols/VKontakte/src/vk.h @@ -52,6 +52,7 @@ along with this program. If not, see . #define VKERR_FLOOD_CONTROL 9 // Flood control #define VKERR_INTERNAL_SERVER_ERR 10 // Internal server error #define VKERR_CAPTCHA_NEEDED 14 // Captcha needed +#define VKERR_ACCESS_DENIED 15 // Access denied #define VKERR_COULD_NOT_SAVE_FILE 105 // Couldn't save file #define VKERR_INVALID_ALBUM_ID 114 // Invalid album id #define VKERR_INVALID_SERVER 118 // Invalid server -- cgit v1.2.3