diff options
| author | 2023-04-21 13:01:59 +0100 | |
|---|---|---|
| committer | 2023-04-21 13:19:40 +0100 | |
| commit | 1745f865be1e7364841722eff6965ec32324a401 (patch) | |
| tree | 0bb6b9d185acbe26961ec005055fd3774cc945b4 /src | |
| parent | Allow also using a prefix chat in autoop and exemptchanops. (diff) | |
Allow using rmode on a prefix char and mode name.
Diffstat (limited to 'src')
| -rw-r--r-- | src/modules/m_rmode.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/modules/m_rmode.cpp b/src/modules/m_rmode.cpp index 4f6361efd..04097346e 100644 --- a/src/modules/m_rmode.cpp +++ b/src/modules/m_rmode.cpp @@ -27,6 +27,20 @@ class CommandRMode final : public Command { +private: + static ModeHandler* FindMode(const std::string& mode) + { + if (mode.length() == 1) + { + ModeHandler* mh = ServerInstance->Modes.FindMode(mode[0], MODETYPE_CHANNEL); + if (!mh) + mh = ServerInstance->Modes.FindPrefix(mode[0]); + return mh; + } + + return ServerInstance->Modes.FindMode(mode, MODETYPE_CHANNEL); + } + public: CommandRMode(Module* Creator) : Command(Creator, "RMODE", 2, 3) @@ -43,9 +57,8 @@ public: return CmdResult::FAILURE; } - unsigned char modeletter = parameters[1][0]; - ModeHandler* mh = ServerInstance->Modes.FindMode(modeletter, MODETYPE_CHANNEL); - if (!mh || parameters[1].size() > 1) + ModeHandler* mh = FindMode(parameters[1]); + if (!mh) { user->WriteNumeric(ERR_UNKNOWNMODE, parameters[0], "is not a recognised channel mode."); return CmdResult::FAILURE; |
