10 #include "u_listmode.h"
12 /* $ModDesc: Provides support for the +e channel mode */
14 /* Written by Om<om@inspircd.org>, April 2005. */
15 /* Rewritten to use the listmode utility by Om, December 2005 */
16 /* Adapted from m_exception, which was originally based on m_chanprotect and m_silence */
18 // The +e channel mode takes a nick!ident@host, glob patterns allowed,
19 // and if a user matches an entry on the +e list then they can join the channel, overriding any (+b) bans set on them
22 /** Handles +e channel mode
24 class BanException : public ListModeBase
27 BanException(InspIRCd* Instance) : ListModeBase(Instance, 'e', "End of Channel Exception List", "348", "349", true) { }
31 class ModuleBanException : public Module
37 ModuleBanException(InspIRCd* Me)
40 be = new BanException(ServerInstance);
41 ServerInstance->AddMode(be, 'e');
44 virtual void Implements(char* List)
46 be->DoImplements(List);
47 List[I_On005Numeric] = List[I_OnCheckBan] = 1;
50 virtual void On005Numeric(std::string &output)
52 output.append(" EXCEPTS=e");
55 virtual int OnCheckBan(userrec* user, chanrec* chan)
60 chan->GetExt(be->GetInfoKey(), list);
64 for (modelist::iterator it = list->begin(); it != list->end(); it++)
65 if(ServerInstance->MatchText(user->GetFullRealHost(), it->mask) || ServerInstance->MatchText(user->GetFullHost(), it->mask))
66 // They match an entry on the list, so let them in.
70 // or if there wasn't a list, there can't be anyone on it, so we don't need to do anything.
75 virtual void OnCleanup(int target_type, void* item)
77 be->DoCleanup(target_type, item);
80 virtual void OnSyncChannel(chanrec* chan, Module* proto, void* opaque)
82 be->DoSyncChannel(chan, proto, opaque);
85 virtual void OnChannelDelete(chanrec* chan)
87 be->DoChannelDelete(chan);
90 virtual void OnRehash(const std::string ¶m)
95 virtual Version GetVersion()
97 return Version(1, 0, 0, 3, VF_COMMON | VF_VENDOR);
100 virtual ~ModuleBanException()
102 ServerInstance->Modes->DelMode(be);
107 class ModuleBanExceptionFactory : public ModuleFactory
110 ModuleBanExceptionFactory()
114 ~ModuleBanExceptionFactory()
118 virtual Module* CreateModule(InspIRCd* Me)
120 return new ModuleBanException(Me);
125 extern "C" void * init_module( void )
127 return new ModuleBanExceptionFactory;