diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2015-04-10 09:41:12 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2015-04-10 09:41:12 +0000 |
commit | a1d2e31a7e40c3daf9b61b545aea09f3dcc40260 (patch) | |
tree | cc39289f64b23113e9604f7f5bfc74b8ada08736 /protocols | |
parent | 42f650093d1e855ef0ddbbc7dd5fd6f85e5f7279 (diff) |
skype search 2nd attempt
git-svn-id: http://svn.miranda-ng.org/main/trunk@12723 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/SkypeWeb/src/skype_search.cpp | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/protocols/SkypeWeb/src/skype_search.cpp b/protocols/SkypeWeb/src/skype_search.cpp index e8ed4c3b5d..8709ab5515 100644 --- a/protocols/SkypeWeb/src/skype_search.cpp +++ b/protocols/SkypeWeb/src/skype_search.cpp @@ -36,27 +36,42 @@ void CSkypeProto::SearchBasicThread(void* id) void CSkypeProto::OnSearch(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL)
+ if (response == NULL) {
+ ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
return;
+ }
- JSONROOT root(response->pData);
- if (root == NULL)
+ debugLogA("CSkypeProto::OnSearch %d", response->resultCode);
+ if (response->resultCode != 200) {
+ ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
return;
+ }
- /*PROTOSEARCHBYNAME *pParam = (PROTOSEARCHBYNAME *)pReq->pUserInfo;
- debugLogA("CSkypeProto::OnSearch %d", reply->resultCode);
- if (reply->resultCode != 200) {
- if (pParam) {
- mir_free(pParam->pszFirstName);
- mir_free(pParam->pszLastName);
- mir_free(pParam->pszNick);
- delete pParam;
- }
+ JSONROOT root(response->pData);
+ if (root == NULL) {
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
return;
}
- JSONROOT pRoot;
+ JSONNODE *items = json_as_array(root), *item, *node;
+ for (size_t i = 0; i < json_size(items); i++)
+ {
+ JSONNODE *item = json_at(items, i);
+ JSONNODE *ContactCards = json_get(item, "ContactCards");
+ JSONNODE *Skype = json_get(ContactCards, "Skype");
+
+ TCHAR *sDisplayName = json_as_string(json_get(Skype, "DisplayName"));
+ TCHAR *sSkypeName = json_as_string(json_get(Skype, "SkypeName"));
+
+ PROTOSEARCHRESULT psr = { sizeof(psr) };
+ psr.flags = PSR_TCHAR;
+ psr.id = mir_wstrdup(sSkypeName);
+ psr.nick = mir_wstrdup(sDisplayName);
+ ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
+ }
+ ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
+
+ /*JSONROOT pRoot;
JSONNODE *pResponse = CheckJsonResponse(pReq, reply, pRoot);
if (pResponse == NULL) {
if (pParam) {
|