1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 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, bool)
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->Modes->AddMode(ni))
55 throw ModuleException("Could not add new modes!");
56 Implementation eventlist[] = { I_OnUserPreInvite };
57 ServerInstance->Modules->Attach(eventlist, this, 1);
61 virtual int OnUserPreInvite(User* user,User* dest,Channel* channel, time_t timeout)
63 if (channel->IsModeSet('V'))
65 user->WriteNumeric(492, "%s %s :Can't invite %s to channel (+V set)",user->nick, channel->name, dest->nick);
71 virtual ~ModuleNoInvite()
73 ServerInstance->Modes->DelMode(ni);
77 virtual Version GetVersion()
79 return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
83 MODULE_INIT(ModuleNoInvite)