aboutsummaryrefslogtreecommitdiff
path: root/room.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'room.cpp')
-rw-r--r--room.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/room.cpp b/room.cpp
index 29244da2..db36a713 100644
--- a/room.cpp
+++ b/room.cpp
@@ -564,6 +564,21 @@ const QHash<QString, TagRecord>& Room::tags() const
return d->tags;
}
+TagRecord Room::tag(const QString& name) const
+{
+ return d->tags.value(name);
+}
+
+bool Room::isFavourite() const
+{
+ return d->tags.contains(FavouriteTag);
+}
+
+bool Room::isLowPriority() const
+{
+ return d->tags.contains(LowPriorityTag);
+}
+
const RoomMessageEvent*
Room::Private::getEventWithFile(const QString& eventId) const
{
@@ -1635,6 +1650,20 @@ QJsonObject Room::Private::toJson() const
result.insert("ephemeral", ephemeralObj);
}
+ {
+ QJsonObject accountDataObj;
+ if (!tags.empty())
+ {
+ QJsonObject tagsObj;
+ for (auto it = tags.begin(); it != tags.end(); ++it)
+ tagsObj.insert(it.key(), { {"order", it->order} });
+ if (!tagsObj.empty())
+ accountDataObj.insert("m.tag", tagsObj);
+ }
+ if (!accountDataObj.empty())
+ result.insert("account_data", accountDataObj);
+ }
+
QJsonObject unreadNotificationsObj;
if (highlightCount > 0)
unreadNotificationsObj.insert("highlight_count", highlightCount);