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:
brain 2006-07-09 13:41:29 +00:00
parent 0b5f8887db
commit 6dfc984709
3 changed files with 73 additions and 0 deletions

View File

@ -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'))

View File

@ -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'))

View File

@ -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;