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 /* $ModDesc: Implements config tags which allow blocking of joins to channels */
26 class ModuleDenyChannels : public Module
34 ModuleDenyChannels(InspIRCd* Me) : Module::Module(Me)
37 Conf = new ConfigReader(ServerInstance);
40 virtual void OnRehash(const std::string ¶m)
43 Conf = new ConfigReader(ServerInstance);
46 virtual ~ModuleDenyChannels()
51 virtual Version GetVersion()
53 return Version(1,0,0,1,VF_VENDOR);
56 void Implements(char* List)
58 List[I_OnUserPreJoin] = List[I_OnRehash] = 1;
61 virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname)
63 for (int j =0; j < Conf->Enumerate("badchan"); j++)
65 irc::string cn = Conf->ReadValue("badchan","name",j).c_str();
66 irc::string thischan = cname;
69 if ((Conf->ReadFlag("badchan","allowopers",j)) && *user->oper)
75 std::string reason = Conf->ReadValue("badchan","reason",j);
76 user->WriteServ("926 %s %s :Channel %s is forbidden: %s",user->nick,cname,cname,reason.c_str());
85 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
87 class ModuleDenyChannelsFactory : public ModuleFactory
90 ModuleDenyChannelsFactory()
94 ~ModuleDenyChannelsFactory()
98 virtual Module * CreateModule(InspIRCd* Me)
100 return new ModuleDenyChannels(Me);
106 extern "C" void * init_module( void )
108 return new ModuleDenyChannelsFactory;