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/Roster/ContactRosterItem.cpp | |
parent | ffbd6feb875a9d50ec834fd6dfe967528697a9ff (diff) | |
download | swift-836925a5cdc7017da7fb84416c803e652b48e399.zip swift-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/Roster/ContactRosterItem.cpp')
-rw-r--r-- | Swift/Controllers/Roster/ContactRosterItem.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Swift/Controllers/Roster/ContactRosterItem.cpp b/Swift/Controllers/Roster/ContactRosterItem.cpp index 5b1b6e0..d2edfe7 100644 --- a/Swift/Controllers/Roster/ContactRosterItem.cpp +++ b/Swift/Controllers/Roster/ContactRosterItem.cpp @@ -8,6 +8,9 @@ #include "Swift/Controllers/Roster/GroupRosterItem.h" #include <Swiften/Base/foreach.h> +#include <Swiften/Elements/Idle.h> + +#include <boost/date_time/posix_time/posix_time.hpp> namespace Swift { @@ -39,6 +42,15 @@ std::string ContactRosterItem::getStatusText() const { return shownPresence_ ? shownPresence_->getStatus() : ""; } +std::string ContactRosterItem::getIdleText() const { + Idle::ref idle = shownPresence_ ? shownPresence_->getPayload<Idle>() : Idle::ref(); + if (!idle || idle->getSince().is_not_a_date_time()) { + return ""; + } else { + return boost::posix_time::to_simple_string(idle->getSince()); + } +} + void ContactRosterItem::setAvatarPath(const std::string& path) { avatarPath_ = path; onDataChanged(); |