1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Provides support for channel mode +A, allowing /invite freely on a channel (and extban A to allow specific users it) */
18 class AllowInvite : public SimpleChannelModeHandler
21 AllowInvite(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'A') { }
24 class ModuleAllowInvite : public Module
29 ModuleAllowInvite(InspIRCd* Me) : Module(Me)
31 ni = new AllowInvite(ServerInstance);
32 if (!ServerInstance->Modes->AddMode(ni))
33 throw ModuleException("Could not add new modes!");
34 Implementation eventlist[] = { I_OnUserPreInvite, I_On005Numeric };
35 ServerInstance->Modules->Attach(eventlist, this, 2);
38 virtual void On005Numeric(std::string &output)
40 ServerInstance->AddExtBanChar('A');
43 virtual int OnUserPreInvite(User* user,User* dest,Channel* channel, time_t timeout)
47 if (channel->GetExtBanStatus(user, 'A') == -1)
49 // Matching extban, explicitly deny /invite
50 user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You are banned from using INVITE", user->nick.c_str(), channel->name.c_str());
53 if (channel->IsModeSet('A') || channel->GetExtBanStatus(user, 'A') == 1)
55 // Explicitly allow /invite
63 virtual ~ModuleAllowInvite()
65 ServerInstance->Modes->DelMode(ni);
69 virtual Version GetVersion()
71 return Version("$Id$",VF_COMMON|VF_VENDOR,API_VERSION);
75 MODULE_INIT(ModuleAllowInvite)