summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/misc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/VKontakte/src/misc.cpp')
-rw-r--r--protocols/VKontakte/src/misc.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index a7486fce91..a59a4a16b4 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -52,6 +52,21 @@ LPCSTR findHeader(NETLIBHTTPREQUEST *pReq, LPCSTR szField)
return NULL;
}
+bool CVkProto::CheckJsonResult(JSONNODE *pNode)
+{
+ if (pNode == NULL)
+ return false;
+
+ JSONNODE *pError = json_get(pNode, "error"), *pErrorCode = json_get(pError, "error_code");
+ if (pError == NULL || pErrorCode == NULL)
+ return true;
+
+ int iErrorCode = json_as_int(pErrorCode);
+ if (iErrorCode == ERROR_ACCESS_DENIED)
+ ConnectionFailed(LOGINERR_WRONGPASSWORD);
+ return iErrorCode == 0;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// Quick & dirty form parser