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 * ---------------------------------------------------
24 /* $ModDesc: Provides support for unreal-style channel mode +V */
26 class NoInvite : public ModeHandler
29 NoInvite(InspIRCd* Instance) : ModeHandler(Instance, 'V', 0, 0, false, MODETYPE_CHANNEL, false) { }
31 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
35 if (!channel->IsModeSet('V'))
37 channel->SetMode('V',true);
38 return MODEACTION_ALLOW;
43 if (channel->IsModeSet('V'))
45 channel->SetMode('V',false);
46 return MODEACTION_ALLOW;
50 return MODEACTION_DENY;
54 class ModuleNoInvite : public Module
59 ModuleNoInvite(InspIRCd* Me) : Module::Module(Me)
61 ni = new NoInvite(ServerInstance);
62 ServerInstance->AddMode(ni, 'V');
65 void Implements(char* List)
67 List[I_OnUserPreInvite] = 1;
70 virtual int OnUserPreInvite(userrec* user,userrec* dest,chanrec* channel)
72 if (channel->IsModeSet('V'))
74 user->WriteServ("492 %s %s :Can't invite %s to channel (+V set)",user->nick, channel->name, dest->nick);
80 virtual ~ModuleNoInvite()
82 ServerInstance->Modes->DelMode(ni);
86 virtual Version GetVersion()
88 return Version(1,0,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
93 class ModuleNoInviteFactory : public ModuleFactory
96 ModuleNoInviteFactory()
100 ~ModuleNoInviteFactory()
104 virtual Module * CreateModule(InspIRCd* Me)
106 return new ModuleNoInvite(Me);
111 extern "C" void * init_module( void )
113 return new ModuleNoInviteFactory;