X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_denychans.cpp;h=300d13b4ab67d039949ca4cf6527ca2b3d5d4d47;hb=fea1a27cb96a114f698eedcf90401b78406108fb;hp=1da4158d3caaaa6c2931790cf6ba2e90d5aca4b2;hpb=9e7c48c59f3ffda80eb979aed43f5491c80b7e75;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index 1da4158d3..300d13b4a 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * Inspire is copyright (C) 2002-2004 ChatSpike-Dev. + * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. * E-mail: * * @@ -14,9 +14,6 @@ * --------------------------------------------------- */ -using namespace std; - -#include #include "users.h" #include "channels.h" #include "modules.h" @@ -33,16 +30,21 @@ class ModuleDenyChannels : public Module ConfigReader *Conf; public: - ModuleDenyChannels(Server* Me) - : Module::Module(Me) + ModuleDenyChannels(Server* Me) : Module::Module(Me) { Srv = Me; Conf = new ConfigReader; } + virtual void OnRehash(const std::string ¶m) + { + DELETE(Conf); + Conf = new ConfigReader; + } + virtual ~ModuleDenyChannels() { - delete Conf; + DELETE(Conf); } virtual Version GetVersion() @@ -52,31 +54,31 @@ class ModuleDenyChannels : public Module void Implements(char* List) { - List[I_OnUserPreJoin] = 1; + List[I_OnUserPreJoin] = List[I_OnRehash] = 1; } - virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) - { + virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) + { for (int j =0; j < Conf->Enumerate("badchan"); j++) { irc::string cn = Conf->ReadValue("badchan","name",j).c_str(); irc::string thischan = cname; if (thischan == cn) { - if ((Conf->ReadFlag("badchan","allowopers",j)) && (strchr(user->modes,'o'))) + if ((Conf->ReadFlag("badchan","allowopers",j)) && *user->oper) { return 0; } else { std::string reason = Conf->ReadValue("badchan","reason",j); - WriteServ(user->fd,"926 %s %s :Channel %s is forbidden: %s",user->nick,cname,cname,reason.c_str()); + user->WriteServ("926 %s %s :Channel %s is forbidden: %s",user->nick,cname,cname,reason.c_str()); return 1; } } } return 0; - } + } }; // stuff down here is the module-factory stuff. For basic modules you can ignore this.