summaryrefslogtreecommitdiff
path: root/protocols/ICQ-WIM/src/poll.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-02-04 21:33:18 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-02-04 21:33:26 +0300
commit338a21fdbdab5863b17dd64aa087110cc33049d6 (patch)
treec8736d80fbf0531b20445ab114bc5ffc27a49426 /protocols/ICQ-WIM/src/poll.cpp
parent3f6d3a6f5c6075e6c4f85ccbfe17b128c81a9aad (diff)
fixes #1718 (ICQ10: major crutch to compensate behavior of the official ICQ client)
Diffstat (limited to 'protocols/ICQ-WIM/src/poll.cpp')
-rw-r--r--protocols/ICQ-WIM/src/poll.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/protocols/ICQ-WIM/src/poll.cpp b/protocols/ICQ-WIM/src/poll.cpp
index 3d987b334b..e6553c1f51 100644
--- a/protocols/ICQ-WIM/src/poll.cpp
+++ b/protocols/ICQ-WIM/src/poll.cpp
@@ -192,7 +192,22 @@ void CIcqProto::ProcessPresence(const JSONNode &ev)
IcqCacheItem *pCache = FindContactByUIN(dwUin);
if (pCache) {
- setDword(pCache->m_hContact, "Status", StatusFromString(ev["state"].as_mstring()));
+ int iNewStatus = StatusFromString(ev["state"].as_mstring());
+
+ // major crutch dedicated to the official client behaviour to go offline
+ // when its window gets closed. we don't really change the status of a contact
+ // but initialize a timer instead
+ if (iNewStatus == ID_STATUS_OFFLINE) {
+ if (m_iTimeDiff1)
+ pCache->m_timer1 = time(0);
+ else
+ setDword(pCache->m_hContact, "Status", iNewStatus);
+ }
+ // if a client returns back online, we clear timers not to play with statuses anymore
+ else {
+ pCache->m_timer1 = pCache->m_timer2 = 0;
+ setDword(pCache->m_hContact, "Status", iNewStatus);
+ }
Json2string(pCache->m_hContact, ev, "friendly", "Nick");
CheckAvatarChange(pCache->m_hContact, ev);