diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-09-30 14:06:12 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-09-30 14:06:12 +0900 |
commit | f5651c74ddddd8c66b3b42b471fbe2ff278c0d9a (patch) | |
tree | a605cc20873ca915b97d5916d285aaffcedc431c | |
parent | 2c7f3f2a15afcdd7d5200757daa6629239593e02 (diff) | |
download | libquotient-f5651c74ddddd8c66b3b42b471fbe2ff278c0d9a.tar.gz libquotient-f5651c74ddddd8c66b3b42b471fbe2ff278c0d9a.zip |
Room: Unify tags both when getting and setting
-rw-r--r-- | lib/room.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/room.cpp b/lib/room.cpp index f41fe12c..ee2e2b8e 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -752,6 +752,18 @@ void Room::setTags(TagsMap newTags) void Room::Private::setTags(TagsMap newTags) { emit q->tagsAboutToChange(); + const auto keys = newTags.keys(); + for (const auto& k: keys) + { + const auto& checkRes = validatedTag(k); + if (checkRes.first) + { + if (newTags.contains(checkRes.second)) + newTags.remove(k); + else + newTags.insert(checkRes.second, newTags.take(k)); + } + } tags = move(newTags); qCDebug(MAIN) << "Room" << q->objectName() << "is tagged with" << q->tagNames().join(", "); |