#include "users.h"
#include "channels.h"
#include "modules.h"
-#include "helperfuncs.h"
+#include "configreader.h"
#include "inspircd.h"
/* $ModDesc: Provides support for unreal-style oper-override */
-extern InspIRCd* ServerInstance;
-
typedef std::map<std::string,std::string> override_t;
class ModuleOverride : public Module
{
- Server *Srv;
+
override_t overrides;
bool NoisyOverride;
public:
- ModuleOverride(Server* Me)
+ ModuleOverride(InspIRCd* Me)
: Module::Module(Me)
- {
-
- // here we initialise our module. Use new to create new instances of the required
- // classes.
-
- Srv = Me;
-
+ {
// read our config options (main config file)
OnRehash("");
}
virtual void OnRehash(const std::string ¶meter)
{
// on a rehash we delete our classes for good measure and create them again.
- ConfigReader* Conf = new ConfigReader;
+ ConfigReader* Conf = new ConfigReader(ServerInstance);
// re-read our config options on a rehash
NoisyOverride = Conf->ReadFlag("override","noisy",0);
{
if (*source->oper)
{
- if ((Srv) && (source) && (channel))
+ if (source && channel)
{
// Fix by brain - allow the change if they arent on channel - rely on boolean short-circuit
// to not check the other items in the statement if they arent on the channel
if (!user->IsInvited(x))
{
/* XXX - Ugly cast for a parameter that isn't used? :< - Om */
- chan->WriteChannelWithServ(Srv->GetServerName().c_str(), "NOTICE %s :%s invited himself into the channel", cname, user->nick);
+ chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper-override to bypass invite-only", cname, user->nick);
}
}
ServerInstance->WriteOpers("*** "+std::string(user->nick)+" used operoverride to bypass +i on "+std::string(cname));
if ((chan->key[0]) && (CanOverride(user,"KEY")))
{
if (NoisyOverride)
- chan->WriteChannelWithServ(Srv->GetServerName().c_str(), "NOTICE %s :%s bypassed the channel key", cname, user->nick);
+ chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper-override to bypass the channel key", cname, user->nick);
ServerInstance->WriteOpers("*** "+std::string(user->nick)+" used operoverride to bypass +k on "+std::string(cname));
return -1;
}
if ((chan->limit > 0) && (chan->GetUserCounter() >= chan->limit) && (CanOverride(user,"LIMIT")))
{
if (NoisyOverride)
- chan->WriteChannelWithServ(Srv->GetServerName().c_str(), "NOTICE %s :%s passed through your channel limit", cname, user->nick);
+ chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper-override to bypass the channel limit", cname, user->nick);
ServerInstance->WriteOpers("*** "+std::string(user->nick)+" used operoverride to bypass +l on "+std::string(cname));
return -1;
}
if (CanOverride(user,"BANWALK"))
{
// other join
+ if (NoisyOverride)
+ chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper-override to bypass channel bans", cname, user->nick);
return -1;
}
}
{
}
- virtual Module * CreateModule(Server* Me)
+ virtual Module * CreateModule(InspIRCd* Me)
{
return new ModuleOverride(Me);
}