diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-29 14:53:33 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-29 14:53:33 +0000 |
commit | 2fcca210a1f695d7a932b873ae00dc702d42cfeb (patch) | |
tree | 2f06ee3f54a5d7cd6f479497cfd2111c2f5afffa /protocols/SkypeWeb/src/skype_search.cpp | |
parent | 72e13eb85e4b7aaf0ba82a2de750e1eee454bd6b (diff) |
SkypeWeb to use new json parser
git-svn-id: http://svn.miranda-ng.org/main/trunk@13891 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_search.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_search.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/protocols/SkypeWeb/src/skype_search.cpp b/protocols/SkypeWeb/src/skype_search.cpp index b74daf47c1..1b77576d66 100644 --- a/protocols/SkypeWeb/src/skype_search.cpp +++ b/protocols/SkypeWeb/src/skype_search.cpp @@ -37,8 +37,7 @@ void CSkypeProto::SearchBasicThread(void* id) void CSkypeProto::OnSearch(const NETLIBHTTPREQUEST *response)
{
debugLogA(__FUNCTION__);
- if (response == NULL)
- {
+ if (response == NULL) {
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
return;
}
@@ -49,29 +48,28 @@ void CSkypeProto::OnSearch(const NETLIBHTTPREQUEST *response) return;
}
- JSONROOT root(response->pData);
- if (root == NULL)
- {
+ JSONNode root = JSONNode::parse(response->pData);
+ if (!root) {
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
return;
}
- JSONNODE *items = json_as_array(root);
- for (size_t i = 0; i < json_size(items); i++)
+ const JSONNode &items = root.as_array();
+ for (size_t i = 0; i < items.size(); i++)
{
- JSONNODE *item = json_at(items, i);
- JSONNODE *ContactCards = json_get(item, "ContactCards");
- JSONNODE *Skype = json_get(ContactCards, "Skype");
+ const JSONNode &item = items.at(i);
+ const JSONNode &ContactCards = item["ContactCards"];
+ const JSONNode &Skype = ContactCards["Skype"];
- TCHAR *sDisplayName = json_as_string(json_get(Skype, "DisplayName"));
- TCHAR *sSkypeName = json_as_string(json_get(Skype, "SkypeName"));
+ CMString tszDisplayName(Skype["DisplayName"].as_mstring());
+ CMString tszNick(Skype["SkypeName"].as_mstring());
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.id = mir_wstrdup(sSkypeName);
- psr.nick = mir_wstrdup(sDisplayName);
+ psr.id = tszDisplayName.GetBuffer();
+ psr.nick = tszNick.GetBuffer();
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
}
- json_free(items);
+
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
\ No newline at end of file |