From 333b19d80c2255044cefc67148a19c06e13695bf Mon Sep 17 00:00:00 2001 From: w00t Date: Mon, 4 Aug 2008 15:37:39 +0000 Subject: Add TOPIC overriding to m_override, requested by Namegduf. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10084 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_override.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index cee3e2ba7..0d208189b 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -37,8 +37,8 @@ class ModuleOverride : public Module ServerInstance->SNO->EnableSnomask('O', "OVERRIDE"); OverriddenMode = false; OverOps = OverDeops = OverVoices = OverDevoices = OverHalfops = OverDehalfops = 0; - Implementation eventlist[] = { I_OnRehash, I_OnAccessCheck, I_On005Numeric, I_OnUserPreJoin, I_OnUserPreKick, I_OnPostCommand }; - ServerInstance->Modules->Attach(eventlist, this, 6); + Implementation eventlist[] = { I_OnRehash, I_OnAccessCheck, I_On005Numeric, I_OnUserPreJoin, I_OnUserPreKick, I_OnPostCommand, I_OnLocalTopicChange }; + ServerInstance->Modules->Attach(eventlist, this, 7); } virtual void OnRehash(User* user, const std::string ¶meter) @@ -103,6 +103,23 @@ class ModuleOverride : public Module return false; } + + virtual int OnLocalTopicChange(User *source, Channel *channel, const std::string &topic) + { + if (IS_OPER(source) && CanOverride(source, "TOPIC")) + { + if (!channel->HasUser(source) || (channel->IsModeSet('t') && channel->GetStatus(source) < STATUS_HOP)) + { + ServerInstance->SNO->WriteToSnoMask('O',std::string(source->nick)+" Overrided a topic change on "+std::string(channel->name)); + } + + // Explicit allow + return -1; + } + + return 0; + } + virtual int OnUserPreKick(User* source, User* user, Channel* chan, const std::string &reason) { if (IS_OPER(source) && CanOverride(source,"KICK")) -- cgit v1.2.3