summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-10 14:46:03 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-10 14:46:03 +0000
commit1fa3b35712d2434a3acb033301e02d28ff0cca77 (patch)
tree1cf199936dc4c71fdcf5cb031e892ff0bfc1111e /src/modules
parent8ff551c3129861c1601eea8f8cdaf2795b8406ee (diff)
Fine-grained control over what can be overridden by whom
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1032 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_override.cpp101
1 files changed, 90 insertions, 11 deletions
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp
index 847d5668f..b43cc702c 100644
--- a/src/modules/m_override.cpp
+++ b/src/modules/m_override.cpp
@@ -57,6 +57,23 @@ class ModuleOverride : public Module
{
output = output + std::string(" OVERRIDE");
}
+
+ virtual bool CanOverride(userrec* source, char* token)
+ {
+ // checks to see if the oper's type has <type:override>
+ for (int j =0; j < Conf->Enumerate("type"); j++)
+ {
+ std::string typen = Conf->ReadValue("type","name",j);
+ if (!strcmp(typen.c_str(),source->oper))
+ {
+ // its defined, return its value as a boolean for if the token is set
+ std::string tokenlist = Conf->ReadValue("type","override",j);
+ return strstr(tokenlist.c_str(),token);
+ }
+ }
+ // its not defined at all, count as false
+ return false;
+ }
virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type)
{
@@ -71,30 +88,72 @@ class ModuleOverride : public Module
switch (access_type)
{
case AC_KICK:
- Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Kicked "+std::string(dest->nick)+" on "+std::string(channel->name));
+ 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:
- Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Deopped "+std::string(dest->nick)+" on "+std::string(channel->name));
+ if (CanOverride(source,"MODEOP"))
+ {
+ Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Deopped "+std::string(dest->nick)+" on "+std::string(channel->name));
+ return ACR_ALLOW;
+ }
+ else return ACR_DEFAULT;
break;
case AC_OP:
- Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Opped "+std::string(dest->nick)+" on "+std::string(channel->name));
+ if (CanOverride(source,"MODEDEOP"))
+ {
+ Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Opped "+std::string(dest->nick)+" on "+std::string(channel->name));
+ return ACR_ALLOW;
+ }
+ else return ACR_DEFAULT;
break;
case AC_VOICE:
- Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Voiced "+std::string(dest->nick)+" on "+std::string(channel->name));
+ if (CanOverride(source,"MODEVOICE"))
+ {
+ Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Voiced "+std::string(dest->nick)+" on "+std::string(channel->name));
+ return ACR_ALLOW;
+ }
+ else return ACR_DEFAULT;
break;
case AC_DEVOICE:
- Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Devoiced "+std::string(dest->nick)+" on "+std::string(channel->name));
+ if (CanOverride(source,"MODEDEVOICE"))
+ {
+ Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Devoiced "+std::string(dest->nick)+" on "+std::string(channel->name));
+ return ACR_ALLOW;
+ }
+ else return ACR_DEFAULT;
break;
case AC_HALFOP:
- Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Halfopped "+std::string(dest->nick)+" on "+std::string(channel->name));
+ if (CanOverride(source,"MODEHALFOP"))
+ {
+ Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Halfopped "+std::string(dest->nick)+" on "+std::string(channel->name));
+ return ACR_ALLOW;
+ }
+ else return ACR_DEFAULT;
break;
case AC_DEHALFOP:
- Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Dehalfopped "+std::string(dest->nick)+" on "+std::string(channel->name));
+ if (CanOverride(source,"MODEDEHALFOP"))
+ {
+ Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Dehalfopped "+std::string(dest->nick)+" on "+std::string(channel->name));
+ return ACR_ALLOW;
+ }
+ else return ACR_DEFAULT;
break;
}
}
}
- return ACR_ALLOW;
+ if (CanOverride(source,"OTHERMODE"))
+ {
+ return ACR_ALLOW;
+ }
+ else
+ {
+ return ACR_DEFAULT;
+ }
}
return ACR_DEFAULT;
@@ -106,7 +165,7 @@ class ModuleOverride : public Module
{
if (chan)
{
- if ((chan->inviteonly) || (chan->key[0]) || (chan->limit >= Srv->CountUsers(chan)))
+ if ((chan->inviteonly) && (CanOverride(user,"INVITE")))
{
if (NoisyOverride)
{
@@ -115,9 +174,29 @@ class ModuleOverride : public Module
WriteChannelWithServ((char*)Srv->GetServerName().c_str(),chan,user,"NOTICE %s :%s invited himself into the channel",cname,user->nick);
}
}
- Srv->SendOpers("*** "+std::string(user->nick)+" used operoverride to bypass +i, +k or +l on "+std::string(cname));
+ Srv->SendOpers("*** "+std::string(user->nick)+" used operoverride to bypass +i on "+std::string(cname));
+ return -1;
+ }
+ if ((chan->key[0]) && (CanOverride(user,"KEY")))
+ {
+ if (NoisyOverride)
+ WriteChannelWithServ((char*)Srv->GetServerName().c_str(),chan,user,"NOTICE %s :%s bypassed the channel key",cname,user->nick);
+ Srv->SendOpers("*** "+std::string(user->nick)+" used operoverride to bypass +k on "+std::string(cname));
+ return -1;
+ }
+ if ((chan->limit >= Srv->CountUsers(chan)) && (CanOverride(user,"LIMIT")))
+ {
+ if (NoisyOverride)
+ WriteChannelWithServ((char*)Srv->GetServerName().c_str(),chan,user,"NOTICE %s :%s passed through your channel limit",cname,user->nick);
+ Srv->SendOpers("*** "+std::string(user->nick)+" used operoverride to bypass ++l on "+std::string(cname));
+ return -1;
+ }
+
+ if (CanOverride(user,"BANWALK"))
+ {
+ // other join
+ return -1;
}
- return -1;
}
}
return 0;