From c8f3a8d365aeb89455c391efff190ffb48b05a2c Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 14 Jan 2007 18:30:44 +0000 Subject: [PATCH] Fix BeforeMode to have the parameter available, if there are enough parameters for the mode and the mode parameter is valid git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6326 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/mode.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/mode.cpp b/src/mode.cpp index 4d6023c1c..695f043da 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -435,12 +435,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool { bool abort = false; - for (ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++) - { - if ((*watchers)->BeforeMode(user, targetuser, targetchannel, parameter, adding, type) == MODEACTION_DENY) - abort = true; - } - if ((modehandlers[handler_id]->GetModeType() == type) && (!abort)) + if (modehandlers[handler_id]->GetModeType() == type) { if (modehandlers[handler_id]->GetNumParams(adding)) { @@ -459,6 +454,18 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool /* No parameter, continue to the next mode */ continue; } + + for (ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++) + { + if ((*watchers)->BeforeMode(user, targetuser, targetchannel, parameter, adding, type) == MODEACTION_DENY) + { + abort = true; + break; + } + } + + if (abort) + continue; } /* It's an oper only mode, check if theyre an oper. If they arent, -- 2.39.5