summaryrefslogtreecommitdiff
path: root/protocols/VKontakte
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2014-12-28 10:53:32 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2014-12-28 10:53:32 +0000
commitc7c1a75a0748eb688cc87796f6bd0d1dfd2923a1 (patch)
treeb1f861cfece2f012a604a0f752a4ab7bf8b28de1 /protocols/VKontakte
parent28e41061006a42d0866fbb68c65834e77f896fa4 (diff)
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
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r--protocols/VKontakte/src/misc.cpp12
-rw-r--r--protocols/VKontakte/src/vk.h1
2 files changed, 13 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>.
#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