summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2013-02-25 23:20:59 (GMT)
committerSwift Review <review@swift.im>2013-03-04 15:18:47 (GMT)
commit836925a5cdc7017da7fb84416c803e652b48e399 (patch)
tree2f659c2bc3e6db70cbc09e0cb13953c1a8ccd8e4 /Swift/Controllers/Roster
parentffbd6feb875a9d50ec834fd6dfe967528697a9ff (diff)
downloadswift-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')
-rw-r--r--Swift/Controllers/Roster/ContactRosterItem.cpp12
-rw-r--r--Swift/Controllers/Roster/ContactRosterItem.h4
2 files changed, 16 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();
diff --git a/Swift/Controllers/Roster/ContactRosterItem.h b/Swift/Controllers/Roster/ContactRosterItem.h
index 8389a44..7a2100e 100644
--- a/Swift/Controllers/Roster/ContactRosterItem.h
+++ b/Swift/Controllers/Roster/ContactRosterItem.h
@@ -17,6 +17,7 @@
#include <boost/bind.hpp>
#include "Swiften/Base/boost_bsignals.h"
#include <boost/shared_ptr.hpp>
+#include <boost/date_time/posix_time/ptime.hpp>
namespace Swift {
@@ -35,6 +36,7 @@ class ContactRosterItem : public RosterItem {
StatusShow::Type getStatusShow() const;
StatusShow::Type getSimplifiedStatusShow() const;
std::string getStatusText() const;
+ std::string getIdleText() const;
void setAvatarPath(const std::string& path);
const std::string& getAvatarPath() const;
const JID& getJID() const;
@@ -50,9 +52,11 @@ class ContactRosterItem : public RosterItem {
void setSupportedFeatures(const std::set<Feature>& features);
bool supportsFeature(Feature feature) const;
+
private:
JID jid_;
JID displayJID_;
+ boost::posix_time::ptime lastAvailableTime_;
std::string avatarPath_;
std::map<std::string, boost::shared_ptr<Presence> > presences_;
boost::shared_ptr<Presence> offlinePresence_;