From 6bd7ca89447e90524cbd9c5c18d0f7c5e39101d6 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Tue, 28 Apr 2015 14:55:20 +0000 Subject: SkypeWeb: Small polling refactoring. git-svn-id: http://svn.miranda-ng.org/main/trunk@13228 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_polling.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index 3ebfa13661..caa14eaa0c 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -83,17 +83,27 @@ void CSkypeProto::PollingThread(void*) if (response->pData) { JSONROOT root(response->pData); - JSONNODE *errorCode = json_get(root, "errorCode"); - if (errorCode != NULL) + JSONNODE *eventMsgs = json_get(root, "eventMessages"); + JSONNODE *errorCode = json_get(root, "errorCode"); + + if (eventMsgs != NULL) + ParsePollData(root); + + else if (errorCode != NULL) { errors++; - debugLogA(__FUNCTION__": polling error %s", ptrA(mir_t2a(ptrT(json_as_string(errorCode))))); + debugLogA(__FUNCTION__": polling error %d", json_as_int(errorCode)); + if (json_as_int(errorCode) == 729) + { + SendRequest(new CreateEndpointRequest(TokenSecret), &CSkypeProto::OnEndpointCreated); + CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response); + delete request; + break; + } } - ParsePollData(root); } m_pollingConnection = response->nlc; CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response); - delete request; } -- cgit v1.2.3