diff options
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(); |