diff options
author | George Hazan <george.hazan@gmail.com> | 2013-10-23 22:40:56 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-10-23 22:40:56 +0000 |
commit | cb4909f7f21641f40e2676a848304e54bc44328c (patch) | |
tree | 75142255eb38814ad0809fe7c777e3ae128672fe /protocols/VKontakte/src/vk_queue.cpp | |
parent | 02c5b3e97608972a9aa6638bb73b31a4c6bddcfd (diff) |
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
Diffstat (limited to 'protocols/VKontakte/src/vk_queue.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_queue.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
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 },
|