diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-08-07 16:04:17 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-08-07 16:04:17 +0000 |
commit | c87812cb4bf851385219ca6d4f20458f88809665 (patch) | |
tree | bece06cd363e561c40d9300bfde9efb5004eeece /src/modules | |
parent | 48f5beea5b9076c969c2b58c11f068697ed2b811 (diff) |
Add module implementing +A and extban +b A: which explicitly allow users to use /invite. m_noinvite is still available, also.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10116 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_allowinvite.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/modules/m_allowinvite.cpp b/src/modules/m_allowinvite.cpp new file mode 100644 index 000000000..f137598e2 --- /dev/null +++ b/src/modules/m_allowinvite.cpp @@ -0,0 +1,69 @@ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2008 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits + * + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + +#include "inspircd.h" + +/* $ModDesc: Provides support for channel mode +A, allowing /invite freely on a channel (and extban A to allow specific users it) */ + +class AllowInvite : public SimpleChannelModeHandler +{ + public: + AllowInvite(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'A') { } +}; + +class ModuleAllowInvite : public Module +{ + AllowInvite *ni; + public: + + ModuleAllowInvite(InspIRCd* Me) : Module(Me) + { + ni = new AllowInvite(ServerInstance); + if (!ServerInstance->Modes->AddMode(ni)) + throw ModuleException("Could not add new modes!"); + Implementation eventlist[] = { I_OnUserPreInvite, I_On005Numeric }; + ServerInstance->Modules->Attach(eventlist, this, 2); + } + + virtual void On005Numeric(std::string &output) + { + ServerInstance->AddExtBanChar('A'); + } + + virtual int OnUserPreInvite(User* user,User* dest,Channel* channel, time_t timeout) + { + if (IS_LOCAL(user)) + { + if (channel->IsModeSet('A') || channel->IsExtBanned(user, 'A')) + { + // Explicitly allow /invite + return -1; + } + } + + return 0; + } + + virtual ~ModuleAllowInvite() + { + ServerInstance->Modes->DelMode(ni); + delete ni; + } + + virtual Version GetVersion() + { + return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION); + } +}; + +MODULE_INIT(ModuleAllowInvite) |