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 * ---------------------------------------------------
23 #include "helperfuncs.h"
25 /* $ModDesc: Provides support for unreal-style channel mode +V */
27 class NoInvite : public ModeHandler
30 NoInvite() : ModeHandler('V', 0, 0, false, MODETYPE_CHANNEL, false) { }
32 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
36 if (!channel->IsModeSet('V'))
38 channel->SetMode('V',true);
39 return MODEACTION_ALLOW;
44 if (channel->IsModeSet('V'))
46 channel->SetMode('V',false);
47 return MODEACTION_ALLOW;
51 return MODEACTION_DENY;
55 class ModuleNoInvite : public Module
62 ModuleNoInvite(Server* Me) : Module::Module(Me)
66 Srv->AddMode(ni, 'V');
69 void Implements(char* List)
71 List[I_On005Numeric] = List[I_OnUserPreInvite] = 1;
74 virtual void On005Numeric(std::string &output)
76 InsertMode(output,"V",4);
80 virtual int OnUserPreInvite(userrec* user,userrec* dest,chanrec* channel)
82 if (channel->IsModeSet('V'))
84 WriteServ(user->fd,"492 %s %s :Can't invite %s to channel (+V set)",user->nick, channel->name, dest->nick);
90 virtual ~ModuleNoInvite()
95 virtual Version GetVersion()
97 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
102 class ModuleNoInviteFactory : public ModuleFactory
105 ModuleNoInviteFactory()
109 ~ModuleNoInviteFactory()
113 virtual Module * CreateModule(Server* Me)
115 return new ModuleNoInvite(Me);
121 extern "C" void * init_module( void )
123 return new ModuleNoInviteFactory;