diff options
-rw-r--r-- | connection.cpp | 11 | ||||
-rw-r--r-- | connection.h | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/connection.cpp b/connection.cpp index 7914639e..1c65d66f 100644 --- a/connection.cpp +++ b/connection.cpp @@ -534,6 +534,17 @@ QHash<QString, QVector<Room*>> Connection::tagsToRooms() const return result; } +QStringList Connection::tagNames() const +{ + QStringList tags ({"m.favourite"}); + for (auto* r: d->roomMap) + for (const auto& tag: r->tagNames()) + if (tag != "m.lowpriority" && !tags.contains(tag)) + tags.push_back(tag); + tags.push_back("m.lowpriority"); + return tags; +} + QVector<Room*> Connection::roomsWithTag(const QString& tagName) const { QVector<Room*> rooms; diff --git a/connection.h b/connection.h index b45a171d..1e9df5e2 100644 --- a/connection.h +++ b/connection.h @@ -83,6 +83,9 @@ namespace QMatrixClient */ QHash<QString, QVector<Room*>> tagsToRooms() const; + /** Get all room tags known on this connection */ + QStringList tagNames() const; + /** Get the list of rooms with the specified tag */ QVector<Room*> roomsWithTag(const QString& tagName) const; |