aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/room.cpp10
-rw-r--r--lib/room.h6
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index e1d41fc3..3b00d2d9 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -224,6 +224,11 @@ public:
return evt;
}
+ const QHash<StateEventKey, const StateEventBase*> stateEvents() const
+ {
+ return currentState;
+ }
+
template <typename EventT>
const EventT* getCurrentState(const QString& stateKey = {}) const
{
@@ -1293,6 +1298,11 @@ const StateEventBase* Room::getCurrentState(const QString& evtType,
return d->getCurrentState({ evtType, stateKey });
}
+const QHash<StateEventKey, const StateEventBase*> Room::stateEvents() const
+{
+ return d->stateEvents();
+}
+
RoomEventPtr Room::decryptMessage(const EncryptedEvent& encryptedEvent)
{
#ifndef Quotient_E2EE_ENABLED
diff --git a/lib/room.h b/lib/room.h
index 55dde2ee..452ea306 100644
--- a/lib/room.h
+++ b/lib/room.h
@@ -508,6 +508,12 @@ public:
Q_INVOKABLE const Quotient::StateEventBase*
getCurrentState(const QString& evtType, const QString& stateKey = {}) const;
+ /// Get all state events in the room.
+ /*! This method returns all known state events that have occured in
+ * the room, as a mapping from the event type and state key to value.
+ */
+ Q_INVOKABLE const QHash<StateEventKey, const StateEventBase*> stateEvents() const;
+
/// Get a state event with the given event type and state key
/*! This is a typesafe overload that accepts a C++ event type instead of
* its Matrix name.