aboutsummaryrefslogtreecommitdiff
path: root/lib/room.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/room.cpp')
-rw-r--r--lib/room.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index b3438e08..edf5dcd9 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -558,6 +558,23 @@ QString Room::canonicalAlias() const
QString Room::displayName() const { return d->displayname; }
+QStringList Room::pinnedEventIds() const {
+ return d->getCurrentState<RoomPinnedEvent>()->pinnedEvents();
+}
+
+QVector< const Quotient::RoomEvent* > Quotient::Room::pinnedEvents() const
+{
+ QStringList events = d->getCurrentState<RoomPinnedEvent>()->pinnedEvents();
+ QVector<const RoomEvent*> pinnedEvents;
+ QStringList::iterator i;
+ for (i = events.begin(); i != events.end(); ++i) {
+ auto timelineItem = findInTimeline(*i);
+ if (timelineItem != historyEdge())
+ pinnedEvents.append(timelineItem->event());
+ }
+ return pinnedEvents;
+}
+
QString Room::displayNameForHtml() const
{
return displayName().toHtmlEscaped();
@@ -2133,6 +2150,10 @@ void Room::setCanonicalAlias(const QString& newAlias)
d->requestSetState<RoomCanonicalAliasEvent>(newAlias, altAliases());
}
+void Room::setPinnedEvents(const QStringList& events)
+{
+ d->requestSetState<RoomPinnedEvent>(events);
+}
void Room::setLocalAliases(const QStringList& aliases)
{
d->requestSetState<RoomCanonicalAliasEvent>(canonicalAlias(), aliases);
@@ -2902,6 +2923,10 @@ Room::Changes Room::processStateEvent(const RoomEvent& e)
return Change::Aliases;
// clang-format off
}
+ , [this] (const RoomPinnedEvent&) {
+ emit pinnedEventsChanged();
+ return Change::Other;
+ }
, [] (const RoomTopicEvent&) {
return Change::Topic;
}