aboutsummaryrefslogtreecommitdiff
path: root/lib/user.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-07-29 08:27:11 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-07-29 08:27:11 +0200
commit776c2fd5b3caa60903a3a15db728a00753e02d67 (patch)
tree5cf7d31bb44b3594b5269194e550f749a796fc69 /lib/user.cpp
parent176b260bfaf8f575560bfe3fb520ee3fa0ad3a7a (diff)
downloadlibquotient-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().
Diffstat (limited to 'lib/user.cpp')
-rw-r--r--lib/user.cpp33
1 files changed, 4 insertions, 29 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);
}
}