]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/mode.cpp
Always deny invite to users below halfop status, move OnUserPreInvite up to above...
[user/henk/code/inspircd.git] / src / mode.cpp
index ca30f1b699ad569ab7cc2913f1bb0895dc1f6c4a..a530f2eca1be91cfbbef0302b7d57c587be0e81c 100644 (file)
@@ -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)" */
 #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<std::string>& 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));
 }