aboutsummaryrefslogtreecommitdiff
path: root/lib/room.cpp
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-07-30 19:57:41 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-09-04 18:42:11 +0200
commitfc6321d53f7743f7629841d02c6e28e1a3ab3f83 (patch)
treee3cff2e7fc9228abf1b4df6100eaac17f3f2c543 /lib/room.cpp
parent80499cc7619bb857c284e6e89db728ccee9c61f6 (diff)
downloadlibquotient-fc6321d53f7743f7629841d02c6e28e1a3ab3f83.tar.gz
libquotient-fc6321d53f7743f7629841d02c6e28e1a3ab3f83.zip
RoomStateView::content()
This gives a more conventional API compared to queryOr() that can be used for event objects that have content() defined - with the downside being that content() unpacks the entire object instead of retrieving one particular piece (but for state events and single key-value content it's not a problem, and those make for the vast majority of events).
Diffstat (limited to 'lib/room.cpp')
-rw-r--r--lib/room.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index 042d38ac..a6617cc3 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -597,7 +597,7 @@ bool Room::allHistoryLoaded() const
QString Room::name() const
{
- return currentState().queryOr(&RoomNameEvent::name, QString());
+ return currentState().content<RoomNameEvent>().value;
}
QStringList Room::aliases() const
@@ -613,8 +613,7 @@ QStringList Room::aliases() const
QStringList Room::altAliases() const
{
- return currentState().queryOr(&RoomCanonicalAliasEvent::altAliases,
- QStringList());
+ return currentState().content<RoomCanonicalAliasEvent>().altAliases;
}
QString Room::canonicalAlias() const