7 #include "helperfuncs.h"
8 #include "u_listmode.h"
10 /* $ModDesc: Provides support for the +I channel mode */
12 /* Written by Om<om@inspircd.org>, April 2005. */
13 /* Based on m_exception, which was originally based on m_chanprotect and m_silence */
15 // The +I channel mode takes a nick!ident@host, glob patterns allowed,
16 // and if a user matches an entry on the +I list then they can join the channel, ignoring if +i is set on the channel
18 class ModuleInviteException : public ListModeBaseModule
21 ModuleInviteException(Server* serv) : ListModeBaseModule::ListModeBaseModule(serv, 'I', "End of Channel Invite Exception List", "346", "347")
25 virtual void Implements(char* List)
27 this->DoImplements(List);
28 List[I_On005Numeric] = List[I_OnCheckInvite] = 1;
31 virtual void On005Numeric(std::string &output)
33 output.append(" INVEX=I");
34 InsertMode(output, "I", 1);
37 virtual int OnCheckInvite(userrec* user, chanrec* chan)
41 modelist* list = (modelist*)chan->GetExt(infokey);
42 Srv->Log(DEBUG, std::string(user->nick)+" is trying to join "+std::string(chan->name)+", checking for invite exceptions");
45 for (modelist::iterator it = list->begin(); it != list->end(); it++)
47 if(Srv->MatchText(user->GetFullRealHost(), it->mask) || Srv->MatchText(user->GetFullHost(), it->mask))
49 // 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.
60 virtual Version GetVersion()
62 return Version(1, 0, 0, 3, VF_VENDOR | VF_STATIC);
67 class ModuleInviteExceptionFactory : public ModuleFactory
70 ModuleInviteExceptionFactory()
74 ~ModuleInviteExceptionFactory()
78 virtual Module * CreateModule(Server* serv)
80 return new ModuleInviteException(serv);
86 extern "C" void * init_module( void )
88 return new ModuleInviteExceptionFactory;