diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-07-29 08:27:11 +0200 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-07-29 08:27:11 +0200 |
commit | 776c2fd5b3caa60903a3a15db728a00753e02d67 (patch) | |
tree | 5cf7d31bb44b3594b5269194e550f749a796fc69 | |
parent | 176b260bfaf8f575560bfe3fb520ee3fa0ad3a7a (diff) | |
download | libquotient-776c2fd5b3caa60903a3a15db728a00753e02d67.tar.gz libquotient-776c2fd5b3caa60903a3a15db728a00753e02d67.zip |
User: deprecate bridged() and rawName()
Bridge postfixes stopped being a thing long ago; since then, bridged()
has nothing but an empty string, and rawName() coincides with name().
-rw-r--r-- | lib/user.cpp | 33 | ||||
-rw-r--r-- | lib/user.h | 5 |
2 files changed, 8 insertions, 30 deletions
diff --git a/lib/user.cpp b/lib/user.cpp index 67cd1117..4ad74da2 100644 --- a/lib/user.cpp +++ b/lib/user.cpp @@ -54,7 +54,6 @@ public: QString userId; Connection* connection; - QString bridged; QString mostUsedName; QMultiHash<QString, const Room*> otherNames; qreal hueF; @@ -218,11 +217,7 @@ int User::hue() const { return int(hueF() * 359); } QString User::name(const Room* room) const { return d->nameForRoom(room); } -QString User::rawName(const Room* room) const -{ - return d->bridged.isEmpty() ? name(room) - : name(room) % " (" % d->bridged % ')'; -} +QString User::rawName(const Room* room) const { return name(room); } void User::updateName(const QString& newName, const Room* room) { @@ -322,7 +317,7 @@ QString User::fullName(const Room* room) const return name.isEmpty() ? d->userId : name % " (" % d->userId % ')'; } -QString User::bridged() const { return d->bridged; } +QString User::bridged() const { return {}; } const Avatar& User::avatarObject(const Room* room) const { @@ -371,36 +366,16 @@ void User::processEvent(const RoomMemberEvent& event, const Room* room, && event.membership() != MembershipType::Join) return; - auto newName = event.displayName(); - // `bridged` value uses the same notification signal as the name; - // it is assumed that first setting of the bridge occurs together with - // the first setting of the name, and further bridge updates are - // exceptionally rare (the only reasonable case being that the bridge - // changes the naming convention). For the same reason room-specific - // bridge tags are not supported at all. - QRegularExpression reSuffix( - QStringLiteral(" \\((IRC|Gitter|Telegram)\\)$")); - auto match = reSuffix.match(newName); - if (match.hasMatch()) { - if (d->bridged != match.captured(1)) { - if (!d->bridged.isEmpty()) - qCWarning(MAIN) - << "Bridge for user" << id() << "changed:" << d->bridged - << "->" << match.captured(1); - d->bridged = match.captured(1); - } - newName.truncate(match.capturedStart(0)); - } if (event.prevContent()) { // FIXME: the hint doesn't work for bridged users auto oldNameHint = d->nameForRoom(room, event.prevContent()->displayName); - updateName(newName, oldNameHint, room); + updateName(event.displayName(), oldNameHint, room); updateAvatarUrl(event.avatarUrl(), d->avatarUrlForRoom(room, event.prevContent()->avatarUrl), room); } else { - updateName(newName, room); + updateName(event.displayName(), room); updateAvatarUrl(event.avatarUrl(), d->avatarUrlForRoom(room), room); } } @@ -65,6 +65,7 @@ public: * (such as '(IRC)') to the user name. No disambiguation is done. * \sa name, displayName */ + [[deprecated("Bridge postfixes exist no more, use name() instead")]] QString rawName(const Room* room = nullptr) const; /** Get the displayed user name @@ -88,6 +89,8 @@ public: /** * Returns the name of bridge the user is connected from or empty. */ + [[deprecated("Bridged status is no more supported; this always returns" + " an empty string")]] QString bridged() const; /** Whether the user is a guest @@ -119,7 +122,7 @@ public: /// This method is for internal use and should not be called /// from client code - // FIXME: Move it away to private in lib 0.6 + // FIXME: Move it away to private void processEvent(const RoomMemberEvent& event, const Room* r, bool firstMention); |