From 45cf5a88078cd23be4a4e0ccc569763dab4220b0 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 3 Apr 2015 06:14:34 +0000 Subject: incoming messages now work git-svn-id: http://svn.miranda-ng.org/main/trunk@12583 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_polling.cpp | 104 +++++++++++++++---------------- 1 file changed, 52 insertions(+), 52 deletions(-) (limited to 'protocols/SkypeWeb/src/skype_polling.cpp') diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index aed47be086..c9dda8f31a 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -1,11 +1,11 @@ -#include "common.h" - -#define POLLING_ERRORS_LIMIT 3 - -void CSkypeProto::ParsePollData(JSONNODE *data) -{ - debugLogA("CSkypeProto::ParsePollData"); - JSONNODE *node, *item = NULL; +#include "common.h" + +#define POLLING_ERRORS_LIMIT 3 + +void CSkypeProto::ParsePollData(JSONNODE *data) +{ + debugLogA("CSkypeProto::ParsePollData"); + JSONNODE *node, *item = NULL; node = json_get(data, "eventMessages"); if (node != NULL) { @@ -40,54 +40,54 @@ void CSkypeProto::ParsePollData(JSONNODE *data) } } - } -} - -void CSkypeProto::PollingThread(void*) -{ - debugLog(_T("CSkypeProto::PollingThread: entering")); - - ptrA regToken(getStringA("registrationToken")); - const char *server = getStringA("Server"); - + } +} + +void CSkypeProto::PollingThread(void*) +{ + debugLog(_T("CSkypeProto::PollingThread: entering")); + + ptrA regToken(getStringA("registrationToken")); + const char *server = getStringA("Server"); + SubscriptionsRequest *request = new SubscriptionsRequest(regToken, server); request->Send(m_hNetlibUser); - delete request; - - int errors = 0; - bool breaked = false; - while (!isTerminated && !breaked && errors < POLLING_ERRORS_LIMIT) - { - PollRequest *request = new PollRequest(regToken, server); - NETLIBHTTPREQUEST *response = request->Send(m_hNetlibUser); - delete request; - - if (response != NULL) - { - m_pollingConnection = response->nlc; - JSONROOT root(response->pData); + delete request; + + int errors = 0; + bool breaked = false; + while (!isTerminated && !breaked && errors < POLLING_ERRORS_LIMIT) + { + PollRequest *request = new PollRequest(regToken, server); + NETLIBHTTPREQUEST *response = request->Send(m_hNetlibUser); + delete request; + + if (response != NULL) + { + m_pollingConnection = response->nlc; + JSONROOT root(response->pData); if (json_get(root, "errorCode") != NULL) { errors++; continue; - } - ParsePollData (root); - } - /*if (response->resultCode != 200) - { - errors++; - continue; - } - else - errors = 0;*/ - } - m_hPollingThread = NULL; - m_pollingConnection = NULL; - debugLog(_T("CSkypeProto::PollingThread: leaving")); - - if (!isTerminated) - { - debugLog(_T("CSkypeProto::PollingThread: unexpected termination; switching protocol to offline")); - SetStatus(ID_STATUS_OFFLINE); - } + } + ParsePollData (root); + } + /*if (response->resultCode != 200) + { + errors++; + continue; + } + else + errors = 0;*/ + } + m_hPollingThread = NULL; + m_pollingConnection = NULL; + debugLog(_T("CSkypeProto::PollingThread: leaving")); + + if (!isTerminated) + { + debugLog(_T("CSkypeProto::PollingThread: unexpected termination; switching protocol to offline")); + SetStatus(ID_STATUS_OFFLINE); + } } \ No newline at end of file -- cgit v1.2.3