X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmode.cpp;h=a530f2eca1be91cfbbef0302b7d57c587be0e81c;hb=48f5beea5b9076c969c2b58c11f068697ed2b811;hp=ca30f1b699ad569ab7cc2913f1bb0895dc1f6c4a;hpb=9ab90c52b46cc613d29174fd183330bd9ace1e97;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/mode.cpp b/src/mode.cpp index ca30f1b69..a530f2eca 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -11,7 +11,7 @@ * --------------------------------------------------- */ -/* $Core: libIRCDmode */ +/* $Core */ /* $ExtraDeps: $(RELCPPFILES) */ /* $ExtraObjects: modes/modeclasses.a */ /* $ExtraBuild: @${MAKE} -C "modes" DIRNAME="src/modes" CC="$(CC)" $(MAKEARGS) CPPFILES="$(CPPFILES)" */ @@ -43,16 +43,14 @@ #include "modes/cmode_h.h" /* +v (channel voice) */ #include "modes/cmode_v.h" -/* +s (server notices) */ -#include "modes/umode_s.h" /* +w (see wallops) */ #include "modes/umode_w.h" /* +i (invisible) */ #include "modes/umode_i.h" /* +o (operator) */ #include "modes/umode_o.h" -/* +n (notice mask - our implementation of snomasks) */ -#include "modes/umode_n.h" +/* +s (server notice masks) */ +#include "modes/umode_s.h" ModeHandler::ModeHandler(InspIRCd* Instance, char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly, char mprefix, char prefixrequired) : ServerInstance(Instance), mode(modeletter), n_params_on(parameters_on), n_params_off(parameters_off), list(listmode), m_type(type), oper(operonly), prefix(mprefix), count(0), prefixneeded(prefixrequired) @@ -641,6 +639,17 @@ void ModeParser::Process(const std::vector& parameters, User *user, if (abort) continue; + /* If it's disabled, they have to be an oper. + */ + if (IS_LOCAL(user) && !IS_OPER(user) && ((type == MODETYPE_CHANNEL ? ServerInstance->Config->DisabledCModes : ServerInstance->Config->DisabledUModes)[modehandlers[handler_id]->GetModeChar() - 'A'])) + { + user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - %s mode %c has been locked by the administrator", + user->nick.c_str(), + type == MODETYPE_CHANNEL ? "channel" : "user", + modehandlers[handler_id]->GetModeChar()); + continue; + } + /* It's an oper only mode, check if theyre an oper. If they arent, * eat any parameter that came with the mode, and continue to next */ @@ -1191,7 +1200,6 @@ ModeParser::ModeParser(InspIRCd* Instance) : ServerInstance(Instance) new ModeChannelOp(Instance), new ModeChannelHalfOp(Instance), new ModeChannelVoice(Instance), - new ModeUserServerNotice(Instance), new ModeUserWallops(Instance), new ModeUserInvisible(Instance), new ModeUserOperator(Instance), @@ -1210,5 +1218,5 @@ ModeParser::ModeParser(InspIRCd* Instance) : ServerInstance(Instance) this->AddMode(modes[index]); seq = 0; - memset(&sent, 0, 256); + memset(&sent, 0, sizeof(sent)); }