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 * ---------------------------------------------------
24 #include "helperfuncs.h"
26 /* $ModDesc: Implements config tags which allow blocking of joins to channels */
28 class ModuleDenyChannels : public Module
36 ModuleDenyChannels(Server* Me)
40 Conf = new ConfigReader;
43 virtual ~ModuleDenyChannels()
48 virtual Version GetVersion()
50 return Version(1,0,0,1,VF_VENDOR);
53 void Implements(char* List)
55 List[I_OnUserPreJoin] = 1;
58 virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname)
60 for (int j =0; j < Conf->Enumerate("badchan"); j++)
62 irc::string cn = Conf->ReadValue("badchan","name",j).c_str();
63 irc::string thischan = cname;
66 if ((Conf->ReadFlag("badchan","allowopers",j)) && (strchr(user->modes,'o')))
72 std::string reason = Conf->ReadValue("badchan","reason",j);
73 WriteServ(user->fd,"926 %s %s :Channel %s is forbidden: %s",user->nick,cname,cname,reason.c_str());
82 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
84 class ModuleDenyChannelsFactory : public ModuleFactory
87 ModuleDenyChannelsFactory()
91 ~ModuleDenyChannelsFactory()
95 virtual Module * CreateModule(Server* Me)
97 return new ModuleDenyChannels(Me);
103 extern "C" void * init_module( void )
105 return new ModuleDenyChannelsFactory;