1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 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 * ---------------------------------------------------
21 #include "helperfuncs.h"
23 /* $ModDesc: Implements config tags which allow blocking of joins to channels */
25 class ModuleDenyChannels : public Module
33 ModuleDenyChannels(Server* Me) : Module::Module(Me)
36 Conf = new ConfigReader;
39 virtual void OnRehash(const std::string ¶m)
42 Conf = new ConfigReader;
45 virtual ~ModuleDenyChannels()
50 virtual Version GetVersion()
52 return Version(1,0,0,1,VF_VENDOR);
55 void Implements(char* List)
57 List[I_OnUserPreJoin] = List[I_OnRehash] = 1;
60 virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname)
62 for (int j =0; j < Conf->Enumerate("badchan"); j++)
64 irc::string cn = Conf->ReadValue("badchan","name",j).c_str();
65 irc::string thischan = cname;
68 if ((Conf->ReadFlag("badchan","allowopers",j)) && *user->oper)
74 std::string reason = Conf->ReadValue("badchan","reason",j);
75 WriteServ(user->fd,"926 %s %s :Channel %s is forbidden: %s",user->nick,cname,cname,reason.c_str());
84 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
86 class ModuleDenyChannelsFactory : public ModuleFactory
89 ModuleDenyChannelsFactory()
93 ~ModuleDenyChannelsFactory()
97 virtual Module * CreateModule(Server* Me)
99 return new ModuleDenyChannels(Me);
105 extern "C" void * init_module( void )
107 return new ModuleDenyChannelsFactory;