From fcd19d4de4b438f1762a2bbd2c90e6cc77ac46a2 Mon Sep 17 00:00:00 2001 From: w00t Date: Sat, 19 Jul 2008 11:11:59 +0000 Subject: Hook OnUserPreKick and disallow kick on +k users also git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10039 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_servprotect.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index 3aafda237..e9012ac31 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, I_OnRawMode }; - ServerInstance->Modules->Attach(eventlist, this, 4); + Implementation eventlist[] = { I_OnWhois, I_OnKill, I_OnWhoisLine, I_OnRawMode, I_OnUserPreKick }; + ServerInstance->Modules->Attach(eventlist, this, 5); } @@ -114,6 +114,17 @@ class ModuleServProtectMode : public Module return 0; } + virtual int OnUserPreKick(User *src, User *dst, Channel *c, const std::string &reason) + { + if (dst->IsModeSet('k')) + { + src->WriteNumeric(484, "%s %s :You are not permitted to kick services", src->nick.c_str(), c->name.c_str()); + return 1; + } + + return 0; + } + virtual int OnWhoisLine(User* src, User* dst, int &numeric, std::string &text) { return ((src != dst) && (numeric == 319) && dst->IsModeSet('k')); -- cgit v1.2.3