7 #include "helperfuncs.h"
8 #include "u_listmode.h"
10 /* $ModDesc: Provides support for the +e channel mode */
12 /* Written by Om<om@inspircd.org>, April 2005. */
13 /* Rewritten to use the listmode utility by Om, December 2005 */
14 /* Adapted from m_exception, which was originally based on m_chanprotect and m_silence */
16 // The +e channel mode takes a nick!ident@host, glob patterns allowed,
17 // and if a user matches an entry on the +e list then they can join the channel, overriding any (+b) bans set on them
20 class ModuleBanException : public ListModeBaseModule
23 ModuleBanException(Server* serv) : ListModeBaseModule::ListModeBaseModule(serv, 'e', "End of Channel Exception List", "348", "349")
27 virtual void Implements(char* List)
29 this->DoImplements(List);
30 List[I_On005Numeric] = List[I_OnCheckBan] = 1;
33 virtual void On005Numeric(std::string &output)
35 output.append(" EXCEPTS=e");
36 InsertMode(output, "e", 1);
39 virtual int OnCheckBan(userrec* user, chanrec* chan)
43 modelist* list = (modelist*)chan->GetExt(infokey);
44 Srv->Log(DEBUG, std::string(user->nick)+" is trying to join "+std::string(chan->name)+", checking for ban exceptions");
48 for (modelist::iterator it = list->begin(); it != list->end(); it++)
49 if(Srv->MatchText(user->GetFullRealHost(), it->mask) || Srv->MatchText(user->GetFullHost(), it->mask))
50 // They match an entry on the list, so let them in.
54 // or if there wasn't a list, there can't be anyone on it, so we don't need to do anything.
59 virtual Version GetVersion()
61 return Version(1, 0, 0, 3, VF_STATIC | VF_VENDOR);
65 class ModuleBanExceptionFactory : public ModuleFactory
68 ModuleBanExceptionFactory()
72 ~ModuleBanExceptionFactory()
76 virtual Module* CreateModule(Server* serv)
78 return new ModuleBanException(serv);
84 extern "C" void * init_module( void )
86 return new ModuleBanExceptionFactory;