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, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'A') { }
24 class ModuleAllowInvite : public Module
29 ModuleAllowInvite(InspIRCd* Me) : Module(Me), ni(Me, this)
31 if (!ServerInstance->Modes->AddMode(&ni))
32 throw ModuleException("Could not add new modes!");
33 Implementation eventlist[] = { I_OnUserPreInvite, I_On005Numeric };
34 ServerInstance->Modules->Attach(eventlist, this, 2);
37 virtual void On005Numeric(std::string &output)
39 ServerInstance->AddExtBanChar('A');
42 virtual ModResult OnUserPreInvite(User* user,User* dest,Channel* channel, time_t timeout)
46 ModResult res = channel->GetExtBanStatus(user, 'A');
47 if (res == MOD_RES_DENY)
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') || res == MOD_RES_ALLOW)
55 // Explicitly allow /invite
60 return MOD_RES_PASSTHRU;
63 virtual ~ModuleAllowInvite()
65 ServerInstance->Modes->DelMode(&ni);
68 virtual Version GetVersion()
70 return Version("$Id$",VF_COMMON|VF_VENDOR,API_VERSION);
74 MODULE_INIT(ModuleAllowInvite)