X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_inviteexception.cpp;h=bcb2d7d6d03e01d0c6b2f8055d2334c014b74925;hb=b45e7cfebbeaad4ecc3c55bc3060140f50f710d3;hp=d5cb15ea5c0f5aec347ccf4d8a433e84046d6256;hpb=5bfd172ec5225e9af1ebb273158993dd589b1cc0;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp index d5cb15ea5..bcb2d7d6d 100644 --- a/src/modules/m_inviteexception.cpp +++ b/src/modules/m_inviteexception.cpp @@ -5,7 +5,7 @@ #include "channels.h" #include "modules.h" #include "mode.h" -#include "helperfuncs.h" + #include "u_listmode.h" /* $ModDesc: Provides support for the +I channel mode */ @@ -19,22 +19,24 @@ * ignoring if +i is set on the channel */ +class InspIRCd* ServerInstance; + +/** Handles channel mode +I + */ class InviteException : public ListModeBase { public: - InviteException(Server* serv) : ListModeBase(serv, 'I', "End of Channel Invite Exception List", "346", "347") { } + InviteException(InspIRCd* Instance) : ListModeBase(Instance, 'I', "End of Channel Invite Exception List", "346", "347", true) { } }; class ModuleInviteException : public Module { InviteException* ie; - Server* Srv; - public: - ModuleInviteException(Server* serv) : Module(serv) + ModuleInviteException(InspIRCd* Me) : Module(Me) { - ie = new InviteException(serv); - Srv = serv; + ie = new InviteException(ServerInstance); + ServerInstance->AddMode(ie, 'I'); } virtual void Implements(char* List) @@ -46,20 +48,19 @@ public: virtual void On005Numeric(std::string &output) { output.append(" INVEX=I"); - InsertMode(output, "I", 1); } virtual int OnCheckInvite(userrec* user, chanrec* chan) { if(chan != NULL) { - modelist* list = (modelist*)chan->GetExt(ie->GetInfoKey()); - Srv->Log(DEBUG, std::string(user->nick)+" is trying to join "+std::string(chan->name)+", checking for invite exceptions"); + modelist* list; + chan->GetExt(ie->GetInfoKey(), list); if (list) { for (modelist::iterator it = list->begin(); it != list->end(); it++) { - if(Srv->MatchText(user->GetFullRealHost(), it->mask) || Srv->MatchText(user->GetFullHost(), it->mask)) + if(match(user->GetFullRealHost(), it->mask.c_str()) || match(user->GetFullHost(), it->mask.c_str())) { // They match an entry on the list, so let them in. return 1; @@ -94,7 +95,13 @@ public: virtual Version GetVersion() { - return Version(1, 0, 0, 3, VF_VENDOR | VF_STATIC); + return Version(1, 0, 0, 3, VF_VENDOR | VF_COMMON); + } + + ~ModuleInviteException() + { + ServerInstance->Modes->DelMode(ie); + DELETE(ie); } }; @@ -110,9 +117,9 @@ class ModuleInviteExceptionFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* serv) + virtual Module * CreateModule(InspIRCd* Me) { - return new ModuleInviteException(serv); + return new ModuleInviteException(Me); } };