From e15645d0e7afc0f45727d0d6611445fc26ef5219 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 1 Mar 2018 20:19:48 +0900 Subject: Connection::tagNames() To be able to get all available tags throughout the connection. --- connection.cpp | 11 +++++++++++ connection.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/connection.cpp b/connection.cpp index 7914639e..1c65d66f 100644 --- a/connection.cpp +++ b/connection.cpp @@ -534,6 +534,17 @@ QHash> 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 Connection::roomsWithTag(const QString& tagName) const { QVector 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> tagsToRooms() const; + /** Get all room tags known on this connection */ + QStringList tagNames() const; + /** Get the list of rooms with the specified tag */ QVector roomsWithTag(const QString& tagName) const; -- cgit v1.2.3