mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-13 12:39:05 -04:00
Stripcolor not finished yet.
Add security check into censor and botmode (om you will need this in cloaking) which prevents non-opers from changing other users modes git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4213 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
0b5f8887db
commit
6dfc984709
@ -32,6 +32,10 @@ class BotMode : public ModeHandler
|
||||
|
||||
ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
|
||||
{
|
||||
/* Only opers can change other users modes */
|
||||
if ((source != dest) && (!*source->oper))
|
||||
return MODEACTION_DENY;
|
||||
|
||||
if (adding)
|
||||
{
|
||||
if (!dest->IsModeSet('B'))
|
||||
|
@ -43,6 +43,10 @@ class CensorUser : public ModeHandler
|
||||
|
||||
ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
|
||||
{
|
||||
/* Only opers can change other users modes */
|
||||
if ((source != dest) && (!*source->oper))
|
||||
return MODEACTION_DENY;
|
||||
|
||||
if (adding)
|
||||
{
|
||||
if (!dest->IsModeSet('G'))
|
||||
|
@ -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 ¶meter, 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 ¶meter, 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user