diff options
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r-- | protocols/FacebookRM/src/connection.cpp | 15 | ||||
-rw-r--r-- | protocols/FacebookRM/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/requests/channel.h | 5 |
3 files changed, 14 insertions, 8 deletions
diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp index 23fb2f528e..613e25427f 100644 --- a/protocols/FacebookRM/src/connection.cpp +++ b/protocols/FacebookRM/src/connection.cpp @@ -177,11 +177,18 @@ void FacebookProto::ChangeStatus(void*) } } - m_invisible = (new_status == ID_STATUS_INVISIBLE); - - // Remember time of switching to away (and if we are idle already, use the idle time) - m_awayTS = (new_status == ID_STATUS_AWAY ? (m_idleTS > 0 ? m_idleTS : ::time(NULL)) : 0); + bool wasAwayOrInvisible = (old_status == ID_STATUS_AWAY || old_status == ID_STATUS_INVISIBLE); + bool isAwayOrInvisible = (new_status == ID_STATUS_AWAY || new_status == ID_STATUS_INVISIBLE); + if (!wasAwayOrInvisible && isAwayOrInvisible) { + // Switching from "not-away" to "away" state, remember timestamp of this change (and if we are idle already, use the idle time) + m_awayTS = (m_idleTS > 0 ? m_idleTS : ::time(NULL)); + } + else if (wasAwayOrInvisible && !isAwayOrInvisible) { + // Switching from "away" to "not-away" state, reset the timestamp + m_awayTS = 0; + } + m_invisible = (new_status == ID_STATUS_INVISIBLE); facy.chat_state(!m_invisible); m_iStatus = facy.self_.status_id = new_status; diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index 09797e1481..067a302e6f 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -53,7 +53,7 @@ public: inline int IdleSeconds() { - if (m_iStatus == ID_STATUS_AWAY && m_awayTS) + if ((m_iStatus == ID_STATUS_AWAY || m_iStatus == ID_STATUS_INVISIBLE) && m_awayTS) return time(0) - m_awayTS; return m_idleTS ? time(0) - m_idleTS : 0; diff --git a/protocols/FacebookRM/src/requests/channel.h b/protocols/FacebookRM/src/requests/channel.h index 36c9b95ec5..4bce605739 100644 --- a/protocols/FacebookRM/src/requests/channel.h +++ b/protocols/FacebookRM/src/requests/channel.h @@ -3,7 +3,7 @@ Facebook plugin for Miranda Instant Messenger _____________________________________________ -Copyright © 2011-17 Robert Pösel +Copyright � 2011-17 Robert P�sel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -59,8 +59,7 @@ public: */ int idleSeconds = fc->parent->IdleSeconds(); - if (idleSeconds > 0 && !fc->parent->isInvisible()) - Url << INT_VALUE("idle", idleSeconds); + Url << INT_VALUE("idle", idleSeconds); // Browser is sending "idle" always, even if it's "0" if (!isPing) { Url << "qp=y"; // TODO: what's this item? |