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 * ---------------------------------------------------
23 #include "helperfuncs.h"
25 /* $ModDesc: Only opers may create new channels if this module is loaded */
29 class ModuleRestrictChans : public Module
32 ModuleRestrictChans(Server* Me)
38 void Implements(char* List)
40 List[I_OnUserPreJoin] = 1;
43 virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname)
45 // user is not an oper
46 if (!strchr(user->modes,'o'))
48 // channel does not yet exist (record is null, about to be created IF we were to allow it)
51 WriteServ(user->fd,"530 %s %s :Only IRC operators may create new channels",user->nick,cname,cname);
58 virtual ~ModuleRestrictChans()
62 virtual Version GetVersion()
64 return Version(1,0,0,1,VF_VENDOR);
69 class ModuleRestrictChansFactory : public ModuleFactory
72 ModuleRestrictChansFactory()
76 ~ModuleRestrictChansFactory()
80 virtual Module * CreateModule(Server* Me)
82 return new ModuleRestrictChans(Me);
88 extern "C" void * init_module( void )
90 return new ModuleRestrictChansFactory;