From dfa6568af2bceb842d6f9ba73ee6a6679e2c5d0c Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 5 Feb 2006 00:19:25 +0000 Subject: Re-organized order of cmd_kick stuff (OnUserPreKick) to make override kicks work nicer git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3085 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_override.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/modules/m_override.cpp') diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index 3cce62758..a16f8428e 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -57,7 +57,7 @@ class ModuleOverride : public Module void Implements(char* List) { - List[I_OnRehash] = List[I_OnAccessCheck] = List[I_On005Numeric] = List[I_OnUserPreJoin] = 1; + List[I_OnRehash] = List[I_OnAccessCheck] = List[I_On005Numeric] = List[I_OnUserPreJoin] = List[I_OnUserPreKick] = 1; } virtual void On005Numeric(std::string &output) @@ -81,10 +81,24 @@ class ModuleOverride : public Module // its not defined at all, count as false return false; } + + virtual int OnUserPreKick(userrec* source, userrec* user, chanrec* chan, std::string reason) + { + if ((*source->oper) && (CanOverride(source,"KICK"))) + { + if (((Srv->ChanMode(source,channel) == "%") && (Srv->ChanMode(user,channel) == "@")) || (Srv->ChanMode(source,channel) == "")) + { + Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Kicked "+std::string(user->nick)+" on "+std::string(chan->name)+" ("+reason+")"); + } + /* Returning -1 explicitly allows the kick */ + return -1; + } + return 0; + } virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type) { - if (strchr(source->modes,'o')) + if (*source->oper) { if ((Srv) && (source) && (channel)) { @@ -94,14 +108,6 @@ class ModuleOverride : public Module { switch (access_type) { - case AC_KICK: - if (CanOverride(source,"KICK")) - { - Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Kicked "+std::string(dest->nick)+" on "+std::string(channel->name)); - return ACR_ALLOW; - } - else return ACR_DEFAULT; - break; case AC_DEOP: if (CanOverride(source,"MODEDEOP")) { -- cgit v1.2.3