diff options
Diffstat (limited to 'src/crsm.cpp')
| -rw-r--r-- | src/crsm.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/crsm.cpp b/src/crsm.cpp index 021a63b..e99fabb 100644 --- a/src/crsm.cpp +++ b/src/crsm.cpp @@ -1244,7 +1244,7 @@ CmdFunctionRef* CRSM::findCommand(QStringList&& cmd, ClientInterface interface, } } -bool CRSM::cmd(QString cmd, const ClientInfo &client) +bool CRSM::cmd(const QString& cmd, const ClientInfo &client) { CmdFunctionRef* cmdPtr; QString realCmd = cmd; @@ -1252,6 +1252,7 @@ bool CRSM::cmd(QString cmd, const ClientInfo &client) { CmdFunctionRef cmdRef = *cmdPtr; QString args = cmd.mid(realCmd.length()).trimmed(); + removeCommandSuffixes(args); switch(client.interface) { case Clonk: @@ -1827,6 +1828,26 @@ bool CRSM::isChannelName(const QString &name) } } +void CRSM::removeCommandSuffixes(QString& command) +{ + foreach(const QString& suffix, Config.CRSM.CommandSuffixes) + { + if(command.length() > suffix.length() && command.right(suffix.length()) == suffix) + { + command.chop(suffix.length()); + break; + } + } +} + +void CRSM::substituteCommandAlias(QString &command) +{ + while(Config.CRSM.CommandAlias.contains(command)) + { + command = Config.CRSM.CommandAlias.value(command); + } +} + CMD_FUNCTION_IMPL(help) bool longHelp = (args == "long"); if(args.isEmpty() || longHelp) |
