diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-05-28 10:09:40 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-05-28 10:09:40 +0000 |
commit | 7b2a41081e47ef013f53145ae5d7f6395ff26833 (patch) | |
tree | 21e5da55ec137a67b76252b47f63cf7b61613249 /protocols/VKontakte/src/vk_status.cpp | |
parent | 5f288f2ae11634f7470e6ab5c09f9625c12021c6 (diff) |
VKontakte:
rework code to JSONNode class
upgrade vk api to 5.33
code cleanup
version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@13868 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_status.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_status.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/protocols/VKontakte/src/vk_status.cpp b/protocols/VKontakte/src/vk_status.cpp index e7d6ee7cc6..1c4490b324 100644 --- a/protocols/VKontakte/src/vk_status.cpp +++ b/protocols/VKontakte/src/vk_status.cpp @@ -153,16 +153,16 @@ void CVkProto::OnReceiveStatus(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) debugLogA("CVkProto::OnReceiveStatus %d", reply->resultCode);
if (reply->resultCode != 200)
return;
- JSONROOT pRoot;
- JSONNODE *pResponse = CheckJsonResponse(pReq, reply, pRoot);
- if (pResponse == NULL)
+ JSONNode jnRoot;
+ const JSONNode &jnResponse = CheckJsonResponse(pReq, reply, jnRoot);
+ if (!jnResponse)
return;
- JSONNODE *pAudio = json_get(pResponse, "audio");
- if (pAudio == NULL) {
- ptrT ptszStatusText(json_as_string(json_get(pResponse, "text")));
- if (ptszStatusText[0] != TCHAR(9835))
- setTString("OldStatusMsg", ptszStatusText);
+ const JSONNode &jnAudio = jnResponse["audio"];
+ if (jnAudio.isnull()) {
+ CMString tszStatusText(jnResponse["text"].as_mstring());
+ if (tszStatusText.GetBuffer()[0] != TCHAR(9835))
+ setTString("OldStatusMsg", tszStatusText);
}
}
@@ -184,13 +184,13 @@ void CVkProto::RetrieveStatusMusic(const CMString &StatusMsg) return;
CMString code;
- ptrT ptszOldStatusMsg(db_get_tsa(0, m_szModuleName, "OldStatusMsg"));
+ CMString tszOldStatusMsg(db_get_tsa(0, m_szModuleName, "OldStatusMsg"));
if (StatusMsg.IsEmpty()) {
if (m_iMusicSendMetod == sendBroadcastOnly)
code = "API.audio.setBroadcast();return null;";
else {
CMString codeformat("API.status.set({text:\"%s\"});return null;");
- code.AppendFormat(codeformat, ptszOldStatusMsg);
+ code.AppendFormat(codeformat, tszOldStatusMsg);
}
m_bSetBroadcast = false;
}
|