From cb4909f7f21641f40e2676a848304e54bc44328c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 23 Oct 2013 22:40:56 +0000 Subject: VK: - massive update for the status setting code; - connection icon doesn't rotate in tray; - connection status isn't restored after wake up from standby/sleep mode; - network errors weren't processed in the main cycle - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@6606 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/vk_queue.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'protocols/VKontakte/src/vk_queue.cpp') diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp index 1b85a54691..782906ce6f 100644 --- a/protocols/VKontakte/src/vk_queue.cpp +++ b/protocols/VKontakte/src/vk_queue.cpp @@ -44,6 +44,12 @@ LBL_Restart: if (pReq->bNeedsRestart) goto LBL_Restart; } + else if (pReq->bIsMainConn) { + if (m_iStatus >= ID_STATUS_CONNECTING && m_iStatus < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) + ConnectionFailed(LOGINERR_NONETWORK); + else + ShutdownSession(); + } delete pReq; } @@ -57,9 +63,10 @@ bool CVkProto::PushAsyncHttpRequest(int iRequestType, LPCSTR szUrl, bool bSecure pReq->flags |= NLHRF_SSL; CMStringA url; - if (*szUrl == '/') { + if (*szUrl == '/') { // relative url leads to a site url = VK_API_URL; url += szUrl; + pReq->bIsMainConn = true; } else url = szUrl; @@ -94,8 +101,11 @@ void CVkProto::WorkerThread(void*) debugLogA("CVkProto::WorkerThread: entering"); m_bTerminated = m_prevError = false; m_szAccessToken = getStringA("AccessToken"); - if (m_szAccessToken != NULL) - OnLoggedIn(); + if (m_szAccessToken != NULL) { + // try to receive a response from server + HttpParam param = { "access_token", m_szAccessToken }; + PushAsyncHttpRequest(REQUEST_GET, "/method/getUserInfoEx.json", true, &CVkProto::OnReceiveMyInfo, 1, ¶m); + } else { // Initialize new OAuth session HttpParam params[] = { { "client_id", VK_APP_ID }, -- cgit v1.2.3