diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-05-01 13:11:06 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-05-01 13:11:06 +0000 |
commit | 46f962748b28d7f00dcb5a5acf5f13608a5d9bfc (patch) | |
tree | ccf7230515ddf8f382f0571e6b85ab90a417dfae /src | |
parent | 33677d80717f7ad458816cd538d424e09ba2eb18 (diff) |
Added access checks.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@762 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_chanprotect.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 83dc2fd6f..93aae23a5 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -36,6 +36,68 @@ class ModuleChanProtect : public Module } } + virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type) + { + // don't allow action if: + // (A) Theyre founder (no matter what) + // (B) Theyre protected, and you're not + switch (access_type) + { + case AC_DEOP: + if (dest->GetExt("cm_founder_"+std::string(channel->name))) + { + Srv->SendServ(source->fd,"482 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't deop "+std::string(dest->nick)+" as the're a channel founder"); + return ACR_DENY; + } + if ((dest->GetExt("cm_protect_"+std::string(channel->name))) && (!source->GetExt("cm_protect_"+std::string(channel->name)))) + { + Srv->SendServ(source->fd,"482 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't deop "+std::string(dest->nick)+" as the're protected (+a)"); + return ACR_DENY; + } + break; + + case AC_KICK: + if (dest->GetExt("cm_founder_"+std::string(channel->name))) + { + Srv->SendServ(source->fd,"482 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't kick "+std::string(dest->nick)+" as the're a channel founder"); + return ACR_DENY; + } + if ((dest->GetExt("cm_protect_"+std::string(channel->name))) && (!source->GetExt("cm_protect_"+std::string(channel->name)))) + { + Srv->SendServ(source->fd,"482 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't kick "+std::string(dest->nick)+" as the're protected (+a)"); + return ACR_DENY; + } + break; + + case AC_DEHALFOP: + if (dest->GetExt("cm_founder_"+std::string(channel->name))) + { + Srv->SendServ(source->fd,"482 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't de-halfop "+std::string(dest->nick)+" as the're a channel founder"); + return ACR_DENY; + } + if ((dest->GetExt("cm_protect_"+std::string(channel->name))) && (!source->GetExt("cm_protect_"+std::string(channel->name)))) + { + Srv->SendServ(source->fd,"482 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't de-halfop "+std::string(dest->nick)+" as the're protected (+a)"); + return ACR_DENY; + } + break; + + case AC_DEVOICE: + if (dest->GetExt("cm_founder_"+std::string(channel->name))) + { + Srv->SendServ(source->fd,"482 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't devoice "+std::string(dest->nick)+" as the're a channel founder"); + return ACR_DENY; + } + if ((dest->GetExt("cm_protect_"+std::string(channel->name))) && (!source->GetExt("cm_protect_"+std::string(channel->name)))) + { + Srv->SendServ(source->fd,"482 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't devoice "+std::string(dest->nick)+" as the're protected (+a)"); + return ACR_DENY; + } + break; + } + return ACR_DEFAULT; + } + virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms) { // not out mode, bail |