1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
21 /* $ModDesc: Implements config tags which allow blocking of joins to channels */
23 class ModuleDenyChannels : public Module
31 ModuleDenyChannels(InspIRCd* Me) : Module::Module(Me)
34 Conf = new ConfigReader(ServerInstance);
37 virtual void OnRehash(userrec* user, const std::string ¶m)
40 Conf = new ConfigReader(ServerInstance);
43 virtual ~ModuleDenyChannels()
48 virtual Version GetVersion()
50 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
53 void Implements(char* List)
55 List[I_OnUserPreJoin] = List[I_OnRehash] = 1;
58 virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname, std::string &privs)
60 for (int j =0; j < Conf->Enumerate("badchan"); j++)
62 if (match(cname, Conf->ReadValue("badchan","name",j).c_str()))
64 if (IS_OPER(user) && Conf->ReadFlag("badchan","allowopers",j))
70 std::string reason = Conf->ReadValue("badchan","reason",j);
71 user->WriteServ("926 %s %s :Channel %s is forbidden: %s",user->nick,cname,cname,reason.c_str());
80 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
82 class ModuleDenyChannelsFactory : public ModuleFactory
85 ModuleDenyChannelsFactory()
89 ~ModuleDenyChannelsFactory()
93 virtual Module * CreateModule(InspIRCd* Me)
95 return new ModuleDenyChannels(Me);
101 extern "C" void * init_module( void )
103 return new ModuleDenyChannelsFactory;