From 0b58bc2585ccc96219a238a9ef9ff73a125fa531 Mon Sep 17 00:00:00 2001 From: aquanight Date: Sun, 9 Mar 2008 18:34:17 +0000 Subject: [PATCH] Add support to m_censor and m_blockcaps, and tidy up the checks in {block,strip}color, and remove an uneeded abs() on the "flowing backwards" warning. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9071 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 2 +- src/modules/m_blockcaps.cpp | 5 +++++ src/modules/m_blockcolor.cpp | 30 ++++++++++++++++-------------- src/modules/m_censor.cpp | 7 +++++++ src/modules/m_stripcolor.cpp | 8 ++++++-- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 1681df2b5..73b483a42 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -680,7 +680,7 @@ int InspIRCd::Run() { if (TIME < OLDTIME) { - SNO->WriteToSnoMask('A', "\002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",abs(OLDTIME-TIME)); + SNO->WriteToSnoMask('A', "\002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",OLDTIME-TIME); } if ((TIME % 3600) == 0) diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index bcbc82cac..6414f4db7 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -82,6 +82,11 @@ public: Channel* c = (Channel*)dest; + if (CHANOPS_EXEMPT(ServerInstance, 'B') && c->GetStatus(user) == STATUS_OP) + { + return 0; + } + if (c->IsModeSet('B')) { int caps = 0; diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index 9fe5eb224..f10d50b74 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -67,25 +67,27 @@ class ModuleBlockColour : public Module if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user))) { Channel* c = (Channel*)dest; + + if (CHANOPS_EXEMPT(ServerInstance, 'c') && c->GetStatus(user) == STATUS_OP) + { + return 0; + } if(c->IsModeSet('c')) { - if (!CHANOPS_EXEMPT(ServerInstance, 'c') || CHANOPS_EXEMPT(ServerInstance, 'c') && c->GetStatus(user) != STATUS_OP) + for (std::string::iterator i = text.begin(); i != text.end(); i++) { - for (std::string::iterator i = text.begin(); i != text.end(); i++) + switch (*i) { - 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; - } + 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; } } } diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 94ac8d113..4eaf1e3b4 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -140,7 +140,14 @@ class ModuleCensor : public Module if (target_type == TYPE_USER) active = ((User*)dest)->IsModeSet('G'); else if (target_type == TYPE_CHANNEL) + { active = ((Channel*)dest)->IsModeSet('G'); + Channel* c = (Channel*)dest; + if (CHANOPS_EXEMPT(ServerInstance, 'G') && c->GetStatus(user) == STATUS_OP) + { + return 0; + } + } if (!active) return 0; diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index 17c0a2f30..094961ce0 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -153,8 +153,12 @@ class ModuleStripColor : public Module // 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 (!CHANOPS_EXEMPT(ServerInstance, 'S') || CHANOPS_EXEMPT(ServerInstance, 'S') && t->GetStatus(user) != STATUS_OP) - active = t->IsModeSet('S'); + if (CHANOPS_EXEMPT(ServerInstance, 'S') && t->GetStatus(user) == STATUS_OP) + { + return 0; + } + + active = t->IsModeSet('S'); } if (active) -- 2.39.5