1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Provides support for unreal-style channel mode +V */
18 class NoInvite : public ModeHandler
21 NoInvite(InspIRCd* Instance) : ModeHandler(Instance, 'V', 0, 0, false, MODETYPE_CHANNEL, false) { }
23 ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
27 if (!channel->IsModeSet('V'))
29 channel->SetMode('V',true);
30 return MODEACTION_ALLOW;
35 if (channel->IsModeSet('V'))
37 channel->SetMode('V',false);
38 return MODEACTION_ALLOW;
42 return MODEACTION_DENY;
46 class ModuleNoInvite : public Module
51 ModuleNoInvite(InspIRCd* Me) : Module(Me)
53 ni = new NoInvite(ServerInstance);
54 if (!ServerInstance->AddMode(ni, 'V'))
55 throw ModuleException("Could not add new modes!");
58 void Implements(char* List)
60 List[I_OnUserPreInvite] = 1;
63 virtual int OnUserPreInvite(User* user,User* dest,Channel* channel)
65 if (channel->IsModeSet('V'))
67 user->WriteServ("492 %s %s :Can't invite %s to channel (+V set)",user->nick, channel->name, dest->nick);
73 virtual ~ModuleNoInvite()
75 ServerInstance->Modes->DelMode(ni);
79 virtual Version GetVersion()
81 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
85 MODULE_INIT(ModuleNoInvite)