aboutsummaryrefslogtreecommitdiff
path: root/lib/room.cpp
diff options
context:
space:
mode:
authorArnav Rawat <rawat.arnav@gmail.com>2021-03-11 16:09:55 -0600
committerArnav Rawat <rawat.arnav@gmail.com>2021-03-11 16:09:55 -0600
commita95d5e83b4d0ab3a9bf2adef1ae4246adc317d04 (patch)
treecf0b9688caab0819d3de225230515508f00df52c /lib/room.cpp
parent337809639b5e9b3e78a4b33eafe0e1e3bb3288fc (diff)
downloadlibquotient-a95d5e83b4d0ab3a9bf2adef1ae4246adc317d04.tar.gz
libquotient-a95d5e83b4d0ab3a9bf2adef1ae4246adc317d04.zip
Support for pinned messages
Fixes issue #188
Diffstat (limited to 'lib/room.cpp')
-rw-r--r--lib/room.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index fadcea17..4f7f7ca9 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -557,6 +557,16 @@ QString Room::canonicalAlias() const
QString Room::displayName() const { return d->displayname; }
+QList<const RoomEvent*> Room::pinnedEvents() const
+{
+ QStringList events = d->getCurrentState<RoomPinnedEvent>()->pinnedEvents();
+ QList<const RoomEvent*> pinnedEvents;
+ QStringList::iterator i;
+ for (i = events.begin(); i != events.end(); ++i)
+ pinnedEvents.append(findInTimeline(*i)->event());
+ return pinnedEvents;
+}
+
void Room::refreshDisplayName() { d->updateDisplayname(); }
QString Room::topic() const
@@ -1830,6 +1840,10 @@ void Room::setCanonicalAlias(const QString& newAlias)
d->requestSetState<RoomCanonicalAliasEvent>(newAlias, altAliases());
}
+void Room::setPinnedMessages(const QStringList& events)
+{
+ d->requestSetState<RoomPinnedEvent>(events);
+}
void Room::setLocalAliases(const QStringList& aliases)
{
d->requestSetState<RoomCanonicalAliasEvent>(canonicalAlias(), aliases);