summaryrefslogtreecommitdiff
path: root/protocols/ICQ-WIM/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-04-13 13:28:43 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-04-13 13:28:43 +0300
commitacf4f719a5de949f4a3d739c2b4d0bdb69bd2d9f (patch)
tree66aa9ca1b1b3970afb6724acb4715061411e10fb /protocols/ICQ-WIM/src
parent833592d193af4a524399bd46a24711b8f5e23ae8 (diff)
ICQ-WIM: sometimes ICQ cannot login after Windows return from the sleeping mode
Diffstat (limited to 'protocols/ICQ-WIM/src')
-rw-r--r--protocols/ICQ-WIM/src/proto.h1
-rw-r--r--protocols/ICQ-WIM/src/server.cpp14
2 files changed, 14 insertions, 1 deletions
diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h
index 3caad36b20..df37084f9b 100644
--- a/protocols/ICQ-WIM/src/proto.h
+++ b/protocols/ICQ-WIM/src/proto.h
@@ -287,6 +287,7 @@ class CIcqProto : public PROTO<CIcqProto>
void OnReceiveAvatar(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq);
void OnSearchResults(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq);
void OnSendMessage(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq);
+ void OnSessionEnd(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq);
void OnStartSession(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq);
void OnValidateSms(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq);
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp
index 70f0bfe786..a89af9c2f0 100644
--- a/protocols/ICQ-WIM/src/server.cpp
+++ b/protocols/ICQ-WIM/src/server.cpp
@@ -559,7 +559,7 @@ void CIcqProto::SetServerStatus(int iStatus)
<< AIMSID(this) << CHAR_PARAM("view", szStatus) << INT_PARAM("invisible", invisible));
if (iStatus == ID_STATUS_OFFLINE)
- Push(new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, ICQ_API_SERVER "/aim/endSession") << AIMSID(this));
+ Push(new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, ICQ_API_SERVER "/aim/endSession", &CIcqProto::OnSessionEnd) << AIMSID(this));
int iOldStatus = m_iStatus; m_iStatus = iStatus;
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)iOldStatus, m_iStatus);
@@ -1062,3 +1062,15 @@ void CIcqProto::OnSendMessage(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq)
CheckOwnMessage(reqId, msgId, false);
CheckLastId(ownMsg->m_hContact, data);
}
+
+void CIcqProto::OnSessionEnd(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *)
+{
+ JsonReply root(pReply);
+ if (root.error() == 200) {
+ m_szAToken.Empty();
+ delSetting(DB_KEY_ATOKEN);
+
+ m_szSessionKey.Empty();
+ delSetting(DB_KEY_SESSIONKEY);
+ }
+}