From 7f4aa4e8d77a6e599b7f1bc33df4e12bbe440f1b Mon Sep 17 00:00:00 2001 From: w00t Date: Thu, 10 May 2007 11:33:56 +0000 Subject: Add to allow channel operators to bypass color stripping. Defaults to off. Added to example config. Closes bug #288 :) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6948 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_stripcolor.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index 3254d9895..e3a1c39da 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -85,16 +85,14 @@ class UserStripColor : public ModeHandler class ModuleStripColor : public Module { - - ConfigReader *Conf, *MyConf; - ChannelStripColor *csc; - UserStripColor *usc; + bool AllowChanOps; + ChannelStripColor *csc; + UserStripColor *usc; public: - ModuleStripColor(InspIRCd* Me) - : Module::Module(Me) + ModuleStripColor(InspIRCd* Me) : Module::Module(Me) { - + OnRehash(NULL, ""); usc = new UserStripColor(ServerInstance); csc = new ChannelStripColor(ServerInstance); @@ -105,7 +103,7 @@ class ModuleStripColor : public Module void Implements(char* List) { - List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = 1; + List[I_OnRehash] = List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = 1; } virtual ~ModuleStripColor() @@ -165,6 +163,13 @@ class ModuleStripColor : public Module } } } + + virtual void OnRehash(userrec* user, const std::string ¶meter) + { + ConfigReader Conf(ServerInstance); + + AllowChanOps = Conf.ReadFlag("stripcolor", "allowchanops", 0); + } virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { @@ -180,12 +185,18 @@ class ModuleStripColor : public Module else if (target_type == TYPE_CHANNEL) { chanrec* t = (chanrec*)dest; - active = t->IsModeSet('S'); + + // check if we allow ops to bypass filtering, if we do, check if they're opped accordingly. + // note: short circut logic here, don't wreck it. -- w00t + if (!AllowChanOps || AllowChanOps && t->GetStatus(user) != STATUS_OP) + active = t->IsModeSet('S'); } + if (active) { this->ReplaceLine(text); } + return 0; } -- cgit v1.2.3