Skip to content

Commit

Permalink
Merge pull request #719 from quotient-im/tobias/list-account-data
Browse files Browse the repository at this point in the history
Add property for querying a connection's accountdata
  • Loading branch information
TobiasFella authored Feb 21, 2024
2 parents fd79b60 + e67e004 commit f017b02
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Quotient/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1910,3 +1910,13 @@ Connection* Connection::makeMockConnection(const QString& mxId,
c->d->completeSetup(mxId, true);
return c;
}

QStringList Connection::accountDataEventTypes() const
{
QStringList events;
events.reserve(d->accountData.size());
for (const auto& [key, value] : std::as_const(d->accountData)) {
events += key;
}
return events;
}
4 changes: 4 additions & 0 deletions Quotient/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class QUOTIENT_API Connection : public QObject {
Q_PROPERTY(bool lazyLoading READ lazyLoading WRITE setLazyLoading NOTIFY lazyLoadingChanged)
Q_PROPERTY(bool canChangePassword READ canChangePassword NOTIFY capabilitiesLoaded)
Q_PROPERTY(bool encryptionEnabled READ encryptionEnabled WRITE enableEncryption NOTIFY encryptionChanged)
Q_PROPERTY(QStringList accountDataEventTypes READ accountDataEventTypes NOTIFY accountDataChanged)

public:
using UsersToDevicesToContent = QHash<QString, QHash<QString, QJsonObject>>;
Expand Down Expand Up @@ -205,6 +206,9 @@ class QUOTIENT_API Connection : public QObject {
Q_INVOKABLE void setAccountData(const QString& type,
const QJsonObject& content);

//! Lists the types of account data that exist for this connection;
QStringList accountDataEventTypes() const;

//! \brief Get all Invited and Joined rooms grouped by tag
//! \return a hashmap from tag name to a vector of room pointers,
//! sorted by their order in the tag - details are at
Expand Down

0 comments on commit f017b02

Please sign in to comment.