From 96f4169be97715e6b6b45663492e3791ba21ae09 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 8 Jun 2020 01:45:24 +0200 Subject: Show presence and set custom status messages --- src/timeline/TimelineViewManager.cpp | 12 ++++++++++++ src/timeline/TimelineViewManager.h | 3 +++ 2 files changed, 15 insertions(+) (limited to 'src/timeline') 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, 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); -- cgit 1.4.1