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
This commit is contained in:
James Graham
2022-11-15 19:03:45 +00:00
parent 5f93dca878
commit cc7081cd19

View File

@@ -281,6 +281,36 @@ QVector<ActionsModel::Action> actions{
kli18n("[<room alias or id>]"),
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("<display name>"),
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("<display name>"),
kli18n("Changes your display name in this room"),
},
Action{
QStringLiteral("ignore"),
[](const QString &text, NeoChatRoom *room) {