summaryrefslogtreecommitdiff
path: root/src/modules/m_nokicks.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-13 20:31:23 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-13 20:31:23 +0000
commit7892c8a0313c50d8138942ff3b112691caf05a2f (patch)
tree9c0c4a20584c0dca6adbeddec538ff871546dabe /src/modules/m_nokicks.cpp
parentb4be0c94ab5fb7e5a7a799a195c78de072a5e315 (diff)
Replace OnAccessCheck with OnPreMode to remove a number of redundant checks
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11700 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_nokicks.cpp')
-rw-r--r--src/modules/m_nokicks.cpp33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp
index 4af76e0d8..1324a7c03 100644
--- a/src/modules/m_nokicks.cpp
+++ b/src/modules/m_nokicks.cpp
@@ -31,43 +31,40 @@ class ModuleNoKicks : public Module
{
if (!ServerInstance->Modes->AddMode(&nk))
throw ModuleException("Could not add new modes!");
- Implementation eventlist[] = { I_OnAccessCheck, I_On005Numeric };
+ Implementation eventlist[] = { I_OnUserPreKick, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 2);
}
- virtual void On005Numeric(std::string &output)
+ void On005Numeric(std::string &output)
{
ServerInstance->AddExtBanChar('Q');
}
- virtual ModResult OnAccessCheck(User* source,User* dest,Channel* channel,int access_type)
+ ModResult OnUserPreKick(User* source, Membership* memb, const std::string &reason)
{
- if (access_type == AC_KICK)
+ if (!memb->chan->GetExtBanStatus(source, 'Q').check(!memb->chan->IsModeSet('Q')))
{
- if (!channel->GetExtBanStatus(source, 'Q').check(!channel->IsModeSet('Q')))
+ if ((ServerInstance->ULine(source->nick.c_str())) || (ServerInstance->ULine(source->server)) || (!*source->server))
{
- if ((ServerInstance->ULine(source->nick.c_str())) || (ServerInstance->ULine(source->server)) || (!*source->server))
- {
- // ulines can still kick with +Q in place
- return MOD_RES_PASSTHRU;
- }
- else
- {
- // nobody else can (not even opers with override, and founders)
- source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Can't kick user %s from channel (+Q set)",source->nick.c_str(), channel->name.c_str(), dest->nick.c_str());
- return MOD_RES_DENY;
- }
+ // ulines can still kick with +Q in place
+ return MOD_RES_PASSTHRU;
+ }
+ else
+ {
+ // nobody else can (not even opers with override, and founders)
+ source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Can't kick user %s from channel (+Q set)",source->nick.c_str(), memb->chan->name.c_str(), memb->user->nick.c_str());
+ return MOD_RES_DENY;
}
}
return MOD_RES_PASSTHRU;
}
- virtual ~ModuleNoKicks()
+ ~ModuleNoKicks()
{
ServerInstance->Modes->DelMode(&nk);
}
- virtual Version GetVersion()
+ Version GetVersion()
{
return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
}