diff options
Diffstat (limited to 'protocols/ICQ-WIM/src/poll.cpp')
-rw-r--r-- | protocols/ICQ-WIM/src/poll.cpp | 17 |
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); |