diff options
author | Tobias Markmann <tm@ayena.de> | 2013-02-25 23:20:59 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2013-03-04 15:18:47 (GMT) |
commit | 836925a5cdc7017da7fb84416c803e652b48e399 (patch) | |
tree | 2f659c2bc3e6db70cbc09e0cb13953c1a8ccd8e4 /Swift/Controllers/StatusTracker.cpp | |
parent | ffbd6feb875a9d50ec834fd6dfe967528697a9ff (diff) | |
download | swift-contrib-836925a5cdc7017da7fb84416c803e652b48e399.zip swift-contrib-836925a5cdc7017da7fb84416c803e652b48e399.tar.bz2 |
Adding support for idle time.
Change-Id: I1b14edb97a0c87431ec377b084362e9761caded9
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swift/Controllers/StatusTracker.cpp')
-rw-r--r-- | Swift/Controllers/StatusTracker.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Swift/Controllers/StatusTracker.cpp b/Swift/Controllers/StatusTracker.cpp index 0c88f4d..6766c2e 100644 --- a/Swift/Controllers/StatusTracker.cpp +++ b/Swift/Controllers/StatusTracker.cpp @@ -8,6 +8,8 @@ #include <boost/smart_ptr/make_shared.hpp> +#include <Swiften/Elements/Idle.h> + namespace Swift { StatusTracker::StatusTracker() { @@ -21,6 +23,7 @@ boost::shared_ptr<Presence> StatusTracker::getNextPresence() { presence = boost::make_shared<Presence>(); presence->setShow(StatusShow::Away); presence->setStatus(queuedPresence_->getStatus()); + presence->addPayload(boost::make_shared<Idle>(isAutoAwaySince_)); } else { presence = queuedPresence_; } @@ -35,11 +38,12 @@ void StatusTracker::setRequestedPresence(boost::shared_ptr<Presence> presence) { // } } -bool StatusTracker::goAutoAway() { +bool StatusTracker::goAutoAway(const int& seconds) { if (queuedPresence_->getShow() != StatusShow::Online) { return false; } isAutoAway_ = true; + isAutoAwaySince_ = boost::posix_time::second_clock::universal_time() - boost::posix_time::seconds(seconds); return true; } |