summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_utils.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-01-29 19:14:39 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-01-29 19:14:39 +0300
commit8d60f01ae16e88730284757f0a062300b63b2b2d (patch)
tree16b490084d48c8d7a889d2b503ab0421f1c2c825 /protocols/SkypeWeb/src/skype_utils.cpp
parent1a1474ff783f5e6a3759110bf63ace1d0d53bd83 (diff)
fixes #2149 (SkypeWeb doesn't parse error codes)
Diffstat (limited to 'protocols/SkypeWeb/src/skype_utils.cpp')
-rw-r--r--protocols/SkypeWeb/src/skype_utils.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp
index a895fa64f8..a3a1d3419f 100644
--- a/protocols/SkypeWeb/src/skype_utils.cpp
+++ b/protocols/SkypeWeb/src/skype_utils.cpp
@@ -602,3 +602,30 @@ INT_PTR CSkypeProto::GlobalParseSkypeUriService(WPARAM wParam, LPARAM lParam)
return 1;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+JsonReply::JsonReply(const NETLIBHTTPREQUEST *pReply)
+{
+ if (pReply == nullptr) {
+ m_errorCode = 500;
+ return;
+ }
+
+ m_errorCode = pReply->resultCode;
+ if (m_errorCode != 200)
+ return;
+
+ m_root = json_parse(pReply->pData);
+ if (m_root == nullptr) {
+ m_errorCode = 500;
+ return;
+ }
+
+ m_errorCode = (*m_root)["status"]["code"].as_int();
+}
+
+JsonReply::~JsonReply()
+{
+ json_delete(m_root);
+}