diff options
author | Black Hat <bhat@encom.eu.org> | 2019-09-30 21:38:00 -0700 |
---|---|---|
committer | Black Hat <bhat@encom.eu.org> | 2019-09-30 21:38:00 -0700 |
commit | 3e694fc4c85920d897979f955901cfd93dfba562 (patch) | |
tree | d9b2a84259ec6a41b6ecdc4d02d2c87a52794c1a /lib/room.h | |
parent | 6870ee0d7a0df3427845de07ddae1e2fd5768bbb (diff) | |
parent | f71d16b56ab90e494d6a41c276210a4ce593987e (diff) | |
download | libquotient-3e694fc4c85920d897979f955901cfd93dfba562.tar.gz libquotient-3e694fc4c85920d897979f955901cfd93dfba562.zip |
Merge branch 'master' of https://github.com/quotient-im/libQuotient into bhat-libqtolm-update
Diffstat (limited to 'lib/room.h')
-rw-r--r-- | lib/room.h | 24 |
1 files changed, 21 insertions, 3 deletions
@@ -187,8 +187,8 @@ public: Q_INVOKABLE QList<User*> users() const; QStringList memberNames() const; - [[deprecated("Use joinedCount(), invitedCount(), totalMemberCount()")]] int - memberCount() const; + [[deprecated("Use joinedCount(), invitedCount(), totalMemberCount()")]] + int memberCount() const; int timelineSize() const; bool usesEncryption() const; RoomEventPtr decryptMessage(EncryptedEvent* encryptedEvent); @@ -434,6 +434,24 @@ public: Q_INVOKABLE bool supportsCalls() const; + /// Get a state event with the given event type and state key + /*! This method returns a (potentially empty) state event corresponding + * to the pair of event type \p evtType and state key \p stateKey. + */ + Q_INVOKABLE const StateEventBase* + getCurrentState(const QString& evtType, const QString& stateKey = {}) const; + + template <typename EvT> + const EvT* getCurrentState(const QString& stateKey = {}) const + { + const auto* evt = + eventCast<const EvT>(getCurrentState(EvT::matrixTypeId(), stateKey)); + Q_ASSERT(evt); + Q_ASSERT(evt->matrixTypeId() == EvT::matrixTypeId() + && evt->stateKey() == stateKey); + return evt; + } + template <typename EvT, typename... ArgTs> auto setState(ArgTs&&... args) const { @@ -557,7 +575,7 @@ signals: * Aside from all changes in the room state * @param changes a set of flags describing what changes occurred * upon the last sync - * \sa StateChange + * \sa Changes */ void changed(Changes changes); /** |