summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/channels.cpp57
-rw-r--r--src/cmd_kick.cpp2
-rw-r--r--src/modules/m_override.cpp26
3 files changed, 48 insertions, 37 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index e8e7efcf8..4c6634a16 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -589,33 +589,38 @@ void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason)
return;
}
int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(src,user,Ptr,AC_KICK));
- if ((MOD_RESULT == ACR_DENY) && (!is_uline(src->server)))
- return;
-
- if ((MOD_RESULT == ACR_DEFAULT) || (!is_uline(src->server)))
- {
- if ((cstatus(src,Ptr) < STATUS_HOP) || (cstatus(src,Ptr) < cstatus(user,Ptr)))
- {
- if (cstatus(src,Ptr) == STATUS_HOP)
- {
- WriteServ(src->fd,"482 %s %s :You must be a channel operator",src->nick, Ptr->name);
- }
- else
- {
- WriteServ(src->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",src->nick, Ptr->name);
- }
+
+ if (!is_uline(src->server))
+ {
+ MOD_RESULT = 0;
+ FOREACH_RESULT(I_OnUserPreKick,OnUserPreKick(src,user,Ptr,reason));
+ if (MOD_RESULT == 1)
+ return;
+ }
+ /* Set to -1 by OnUserPreKick if explicit allow was set */
+ if (MOD_RESULT != -1)
+ {
+ FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(src,user,Ptr,AC_KICK));
+ if ((MOD_RESULT == ACR_DENY) && (!is_uline(src->server)))
+ return;
- return;
- }
- }
- if (!is_uline(src->server))
- {
- MOD_RESULT = 0;
- FOREACH_RESULT(I_OnUserPreKick,OnUserPreKick(src,user,Ptr,reason));
- if (MOD_RESULT)
- return;
- }
+ if ((MOD_RESULT == ACR_DEFAULT) || (!is_uline(src->server)))
+ {
+ if ((cstatus(src,Ptr) < STATUS_HOP) || (cstatus(src,Ptr) < cstatus(user,Ptr)))
+ {
+ if (cstatus(src,Ptr) == STATUS_HOP)
+ {
+ WriteServ(src->fd,"482 %s %s :You must be a channel operator",src->nick, Ptr->name);
+ }
+ else
+ {
+ WriteServ(src->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",src->nick, Ptr->name);
+ }
+
+ return;
+ }
+ }
+ }
}
FOREACH_MOD(I_OnUserKick,OnUserKick(src,user,Ptr,reason));
diff --git a/src/cmd_kick.cpp b/src/cmd_kick.cpp
index 541fd34d7..2cd397de6 100644
--- a/src/cmd_kick.cpp
+++ b/src/cmd_kick.cpp
@@ -50,7 +50,7 @@ void cmd_kick::Handle (char **parameters, int pcnt, userrec *user)
return;
}
- if ((!has_channel(user,Ptr)) && (!is_uline(user->server)))
+ if ((IS_LOCAL(user)) && (!has_channel(user,Ptr)) && (!is_uline(user->server)))
{
WriteServ(user->fd,"442 %s %s :You're not on that channel!",user->nick, parameters[0]);
return;
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"))
{