summaryrefslogtreecommitdiff
path: root/src/modules/m_override.cpp
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-08-04 15:37:39 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-08-04 15:37:39 +0000
commit333b19d80c2255044cefc67148a19c06e13695bf (patch)
treef5166644936167e72dba7b1cc1f2eed5dc713940 /src/modules/m_override.cpp
parenteed401b6ecb6e1b88ee8ca3aa4c0b4df491e2035 (diff)
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
Diffstat (limited to 'src/modules/m_override.cpp')
-rw-r--r--src/modules/m_override.cpp21
1 files changed, 19 insertions, 2 deletions
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 &parameter)
@@ -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"))