diff options
author | George Hazan <george.hazan@gmail.com> | 2015-01-26 23:21:25 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-01-26 23:21:25 +0000 |
commit | 88d6662a12f18844e5487c3d35155d3fbbff85a5 (patch) | |
tree | 2090b9d565feb3c0004c3373313cf1ebb7c33c3a /protocols/WhatsApp/src/connection.cpp | |
parent | e64e17858c88e0b8302a34cebc02be0019422947 (diff) |
fix for going offline in WhatsApp
git-svn-id: http://svn.miranda-ng.org/main/trunk@11921 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/connection.cpp')
-rw-r--r-- | protocols/WhatsApp/src/connection.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/protocols/WhatsApp/src/connection.cpp b/protocols/WhatsApp/src/connection.cpp index c4ed44c7dd..1f6b6647ec 100644 --- a/protocols/WhatsApp/src/connection.cpp +++ b/protocols/WhatsApp/src/connection.cpp @@ -46,7 +46,6 @@ void WhatsAppProto::stayConnectedLoop(void*) // -----------------------------
Mutex writerMutex;
- int desiredStatus;
bool error = false;
this->conn = NULL;
@@ -61,13 +60,12 @@ void WhatsAppProto::stayConnectedLoop(void*) this->conn = NULL;
}
- desiredStatus = this->m_iDesiredStatus;
- if (desiredStatus == ID_STATUS_OFFLINE || error) {
+ if (m_iDesiredStatus == ID_STATUS_OFFLINE || error) {
debugLogA("Set status to offline");
SetAllContactStatuses(ID_STATUS_OFFLINE, true);
this->ToggleStatusMenuItems(false);
- int prevStatus = this->m_iStatus;
- this->m_iStatus = ID_STATUS_OFFLINE;
+ int prevStatus = m_iStatus;
+ m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)m_iStatus, prevStatus);
break;
}
@@ -95,11 +93,11 @@ void WhatsAppProto::stayConnectedLoop(void*) }
m_pConnection->nick = this->nick;
m_pConnection->setVerboseId(true);
- if (desiredStatus != ID_STATUS_INVISIBLE)
+ if (m_iDesiredStatus != ID_STATUS_INVISIBLE)
m_pConnection->sendAvailableForChat();
debugLogA("Set status to online");
- this->m_iStatus = desiredStatus;
+ m_iStatus = m_iDesiredStatus;
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)m_iStatus, ID_STATUS_CONNECTING);
this->ToggleStatusMenuItems(true);
@@ -134,7 +132,7 @@ void WhatsAppProto::sentinelLoop(void*) int delay = MAX_SILENT_INTERVAL;
int quietInterval;
while (WaitForSingleObjectEx(update_loop_lock_, delay * 1000, true) == WAIT_TIMEOUT) {
- if (this->m_iStatus != ID_STATUS_OFFLINE && m_pConnection != NULL && this->m_iDesiredStatus == this->m_iStatus) {
+ if (m_iStatus != ID_STATUS_OFFLINE && m_pConnection != NULL && m_iDesiredStatus == m_iStatus) {
// #TODO Quiet after pong or tree read?
quietInterval = difftime(time(NULL), this->lastPongTime);
if (quietInterval >= MAX_SILENT_INTERVAL) {
|