#include "inspircd.h"
+enum
+{
+ // From Charybdis.
+ ERR_MLOCKRESTRICTED = 742
+};
+
class ModuleMLock : public Module
{
StringExtItem mlock;
public:
ModuleMLock()
- : mlock("mlock", this)
+ : mlock("mlock", ExtensionItem::EXT_CHANNEL, this)
{
}
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;
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;
}