X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_banredirect.cpp;h=73d8270d1b098452caa55dc9fc1c886bba7825bd;hb=67de413cad88194972d55a8ff88464370890c5a9;hp=a772794ab204ccb4afaf33b124f173b1c5ac7bdf;hpb=fd0fa86da89ab4cefa778307088ef2552a05a170;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index a772794ab..73d8270d1 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -44,7 +44,7 @@ typedef std::vector BanRedirectList; class BanRedirect : public ModeWatcher { - ModeReference ban; + ChanModeReference ban; public: SimpleExtItem extItem; BanRedirect(Module* parent) @@ -217,21 +217,22 @@ class ModuleBanRedirect : public Module { BanRedirect re; bool nofollow; + ChanModeReference limitmode; + ChanModeReference redirectmode; public: ModuleBanRedirect() - : re(this) + : re(this) + , nofollow(false) + , limitmode(this, "limit") + , redirectmode(this, "redirect") { - nofollow = false; } - void init() CXX11_OVERRIDE { ServerInstance->Modes->AddModeWatcher(&re); ServerInstance->Modules->AddService(re.extItem); - Implementation list[] = { I_OnUserPreJoin }; - ServerInstance->Modules->Attach(list, this, sizeof(list)/sizeof(Implementation)); } void OnCleanup(int target_type, void* item) CXX11_OVERRIDE @@ -311,9 +312,9 @@ class ModuleBanRedirect : public Module std::string destlimit; if (destchan) - destlimit = destchan->GetModeParameter('l'); + destlimit = destchan->GetModeParameter(limitmode); - if(destchan && ServerInstance->Modules->Find("m_redirect.so") && destchan->IsModeSet('L') && !destlimit.empty() && (destchan->GetUserCounter() >= atoi(destlimit.c_str()))) + if(destchan && destchan->IsModeSet(redirectmode) && !destlimit.empty() && (destchan->GetUserCounter() >= atoi(destlimit.c_str()))) { user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick.c_str(), chan->name.c_str()); return MOD_RES_DENY; @@ -338,7 +339,7 @@ class ModuleBanRedirect : public Module { /* XXX is this the best place to do this? */ if (!ServerInstance->Modes->DelModeWatcher(&re)) - ServerInstance->Logs->Log("m_banredirect.so", LOG_DEBUG, "Failed to delete modewatcher!"); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Failed to delete modewatcher!"); } Version GetVersion() CXX11_OVERRIDE