X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_mlock.cpp;h=85787ae9644b2e6c2c21983141c9a8fb3ceea46c;hb=de4e4860091fe5a9a530acdb25f9a17e22323acf;hp=22faa2119b22eed6f5f1e176449e63dd90a5d331;hpb=e244cb2c63b1ac1d85bdbb4691f7b1bd940ae804;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_mlock.cpp b/src/modules/m_mlock.cpp index 22faa2119..85787ae96 100644 --- a/src/modules/m_mlock.cpp +++ b/src/modules/m_mlock.cpp @@ -19,19 +19,28 @@ #include "inspircd.h" +enum +{ + // From Charybdis. + ERR_MLOCKRESTRICTED = 742 +}; + class ModuleMLock : public Module { StringExtItem mlock; -public: - ModuleMLock() : mlock("mlock", this) {}; + public: + ModuleMLock() + : mlock("mlock", ExtensionItem::EXT_CHANNEL, this) + { + } Version GetVersion() CXX11_OVERRIDE { return Version("Implements the ability to have server-side MLOCK enforcement.", VF_VENDOR); } - ModResult OnRawMode(User* source, Channel* channel, const char mode, const std::string& parameter, bool adding, int pcnt) + ModResult OnRawMode(User* source, Channel* channel, ModeHandler* mh, const std::string& parameter, bool adding) CXX11_OVERRIDE { if (!channel) return MOD_RES_PASSTHRU; @@ -43,11 +52,11 @@ public: if (!mlock_str) return MOD_RES_PASSTHRU; + const char mode = mh->GetModeChar(); std::string::size_type p = mlock_str->find(mode); if (p != std::string::npos) { - source->WriteNumeric(742, "%s %c %s :MODE cannot be set due to channel having an active MLOCK restriction policy", - channel->name.c_str(), mode, mlock_str->c_str()); + source->WriteNumeric(ERR_MLOCKRESTRICTED, channel->name, mode, *mlock_str, "MODE cannot be set due to channel having an active MLOCK restriction policy"); return MOD_RES_DENY; }