From 0c96ae749c749a5a36e9f28a91bb69f7702d94c5 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 12 Apr 2020 12:15:08 +0200 Subject: Room::safeMemberName() Pulled from Quaternion code. --- lib/room.cpp | 5 +++++ lib/room.h | 7 +++++++ 2 files changed, 12 insertions(+) (limited to 'lib') diff --git a/lib/room.cpp b/lib/room.cpp index dc65ebfc..ffe78a3a 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -1449,6 +1449,11 @@ QString Room::roomMembername(const QString& userId) const return roomMembername(user(userId)); } +QString Room::safeMemberName(const QString& userId) const +{ + return sanitized(roomMembername(userId)); +} + void Room::updateData(SyncRoomData&& data, bool fromCache) { if (d->prevBatch.isEmpty()) diff --git a/lib/room.h b/lib/room.h index 66a8df7a..1ddff517 100644 --- a/lib/room.h +++ b/lib/room.h @@ -269,6 +269,13 @@ public: */ Q_INVOKABLE QString roomMembername(const QString& userId) const; + /** Get a display-safe member name in the context of this room + * + * Display-safe means HTML-safe + without RLO/LRO markers + * (see https://github.com/quotient-im/Quaternion/issues/545). + */ + Q_INVOKABLE QString safeMemberName(const QString& userId) const; + const Timeline& messageEvents() const; const PendingEvents& pendingEvents() const; -- cgit v1.2.3