X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_servprotect.cpp;h=b4f2b5bbd5ae5ba5a42ac78a9db2587e8a7c4ec9;hb=a5d110282a864fd2e91b51ce360a977cd0643657;hp=7df9effcc732d32ae5a59b18b55de5c38d5af8a9;hpb=553a8da754c8cd308bad2008018849714e70f9b7;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index 7df9effcc..b4f2b5bbd 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -21,7 +21,7 @@ #include "inspircd.h" -/* $ModDesc: Provides support for Austhex style +k / UnrealIRCD +S services mode */ +/* $ModDesc: Provides usermode +k to protect services from kicks, kills and mode changes. */ /** Handles user mode +k */ @@ -51,10 +51,13 @@ class ModuleServProtectMode : public Module ModuleServProtectMode() : bm(this) { - if (!ServerInstance->Modes->AddMode(&bm)) - throw ModuleException("Could not add new modes!"); + } + + void init() + { + ServerInstance->Modules->AddService(bm); Implementation eventlist[] = { I_OnWhois, I_OnKill, I_OnWhoisLine, I_OnRawMode, I_OnUserPreKick }; - ServerInstance->Modules->Attach(eventlist, this, 5); + ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } @@ -64,14 +67,14 @@ class ModuleServProtectMode : public Module Version GetVersion() { - return Version("Provides support for Austhex style +k / UnrealIRCD +S services mode", VF_VENDOR); + return Version("Provides usermode +k to protect services from kicks, kills, and mode changes.", VF_VENDOR); } void OnWhois(User* src, User* dst) { if (dst->IsModeSet('k')) { - ServerInstance->SendWhoisLine(src, dst, 310, std::string(src->nick)+" "+std::string(dst->nick)+" :is an "+ServerInstance->Config->Network+" Service"); + ServerInstance->SendWhoisLine(src, dst, 310, src->nick+" "+dst->nick+" :is an "+ServerInstance->Config->Network+" Service"); } } @@ -112,7 +115,7 @@ class ModuleServProtectMode : public Module if (dst->IsModeSet('k')) { src->WriteNumeric(485, "%s :You are not permitted to kill %s services!", src->nick.c_str(), ServerInstance->Config->Network.c_str()); - ServerInstance->SNO->WriteGlobalSno('a', std::string(src->nick)+" tried to kill service "+dst->nick+" ("+reason+")"); + ServerInstance->SNO->WriteGlobalSno('a', src->nick+" tried to kill service "+dst->nick+" ("+reason+")"); return MOD_RES_DENY; } return MOD_RES_PASSTHRU;