From: brain Date: Tue, 10 Jun 2008 23:14:32 +0000 (+0000) Subject: Add deop protection for services, bug #554 X-Git-Tag: v2.0.23~3038 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=007ce21b595a4bed48a7f4146946566dd6aa7a39;p=user%2Fhenk%2Fcode%2Finspircd.git Add deop protection for services, bug #554 git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9884 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index d79e40bef..cb4f0e1af 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -48,8 +48,8 @@ class ModuleServProtectMode : public Module bm = new ServProtectMode(ServerInstance); if (!ServerInstance->Modes->AddMode(bm)) throw ModuleException("Could not add new modes!"); - Implementation eventlist[] = { I_OnWhois, I_OnKill, I_OnWhoisLine }; - ServerInstance->Modules->Attach(eventlist, this, 3); + Implementation eventlist[] = { I_OnWhois, I_OnKill, I_OnWhoisLine, I_OnRawMode }; + ServerInstance->Modules->Attach(eventlist, this, 4); } @@ -72,6 +72,23 @@ class ModuleServProtectMode : public Module } } + virtual int OnRawMode(User* user, Channel* chan, const char mode, const std::string ¶m, bool adding, int pcnt, bool servermode) + { + if (!servermode && (mode == 'o') && !adding && chan && IS_LOCAL(user) && !ServerInstance->ULine(user->server)) + { + User *u = ServerInstance->FindNick(param); + if (u) + { + if (u->IsModeSet('k')) + { + user->WriteNumeric(482, "%s %s :You are not permitted to deop %s services", user->nick.c_str(), chan->name.c_str(), ServerInstance->Config->Network); + return ACR_DENY; + } + } + } + return 0; + } + virtual int OnKill(User* src, User* dst, const std::string &reason) { if (src == NULL) @@ -79,7 +96,7 @@ class ModuleServProtectMode : public Module if (dst->IsModeSet('k')) { - src->WriteNumeric(485, "%s :You are not allowed to kill %s Services!", src->nick.c_str(), ServerInstance->Config->Network); + src->WriteNumeric(485, "%s :You are not permitted to kill %s services!", src->nick.c_str(), ServerInstance->Config->Network); ServerInstance->SNO->WriteToSnoMask('A', std::string(src->nick)+" tried to kill service "+dst->nick+" ("+reason+")"); return 1; }