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 * ---------------------------------------------------
17 /* $ModDesc: Implements config tags which allow blocking of joins to channels */
19 class ModuleDenyChannels : public Module
27 ModuleDenyChannels(InspIRCd* Me) : Module(Me)
30 Conf = new ConfigReader(ServerInstance);
33 virtual void OnRehash(User* user, const std::string ¶m)
36 Conf = new ConfigReader(ServerInstance);
39 virtual ~ModuleDenyChannels()
44 virtual Version GetVersion()
46 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
49 void Implements(char* List)
51 List[I_OnUserPreJoin] = List[I_OnRehash] = 1;
54 virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs)
56 for (int j =0; j < Conf->Enumerate("badchan"); j++)
58 if (match(cname, Conf->ReadValue("badchan","name",j).c_str()))
60 if (IS_OPER(user) && Conf->ReadFlag("badchan","allowopers",j))
66 std::string reason = Conf->ReadValue("badchan","reason",j);
67 user->WriteServ("926 %s %s :Channel %s is forbidden: %s",user->nick,cname,cname,reason.c_str());
76 MODULE_INIT(ModuleDenyChannels)