From cc7081cd19d25477eb7bd525b453244e8de64a87 Mon Sep 17 00:00:00 2001 From: James Graham Date: Tue, 15 Nov 2022 19:03:45 +0000 Subject: [PATCH] Add nick and roomnick commands to change global and room display names /nick - changes the global display name /roomnick - changes the display name fort the room you are in BUG: 455043 --- src/actionsmodel.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/actionsmodel.cpp b/src/actionsmodel.cpp index 3070a2454..22425145e 100644 --- a/src/actionsmodel.cpp +++ b/src/actionsmodel.cpp @@ -281,6 +281,36 @@ QVector actions{ kli18n("[]"), kli18n("Leaves the given room or this room, if there is none given"), }, + Action{ + QStringLiteral("nick"), + [](const QString &text, NeoChatRoom *room) { + if (text.isEmpty()) { + Q_EMIT room->showMessage(NeoChatRoom::Error, i18n("No new nickname provided, no changes will happen.")); + } else { + room->connection()->user()->rename(text); + } + return QString(); + }, + false, + std::nullopt, + kli18n(""), + kli18n("Changes your global display name"), + }, + Action{ + QStringLiteral("roomnick"), + [](const QString &text, NeoChatRoom *room) { + if (text.isEmpty()) { + Q_EMIT room->showMessage(NeoChatRoom::Error, i18n("No new nickname provided, no changes will happen.")); + } else { + room->connection()->user()->rename(text, room); + } + return QString(); + }, + false, + std::nullopt, + kli18n(""), + kli18n("Changes your display name in this room"), + }, Action{ QStringLiteral("ignore"), [](const QString &text, NeoChatRoom *room) {