X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_disable.cpp;h=4bc5ef534e97adbfc61f82602708f69ced46a98f;hb=e94b673532f7833aaa4789f834e61d68e0b4fc56;hp=f1b7872fb13dfa58f9c28b94d45e89df9aaefb4c;hpb=aa692dc1039b63deef7886e914ec499abe7facaf;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_disable.cpp b/src/modules/m_disable.cpp index f1b7872fb..4bc5ef534 100644 --- a/src/modules/m_disable.cpp +++ b/src/modules/m_disable.cpp @@ -1,7 +1,7 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2019 Sadie Powell + * Copyright (C) 2019-2021 Sadie Powell * Copyright (C) 2019 Robby * * This file is part of InspIRCd. InspIRCd is free software: you can @@ -55,7 +55,7 @@ class ModuleDisable : public Module // Check that the mode actually exists. ModeHandler* mh = ServerInstance->Modes->FindMode(chr, type); - if (!chr) + if (!mh) throw ModuleException(InspIRCd::Format("Nonexistent mode '%c' was specified in at %s", chr, field.c_str(), tag->getTagLocation().c_str())); @@ -93,8 +93,8 @@ class ModuleDisable : public Module throw ModuleException(InspIRCd::Format("Nonexistent command '%s' was specified in at %s", command.c_str(), tag->getTagLocation().c_str())); - // Prevent admins from disabling COMMANDS and MODULES for transparency reasons. - if (handler->name == "COMMANDS" || handler->name == "MODULES") + // Prevent admins from disabling MODULES for transparency reasons. + if (handler->name == "MODULES") continue; // Disable the command. @@ -163,15 +163,17 @@ class ModuleDisable : public Module // The user has tried to change a disabled mode! const char* what = mh->GetModeType() == MODETYPE_CHANNEL ? "channel" : "user"; - WriteLog("%s was blocked from executing the disabled %s mode %c (%s)", - user->GetFullRealHost().c_str(), what, mh->GetModeChar(), mh->name.c_str()); + WriteLog("%s was blocked from %ssetting the disabled %s mode %c (%s)", + user->GetFullRealHost().c_str(), adding ? "" : "un", + what, mh->GetModeChar(), mh->name.c_str()); if (fakenonexistent) { // The server administrator has specified that disabled modes should be // treated as if they do not exist. - user->WriteNumeric(mh->GetModeType() == MODETYPE_CHANNEL ? ERR_UNKNOWNMODE : ERR_UNKNOWNSNOMASK, - mh->GetModeChar(), "is an unknown mode character"); + int numeric = (mh->GetModeType() == MODETYPE_CHANNEL ? ERR_UNKNOWNMODE : ERR_UNKNOWNSNOMASK); + const char* typestr = (mh->GetModeType() == MODETYPE_CHANNEL ? "channel" : "user"); + user->WriteNumeric(numeric, mh->GetModeChar(), InspIRCd::Format("is not a recognised %s mode.", typestr)); return MOD_RES_DENY; } @@ -183,7 +185,7 @@ class ModuleDisable : public Module Version GetVersion() CXX11_OVERRIDE { - return Version("Provides support for disabling commands and modes", VF_VENDOR); + return Version("Allows commands, channel modes, and user modes to be disabled.", VF_VENDOR); } };