1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
22 /* $ModDesc: Provides support for unreal-style oper-override */
24 char dummyvalue[] = "on";
26 class ModuleOverride : public Module
37 // here we initialise our module. Use new to create new instances of the required
41 Conf = new ConfigReader;
43 // read our config options (main config file)
44 NoisyOverride = Conf->ReadFlag("override","noisy",0);
47 virtual void OnRehash()
49 // on a rehash we delete our classes for good measure and create them again.
51 Conf = new ConfigReader;
52 // re-read our config options on a rehash
53 NoisyOverride = Conf->ReadFlag("override","noisy",0);
56 virtual void On005Numeric(std::string &output)
58 output = output + std::string(" OVERRIDE");
61 virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type)
63 if (strchr(source->modes,'o'))
65 if ((Srv) && (source) && (channel))
67 // Fix by brain - allow the change if they arent on channel - rely on boolean short-circuit
68 // to not check the other items in the statement if they arent on the channel
69 if ((!Srv->IsOnChannel(source,channel)) || ((Srv->ChanMode(source,channel) != "%") && (Srv->ChanMode(source,channel) != "@")))
74 Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Kicked "+std::string(dest->nick)+" on "+std::string(channel->name));
77 Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Deopped "+std::string(dest->nick)+" on "+std::string(channel->name));
80 Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Opped "+std::string(dest->nick)+" on "+std::string(channel->name));
83 Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Voiced "+std::string(dest->nick)+" on "+std::string(channel->name));
86 Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Devoiced "+std::string(dest->nick)+" on "+std::string(channel->name));
89 Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Halfopped "+std::string(dest->nick)+" on "+std::string(channel->name));
92 Srv->SendOpers("*** NOTICE: "+std::string(source->nick)+" Override-Dehalfopped "+std::string(dest->nick)+" on "+std::string(channel->name));
103 virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname)
105 if (strchr(user->modes,'o'))
109 if ((chan->inviteonly) || (chan->key[0]) || (chan->limit >= Srv->CountUsers(chan)))
113 if (!user->IsInvited(chan->name))
115 WriteChannelWithServ((char*)Srv->GetServerName().c_str(),chan,user,"NOTICE %s :%s invited himself into the channel",cname,user->nick);
118 Srv->SendOpers("*** "+std::string(user->nick)+" used operoverride to bypass +i, +k or +l on "+std::string(cname));
126 virtual ~ModuleOverride()
132 virtual Version GetVersion()
134 return Version(1,0,0,1,VF_VENDOR);
139 class ModuleOverrideFactory : public ModuleFactory
142 ModuleOverrideFactory()
146 ~ModuleOverrideFactory()
150 virtual Module * CreateModule()
152 return new ModuleOverride;
158 extern "C" void * init_module( void )
160 return new ModuleOverrideFactory;