summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-10 11:33:56 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-10 11:33:56 +0000
commit7f4aa4e8d77a6e599b7f1bc33df4e12bbe440f1b (patch)
treec18b52be12f77093f6ea315fc194452ce6f6c019
parentde6e135ccedfbc5b563d183b57c27335beaa67c8 (diff)
Add <stripcolor:allowchanops> 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
-rw-r--r--docs/inspircd.conf.example3
-rw-r--r--src/modules/m_stripcolor.cpp29
2 files changed, 23 insertions, 9 deletions
diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example
index 62fd21dc2..defa19a18 100644
--- a/docs/inspircd.conf.example
+++ b/docs/inspircd.conf.example
@@ -1884,6 +1884,9 @@
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Strip colour module: Adds the channel mode +S
#<module name="m_stripcolor.so">
+#
+# Optionally, you can allow channel ops to bypass filtering. Defaults to no.
+# <stripcolor allowchanops="no">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# SILENCE module: Adds support for /SILENCE
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 &parameter)
+ {
+ 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;
}