summaryrefslogtreecommitdiff
path: root/protocols/VKontakte
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-10-13 10:24:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-10-13 10:24:42 +0000
commit22a4d712bff13ce22553f986aba0185d14c0a4a3 (patch)
treef45433a0191eb8df0dffc5012cdc373ef7ad117b /protocols/VKontakte
parent6c0e8d4f20c3a0dc97176072602ce2d719916a6f (diff)
fix against going idle
git-svn-id: http://svn.miranda-ng.org/main/trunk@6484 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index b2f8326b9a..ebc02964c3 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -175,7 +175,7 @@ void CVkProto::OnSendMessage(NETLIBHTTPREQUEST *reply, void*)
int CVkProto::SetStatus(int iNewStatus)
{
- if (m_iDesiredStatus == iNewStatus)
+ if (m_iDesiredStatus == iNewStatus || iNewStatus == ID_STATUS_IDLE)
return 0;
int oldStatus = m_iStatus;
@@ -188,16 +188,18 @@ int CVkProto::SetStatus(int iNewStatus)
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
}
- else if ( !(m_iStatus >= ID_STATUS_CONNECTING && m_iStatus < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)) {
+ else if (m_hWorkerThread == NULL && !(m_iStatus >= ID_STATUS_CONNECTING && m_iStatus < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)) {
m_iStatus = ID_STATUS_CONNECTING;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
- if (m_hWorkerThread == NULL)
- m_hWorkerThread = ForkThreadEx(&CVkProto::WorkerThread, 0, NULL);
+ m_hWorkerThread = ForkThreadEx(&CVkProto::WorkerThread, 0, NULL);
}
- else if ( IsOnline())
- SetServerStatus(iNewStatus);
- else
+ else {
+ if ( IsOnline())
+ SetServerStatus(iNewStatus);
+ m_iStatus = iNewStatus;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
+ }
+
return 0;
}