diff options
Diffstat (limited to 'room.cpp')
-rw-r--r-- | room.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -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); |