diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-06-10 23:14:32 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-06-10 23:14:32 +0000 |
commit | 007ce21b595a4bed48a7f4146946566dd6aa7a39 (patch) | |
tree | 9af158ea6401f2119237de9c6bbbce3fd5e6acca /src/modules | |
parent | d3fb3fd284d0b08c9f4fa48acc0029709685e54a (diff) |
Add deop protection for services, bug #554
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9884 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_servprotect.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
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; } |