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"
26 /* $ModDesc: Provides support for unreal-style channel mode +V */
28 extern InspIRCd* ServerInstance;
30 class NoInvite : public ModeHandler
33 NoInvite() : ModeHandler('V', 0, 0, false, MODETYPE_CHANNEL, false) { }
35 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
39 if (!channel->IsModeSet('V'))
41 channel->SetMode('V',true);
42 return MODEACTION_ALLOW;
47 if (channel->IsModeSet('V'))
49 channel->SetMode('V',false);
50 return MODEACTION_ALLOW;
54 return MODEACTION_DENY;
58 class ModuleNoInvite : public Module
65 ModuleNoInvite(Server* Me) : Module::Module(Me)
69 Srv->AddMode(ni, 'V');
72 void Implements(char* List)
74 List[I_On005Numeric] = List[I_OnUserPreInvite] = 1;
77 virtual void On005Numeric(std::string &output)
79 ServerInstance->ModeGrok->InsertMode(output,"V",4);
83 virtual int OnUserPreInvite(userrec* user,userrec* dest,chanrec* channel)
85 if (channel->IsModeSet('V'))
87 user->WriteServ("492 %s %s :Can't invite %s to channel (+V set)",user->nick, channel->name, dest->nick);
93 virtual ~ModuleNoInvite()
98 virtual Version GetVersion()
100 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
105 class ModuleNoInviteFactory : public ModuleFactory
108 ModuleNoInviteFactory()
112 ~ModuleNoInviteFactory()
116 virtual Module * CreateModule(Server* Me)
118 return new ModuleNoInvite(Me);
124 extern "C" void * init_module( void )
126 return new ModuleNoInviteFactory;