summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/misc.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-10-07 12:19:50 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-10-07 12:19:50 +0000
commitae6d0b3c9f732c3770fc4bf00ba2e52012671108 (patch)
treef04b08982dc161ff37de1889bae8a39895cee0d3 /protocols/VKontakte/src/misc.cpp
parent9cc628c7871629af3d660029c0d764eef44c733b (diff)
STL removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@6395 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
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