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 * ---------------------------------------------------
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 virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname)
55 for (int j =0; j < Conf->Enumerate("badchan"); j++)
57 irc::string cn = Conf->ReadValue("badchan","name",j).c_str();
58 irc::string thischan = cname;
61 if ((Conf->ReadFlag("badchan","allowopers",j)) && (strchr(user->modes,'o')))
67 std::string reason = Conf->ReadValue("badchan","reason",j);
68 WriteServ(user->fd,"926 %s %s :Channel %s is forbidden: %s",user->nick,cname,cname,reason.c_str());
77 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
79 class ModuleDenyChannelsFactory : public ModuleFactory
82 ModuleDenyChannelsFactory()
86 ~ModuleDenyChannelsFactory()
90 virtual Module * CreateModule(Server* Me)
92 return new ModuleDenyChannels(Me);
98 extern "C" void * init_module( void )
100 return new ModuleDenyChannelsFactory;