summary refs log tree commit diff
path: root/src/timeline
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-06-08 01:45:24 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-06-08 01:59:05 +0200
commit96f4169be97715e6b6b45663492e3791ba21ae09 (patch)
tree618753677e69ac590aa2cad267dfd7d31c574bfd /src/timeline
parentSmooth scaling for images (diff)
downloadnheko-96f4169be97715e6b6b45663492e3791ba21ae09.tar.xz
Show presence and set custom status messages
Diffstat (limited to 'src/timeline')
-rw-r--r--src/timeline/TimelineViewManager.cpp12
-rw-r--r--src/timeline/TimelineViewManager.h3
2 files changed, 15 insertions, 0 deletions
diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp
index 30abe506..ff457af9 100644
--- a/src/timeline/TimelineViewManager.cpp
+++ b/src/timeline/TimelineViewManager.cpp
@@ -57,6 +57,18 @@ TimelineViewManager::userColor(QString id, QColor background)
         return userColors.value(id);
 }
 
+QString
+TimelineViewManager::userPresence(QString id) const
+{
+        return QString::fromStdString(
+          mtx::presence::to_string(cache::presenceState(id.toStdString())));
+}
+QString
+TimelineViewManager::userStatus(QString id) const
+{
+        return QString::fromStdString(cache::statusMessage(id.toStdString()));
+}
+
 TimelineViewManager::TimelineViewManager(QSharedPointer<UserSettings> userSettings, QWidget *parent)
   : imgProvider(new MxcImageProvider())
   , colorImgProvider(new ColorImageProvider())
diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h
index 45a603af..e677ef20 100644
--- a/src/timeline/TimelineViewManager.h
+++ b/src/timeline/TimelineViewManager.h
@@ -41,6 +41,9 @@ public:
         Q_INVOKABLE void openImageOverlay(QString mxcUrl, QString eventId) const;
         Q_INVOKABLE QColor userColor(QString id, QColor background);
 
+        Q_INVOKABLE QString userPresence(QString id) const;
+        Q_INVOKABLE QString userStatus(QString id) const;
+
 signals:
         void clearRoomMessageCount(QString roomid);
         void updateRoomsLastMessage(QString roomid, const DescInfo &info);