summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-13 17:22:34 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-13 17:22:34 +0000
commita07e365fe1833a47de95a1390a0c37d0664d8cce (patch)
tree6dd172be4747965f05f0ce8573d99bcd9acea76b /src/modules
parent7555c1801d81d2f8ac2d4b953135ff980037f6b4 (diff)
Add <blockcolor:allowchanops>, mirroring <stripcolor:allowchanops>.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7011 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_blockcolor.cpp41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp
index 24b3d7e9f..a40d4ebd3 100644
--- a/src/modules/m_blockcolor.cpp
+++ b/src/modules/m_blockcolor.cpp
@@ -52,21 +52,30 @@ class BlockColor : public ModeHandler
class ModuleBlockColour : public Module
{
-
+ bool AllowChanOps;
BlockColor *bc;
public:
ModuleBlockColour(InspIRCd* Me) : Module::Module(Me)
{
-
bc = new BlockColor(ServerInstance);
if (!ServerInstance->AddMode(bc, 'c'))
throw ModuleException("Could not add new modes!");
+
+ OnRehash(NULL, "");
}
void Implements(char* List)
{
- List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = 1;
+ List[I_OnRehash] = List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = 1;
+ }
+
+
+ virtual void OnRehash(userrec* user, const std::string &parameter)
+ {
+ ConfigReader Conf(ServerInstance);
+
+ AllowChanOps = Conf.ReadFlag("blockcolor", "allowchanops", 0);
}
virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
@@ -77,20 +86,22 @@ class ModuleBlockColour : public Module
if(c->IsModeSet('c'))
{
- /* Replace a strlcpy(), which ran even when +c wasn't set, with this (no copies at all) -- Om */
- for (std::string::iterator i = text.begin(); i != text.end(); i++)
+ if (!AllowChanOps || AllowChanOps && c->GetStatus(user) != STATUS_OP)
{
- switch (*i)
+ for (std::string::iterator i = text.begin(); i != text.end(); i++)
{
- case 2:
- case 3:
- case 15:
- case 21:
- case 22:
- case 31:
- user->WriteServ("404 %s %s :Can't send colours to channel (+c set)",user->nick, c->name);
- return 1;
- break;
+ switch (*i)
+ {
+ case 2:
+ case 3:
+ case 15:
+ case 21:
+ case 22:
+ case 31:
+ user->WriteServ("404 %s %s :Can't send colours to channel (+c set)",user->nick, c->name);
+ return 1;
+ break;
+ }
}
}
}