diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-02-16 06:43:40 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-02-16 06:43:40 +0000 |
commit | a93165ff101c6cdfab9ef9b8b85a0436ebc0d7de (patch) | |
tree | 74fce1bb9f90a811f44c2756d932c447989a3b7e /protocols/VKontakte/src/vk_thread.cpp | |
parent | 133b4b92d9acb1f4c63205cfe33665f3d1717d44 (diff) |
VKontakte:
‘force online’ change to ‘force invisible’
add ‘Invisible interval timeout’ options
fix for re-set status message when change status invisible <=> offline
version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@12139 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_thread.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 034cecd7e3..a0aadbfbdd 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -114,8 +114,10 @@ void CVkProto::SetServerStatus(int iNewStatus) ptrT ptszListeningToMsg(db_get_tsa(NULL, m_szModuleName, "ListeningTo"));
if (iNewStatus == ID_STATUS_OFFLINE) {
- if (!IsEmpty(ptszListeningToMsg) && m_bSetBroadcast)
+ if (!IsEmpty(ptszListeningToMsg) && m_bSetBroadcast) {
RetrieveStatusMsg(oldStatusMsg);
+ m_bSetBroadcast = false;
+ }
m_iStatus = ID_STATUS_OFFLINE;
if (iOldStatus != ID_STATUS_OFFLINE && iOldStatus != ID_STATUS_INVISIBLE)
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/account.setOffline.json", true, &CVkProto::OnReceiveSmth)
@@ -127,8 +129,10 @@ void CVkProto::SetServerStatus(int iNewStatus) << VER_API);
}
else {
- if (!IsEmpty(ptszListeningToMsg) && m_bSetBroadcast)
+ if (!IsEmpty(ptszListeningToMsg) && m_bSetBroadcast) {
RetrieveStatusMsg(oldStatusMsg);
+ m_bSetBroadcast = false;
+ }
m_iStatus = ID_STATUS_INVISIBLE;
if (iOldStatus == ID_STATUS_ONLINE)
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/account.setOffline.json", true, &CVkProto::OnReceiveSmth)
@@ -467,9 +471,14 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe LONG userID = getDword(hContact, "ID", -1);
if (userID == m_myUserId || userID == VK_FEED_USER)
continue;
- if (getWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+
+ int iContactStatus = getWord(hContact, "Status", ID_STATUS_OFFLINE);
+
+ if ((iContactStatus == ID_STATUS_ONLINE)
+ || (iContactStatus == ID_STATUS_INVISIBLE && time(NULL) - getDword(hContact, "InvisibleTS", 0) >= m_iInvisibleInterval * 60)) {
setWord(hContact, "Status", ID_STATUS_OFFLINE);
- SetMirVer(hContact, -1);
+ SetMirVer(hContact, -1);
+ }
db_unset(hContact, m_szModuleName, "ListeningTo");
}
arContacts.destroy();
@@ -695,7 +704,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (isOut)
recv.flags |= PREF_SENT;
else if (m_bUserForceOnlineOnActivity)
- setWord(hContact, "Status", ID_STATUS_ONLINE);
+ SetInvisible(hContact);
recv.timestamp = m_bUseLocalTime ? time(NULL) : datetime;
recv.tszMessage = ptszBody;
@@ -843,7 +852,7 @@ void CVkProto::PollUpdates(JSONNODE *pUpdates) SetSrmmReadStatus(hContact);
}
if (m_bUserForceOnlineOnActivity)
- setWord(hContact, "Status", ID_STATUS_ONLINE);
+ SetInvisible(hContact);
}
break;
@@ -868,7 +877,7 @@ void CVkProto::PollUpdates(JSONNODE *pUpdates) setDword(hContact, "LastMsgReadTime", time(NULL));
SetSrmmReadStatus(hContact);
if (m_bUserForceOnlineOnActivity)
- setWord(hContact, "Status", ID_STATUS_ONLINE);
+ SetInvisible(hContact);
}
break;
@@ -892,7 +901,7 @@ void CVkProto::PollUpdates(JSONNODE *pUpdates) if (hContact != NULL) {
ForkThread(&CVkProto::ContactTypingThread, (void *)hContact);
if (m_bUserForceOnlineOnActivity)
- setWord(hContact, "Status", ID_STATUS_ONLINE);
+ SetInvisible(hContact);
}
break;
|