summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/m_botmode.cpp4
-rw-r--r--src/modules/m_censor.cpp4
-rw-r--r--src/modules/m_stripcolor.cpp65
3 files changed, 73 insertions, 0 deletions
diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp
index f56db1e8b..57ab1e91c 100644
--- a/src/modules/m_botmode.cpp
+++ b/src/modules/m_botmode.cpp
@@ -32,6 +32,10 @@ class BotMode : public ModeHandler
ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
{
+ /* Only opers can change other users modes */
+ if ((source != dest) && (!*source->oper))
+ return MODEACTION_DENY;
+
if (adding)
{
if (!dest->IsModeSet('B'))
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp
index d1e864419..69db8bbe6 100644
--- a/src/modules/m_censor.cpp
+++ b/src/modules/m_censor.cpp
@@ -43,6 +43,10 @@ class CensorUser : public ModeHandler
ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
{
+ /* Only opers can change other users modes */
+ if ((source != dest) && (!*source->oper))
+ return MODEACTION_DENY;
+
if (adding)
{
if (!dest->IsModeSet('G'))
diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp
index 1b8f8c72d..485f05c14 100644
--- a/src/modules/m_stripcolor.cpp
+++ b/src/modules/m_stripcolor.cpp
@@ -25,6 +25,71 @@ using namespace std;
/* $ModDesc: Provides channel +S mode (strip ansi colour) */
+class ChannelStripColor : public ModeHandler
+{
+ public:
+ StripColor() : ModeHandler('S', 0, 0, false, MODETYPE_CHANNEL, false) { }
+
+ ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
+ {
+ /* Only opers can change other users modes */
+ if ((source != dest) && (!*source->oper))
+ return MODEACTION_DENY;
+
+ if (adding)
+ {
+ if (!channel->IsModeSet('S'))
+ {
+ channel->SetMode('S',true);
+ return MODEACTION_ALLOW;
+ }
+ }
+ else
+ {
+ if (channel->IsModeSet('S'))
+ {
+ channel->SetMode('S',false);
+ return MODEACTION_ALLOW;
+ }
+ }
+
+ return MODEACTION_DENY;
+ }
+};
+
+class UserStripColor : public ModeHandler
+{
+ public:
+ StripColor() : ModeHandler('S', 0, 0, false, MODETYPE_USER, false) { }
+
+ ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
+ {
+ /* Only opers can change other users modes */
+ if ((source != dest) && (!*source->oper))
+ return MODEACTION_DENY;
+
+ if (adding)
+ {
+ if (!dest->IsModeSet('S'))
+ {
+ dest->SetMode('S',true);
+ return MODEACTION_ALLOW;
+ }
+ }
+ else
+ {
+ if (dest->IsModeSet('S'))
+ {
+ dest->SetMode('S',false);
+ return MODEACTION_ALLOW;
+ }
+ }
+
+ return MODEACTION_DENY;
+ }
+};
+
+
class ModuleStripColor : public Module
{
Server *Srv;