diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-05-02 14:34:42 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-05-02 14:34:42 +0000 |
commit | cf379ef3c47b386c970d7d0f8724f85abcbff8cc (patch) | |
tree | 2d4ee097db62491c252e987bfc3a74835f52389b /protocols/SkypeWeb/src/skype_polling.cpp | |
parent | 438d7d37135645c4c57c87b9375a4c96e2359d46 (diff) |
SkypeWeb: Polling refactoring. Small fix.
git-svn-id: http://svn.miranda-ng.org/main/trunk@13374 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_polling.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_polling.cpp | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index 5c069c06a4..df80efc787 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -73,33 +73,41 @@ void CSkypeProto::PollingThread(void*) continue;
}
- if (response->resultCode != 200)
+ if (response->resultCode == 200)
{
- errors++;
+ if (response->pData)
+ {
+ JSONROOT root(response->pData);
+ JSONNODE *events = json_get(root, "eventMessages");
+ if (events != NULL)
+ {
+ ParsePollData(root);
+ }
+ }
}
-
- if (response->pData)
+ else
{
- JSONROOT root(response->pData);
- JSONNODE *eventMsgs = json_get(root, "eventMessages");
- JSONNODE *errorCode = json_get(root, "errorCode");
-
- if (eventMsgs != NULL)
- ParsePollData(root);
+ errors++;
- else if (errorCode != NULL)
+ if (response->pData)
{
- errors++;
- debugLogA(__FUNCTION__": polling error %d", json_as_int(errorCode));
- if (json_as_int(errorCode) == 729)
+ JSONROOT root(response->pData);
+ JSONNODE *error = json_get(root, "errorCode");
+ if (error != NULL)
{
- SendRequest(new CreateEndpointRequest(TokenSecret), &CSkypeProto::OnEndpointCreated);
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response);
- delete request;
- break;
- }
+ int errorCode = json_as_int(error);
+
+ if (errorCode == 729)
+ {
+ SendRequest(new CreateEndpointRequest(TokenSecret), &CSkypeProto::OnEndpointCreated);
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response);
+ delete request;
+ break;
+ }
+ }
}
}
+
m_pollingConnection = response->nlc;
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response);
delete request;
|