refactor: move ActionHandler::commands to CommandModel::commands

This commit is contained in:
Srevin Saju
2021-05-05 19:58:34 +03:00
parent 461128c6a7
commit 584cd59f93
4 changed files with 78 additions and 94 deletions

View File

@@ -57,72 +57,6 @@ void ActionsHandler::setConnection(Connection *connection)
Q_EMIT connectionChanged();
}
QVariantList ActionsHandler::commands()
{
QVariantList commands;
// Messages commands
commands.append(QVariant::fromValue(Command{
QStringLiteral("/me "),
QStringLiteral("<message>"),
i18n("Displays action")}));
commands.append(QVariant::fromValue(Command{
QStringLiteral("/shrug "),
QStringLiteral("<message>"),
i18n("Prepends ¯\\_(ツ)_/¯ to a plain-text message")}));
commands.append(QVariant::fromValue(Command{
QStringLiteral("/lenny "),
QStringLiteral("<message>"),
i18n("Prepends ( ͡° ͜ʖ ͡°) to a plain-text message")}));
commands.append(QVariant::fromValue(Command{
QStringLiteral("/plain "),
QStringLiteral("<message>"),
i18n("Sends a message as plain text, without interpreting it as markdown")}));
commands.append(QVariant::fromValue(Command{
QStringLiteral("/html "),
QStringLiteral("<message>"),
i18n("Sends a message as html, without interpreting it as markdown")}));
commands.append(QVariant::fromValue(Command{
QStringLiteral("/rainbow "),
QStringLiteral("<message>"),
i18n("Sends the given message coloured as a rainbow")}));
commands.append(QVariant::fromValue(Command{
QStringLiteral("/rainbowme "),
QStringLiteral("<message>"),
i18n("Sends the given emote coloured as a rainbow")}));
// Actions commands
commands.append(QVariant::fromValue(Command{
QStringLiteral("/join "), QStringLiteral("<room-address>"),
i18n("Joins room with given address")}));
commands.append(QVariant::fromValue(Command{
QStringLiteral("/part "),
QStringLiteral("[<room-address>]"),
i18n("Leave room")}));
commands.append(QVariant::fromValue(Command{
QStringLiteral("/invite "),
QStringLiteral("<user-id>"),
i18n("Invites user with given id to current room")}));
commands.append(QVariant::fromValue(Command{
QStringLiteral("/react "),
QStringLiteral("<reaction text>"),
i18n("React to this message with a text")}));
// TODO more see elements /help action
return commands;
}
void ActionsHandler::postMessage(const QString &text,
const QString &attachementPath,
const QString &replyEventId,