diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-05-01 16:12:45 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-05-01 16:12:45 +0000 |
commit | f3abcf2bcfe36d3389b74caa9eef8582901fbe15 (patch) | |
tree | 2ebd9c1c6615939d850cf95866e9e982cb2b18d1 | |
parent | 61416a1885d1490550175b6a73b724ba0843d729 (diff) |
Simple user/channel mode patch
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9596 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/mode.h | 26 | ||||
-rw-r--r-- | src/mode.cpp | 65 | ||||
-rw-r--r-- | src/modules/m_blockcaps.cpp | 26 | ||||
-rw-r--r-- | src/modules/m_blockcolor.cpp | 26 | ||||
-rw-r--r-- | src/modules/m_botmode.cpp | 26 | ||||
-rw-r--r-- | src/modules/m_callerid.cpp | 14 | ||||
-rw-r--r-- | src/modules/m_censor.cpp | 52 | ||||
-rw-r--r-- | src/modules/m_helpop.cpp | 26 | ||||
-rw-r--r-- | src/modules/m_knock.cpp | 26 | ||||
-rw-r--r-- | src/modules/m_noinvite.cpp | 26 | ||||
-rw-r--r-- | src/modules/m_nokicks.cpp | 26 | ||||
-rw-r--r-- | src/modules/m_nonotice.cpp | 26 | ||||
-rw-r--r-- | src/modules/m_services.cpp | 78 | ||||
-rw-r--r-- | src/modules/m_services_account.cpp | 78 | ||||
-rw-r--r-- | src/modules/m_stripcolor.cpp | 56 |
15 files changed, 129 insertions, 448 deletions
diff --git a/include/mode.h b/include/mode.h index e15ddeeb0..dcd8cc004 100644 --- a/include/mode.h +++ b/include/mode.h @@ -293,6 +293,32 @@ class CoreExport ModeHandler : public Extensible void SetNeededPrefix(char needsprefix); }; +/** A prebuilt mode handler which handles a simple user mode, e.g. no parameters, usable by any user, with no extra + * behaviour to the mode beyond the basic setting and unsetting of the mode, not allowing the mode to be set if it + * is already set and not allowing it to be unset if it is already unset. + * An example of a simple user mode is user mode +w. + */ +class CoreExport SimpleUserModeHandler : public ModeHandler +{ + public: + SimpleUserModeHandler(InspIRCd* Instance, char modeletter); + virtual ~SimpleUserModeHandler(); + virtual ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode = false); +}; + +/** A prebuilt mode handler which handles a simple channel mode, e.g. no parameters, usable by any user, with no extra + * behaviour to the mode beyond the basic setting and unsetting of the mode, not allowing the mode to be set if it + * is already set and not allowing it to be unset if it is already unset. + * An example of a simple channel mode is channel mode +s. + */ +class CoreExport SimpleChannelModeHandler : public ModeHandler +{ + public: + SimpleChannelModeHandler(InspIRCd* Instance, char modeletter); + virtual ~SimpleChannelModeHandler(); + virtual ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode = false); +}; + /** * The ModeWatcher class can be used to alter the behaviour of a mode implemented * by the core or by another module. To use ModeWatcher, derive a class from it, diff --git a/src/mode.cpp b/src/mode.cpp index e5efaffdf..91a64f89b 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -149,6 +149,71 @@ bool ModeHandler::CheckTimeStamp(time_t theirs, time_t ours, const std::string&, return (ours < theirs); } +SimpleUserModeHandler::SimpleUserModeHandler(InspIRCd* Instance, char modeletter) : ModeHandler(Instance, modeletter, 0, 0, false, MODETYPE_USER, false) +{ +} + +SimpleUserModeHandler::~SimpleUserModeHandler() +{ +} + +SimpleChannelModeHandler::~SimpleChannelModeHandler() +{ +} + +SimpleChannelModeHandler::SimpleChannelModeHandler(InspIRCd* Instance, char modeletter) : ModeHandler(Instance, modeletter, 0, 0, false, MODETYPE_CHANNEL, false) +{ +} + +ModeAction SimpleUserModeHandler::OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode) +{ + /* Only opers can change other users modes */ + if (source != dest) + return MODEACTION_DENY; + + if (adding) + { + if (!dest->IsModeSet(this->GetModeChar())) + { + dest->SetMode(this->GetModeChar(),true); + return MODEACTION_ALLOW; + } + } + else + { + if (dest->IsModeSet(this->GetModeChar())) + { + dest->SetMode(this->GetModeChar(),false); + return MODEACTION_ALLOW; + } + } + + return MODEACTION_DENY; +} + + +ModeAction SimpleChannelModeHandler::OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode) +{ + if (adding) + { + if (!channel->IsModeSet(this->GetModeChar())) + { + channel->SetMode(this->GetModeChar(),true); + return MODEACTION_ALLOW; + } + } + else + { + if (channel->IsModeSet(this->GetModeChar())) + { + channel->SetMode(this->GetModeChar(),false); + return MODEACTION_ALLOW; + } + } + + return MODEACTION_DENY; +} + ModeWatcher::ModeWatcher(InspIRCd* Instance, char modeletter, ModeType type) : ServerInstance(Instance), mode(modeletter), m_type(type) { } diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index c229ef752..3e8fdccc5 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -18,32 +18,10 @@ /** Handles the +P channel mode */ -class BlockCaps : public ModeHandler +class BlockCaps : public SimpleChannelModeHandler { public: - BlockCaps(InspIRCd* Instance) : ModeHandler(Instance, 'B', 0, 0, false, MODETYPE_CHANNEL, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!channel->IsModeSet('B')) - { - channel->SetMode('B',true); - return MODEACTION_ALLOW; - } - } - else - { - if (channel->IsModeSet('B')) - { - channel->SetMode('B',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + BlockCaps(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'B') { } }; class ModuleBlockCAPS : public Module diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index a6a255e23..3e97f8287 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -17,32 +17,10 @@ /** Handles the +c channel mode */ -class BlockColor : public ModeHandler +class BlockColor : public SimpleChannelModeHandler { public: - BlockColor(InspIRCd* Instance) : ModeHandler(Instance, 'c', 0, 0, false, MODETYPE_CHANNEL, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!channel->IsModeSet('c')) - { - channel->SetMode('c',true); - return MODEACTION_ALLOW; - } - } - else - { - if (channel->IsModeSet('c')) - { - channel->SetMode('c',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + BlockColor(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'c') { } }; class ModuleBlockColour : public Module diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index 2bf683fa9..7cc050403 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -17,32 +17,10 @@ /** Handles user mode +B */ -class BotMode : public ModeHandler +class BotMode : public SimpleUserModeHandler { public: - BotMode(InspIRCd* Instance) : ModeHandler(Instance, 'B', 0, 0, false, MODETYPE_USER, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!dest->IsModeSet('B')) - { - dest->SetMode('B',true); - return MODEACTION_ALLOW; - } - } - else - { - if (dest->IsModeSet('B')) - { - dest->SetMode('B',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + BotMode(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'B') { } }; class ModuleBotMode : public Module diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index e3dc6b353..a33b493b1 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -59,22 +59,12 @@ void RemoveFromAllAccepts(InspIRCd* ServerInstance, User* who) } } -class User_g : public ModeHandler +class User_g : public SimpleUserModeHandler { private: public: - User_g(InspIRCd* Instance) : ModeHandler(Instance, 'g', 0, 0, false, MODETYPE_USER, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding != dest->IsModeSet('g')) - { - dest->SetMode('g', adding); - return MODEACTION_ALLOW; - } - return MODEACTION_DENY; - } + User_g(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'g') { } }; class CommandAccept : public Command diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index b4746d936..93fe3ae3b 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -22,62 +22,18 @@ typedef std::map<irc::string,irc::string> censor_t; /** Handles usermode +G */ -class CensorUser : public ModeHandler +class CensorUser : public SimpleUserModeHandler { public: - CensorUser(InspIRCd* Instance) : ModeHandler(Instance, 'G', 0, 0, false, MODETYPE_USER, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!dest->IsModeSet('G')) - { - dest->SetMode('G',true); - return MODEACTION_ALLOW; - } - } - else - { - if (dest->IsModeSet('G')) - { - dest->SetMode('G',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + CensorUser(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'G') { } }; /** Handles channel mode +G */ -class CensorChannel : public ModeHandler +class CensorChannel : public SimpleChannelModeHandler { public: - CensorChannel(InspIRCd* Instance) : ModeHandler(Instance, 'G', 0, 0, false, MODETYPE_CHANNEL, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!channel->IsModeSet('G')) - { - channel->SetMode('G',true); - return MODEACTION_ALLOW; - } - } - else - { - if (channel->IsModeSet('G')) - { - channel->SetMode('G',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + CensorChannel(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'G') { } }; class ModuleCensor : public Module diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index eb64d4f48..3ed172644 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -19,32 +19,10 @@ static std::map<irc::string, std::string> helpop_map; /** Handles user mode +h */ -class Helpop : public ModeHandler +class Helpop : public SimpleUserModeHandler { public: - Helpop(InspIRCd* Instance) : ModeHandler(Instance, 'h', 0, 0, false, MODETYPE_USER, true) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!dest->IsModeSet('h')) - { - dest->SetMode('h',true); - return MODEACTION_ALLOW; - } - } - else - { - if (dest->IsModeSet('h')) - { - dest->SetMode('h',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + Helpop(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'h') { } }; /** Handles /HELPOP diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 3d2f4b344..82b76c02b 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -70,32 +70,10 @@ class CommandKnock : public Command /** Handles channel mode +K */ -class Knock : public ModeHandler +class Knock : public SimpleChannelModeHandler { public: - Knock(InspIRCd* Instance) : ModeHandler(Instance, 'K', 0, 0, false, MODETYPE_CHANNEL, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!channel->IsModeSet('K')) - { - channel->SetMode('K',true); - return MODEACTION_ALLOW; - } - } - else - { - if (channel->IsModeSet('K')) - { - channel->SetMode('K',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + Knock(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'K') { } }; class ModuleKnock : public Module diff --git a/src/modules/m_noinvite.cpp b/src/modules/m_noinvite.cpp index efa0af0e1..e27ed6f04 100644 --- a/src/modules/m_noinvite.cpp +++ b/src/modules/m_noinvite.cpp @@ -15,32 +15,10 @@ /* $ModDesc: Provides support for unreal-style channel mode +V */ -class NoInvite : public ModeHandler +class NoInvite : public SimpleChannelModeHandler { public: - NoInvite(InspIRCd* Instance) : ModeHandler(Instance, 'V', 0, 0, false, MODETYPE_CHANNEL, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!channel->IsModeSet('V')) - { - channel->SetMode('V',true); - return MODEACTION_ALLOW; - } - } - else - { - if (channel->IsModeSet('V')) - { - channel->SetMode('V',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + NoInvite(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'V') { } }; class ModuleNoInvite : public Module diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index 0806b2d56..9daa4c66b 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -15,32 +15,10 @@ /* $ModDesc: Provides support for unreal-style channel mode +Q */ -class NoKicks : public ModeHandler +class NoKicks : public SimpleChannelModeHandler { public: - NoKicks(InspIRCd* Instance) : ModeHandler(Instance, 'Q', 0, 0, false, MODETYPE_CHANNEL, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!channel->IsModeSet('Q')) - { - channel->SetMode('Q',true); - return MODEACTION_ALLOW; - } - } - else - { - if (channel->IsModeSet('Q')) - { - channel->SetMode('Q',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + NoKicks(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'Q') { } }; class ModuleNoKicks : public Module diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index 52ddb537d..1e88a4cc0 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -15,32 +15,10 @@ /* $ModDesc: Provides support for unreal-style channel mode +T */ -class NoNotice : public ModeHandler +class NoNotice : public SimpleChannelModeHandler { public: - NoNotice(InspIRCd* Instance) : ModeHandler(Instance, 'T', 0, 0, false, MODETYPE_CHANNEL, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!channel->IsModeSet('T')) - { - channel->SetMode('T',true); - return MODEACTION_ALLOW; - } - } - else - { - if (channel->IsModeSet('T')) - { - channel->SetMode('T',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + NoNotice(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'T') { } }; class ModuleNoNotice : public Module diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp index 5b39de931..669a87aeb 100644 --- a/src/modules/m_services.cpp +++ b/src/modules/m_services.cpp @@ -70,92 +70,26 @@ class User_r : public ModeHandler /** Channel mode +R - registered users only */ -class Channel_R : public ModeHandler +class Channel_R : public SimpleChannelModeHandler { public: - Channel_R(InspIRCd* Instance) : ModeHandler(Instance, 'R', 0, 0, false, MODETYPE_CHANNEL, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!channel->IsModeSet('R')) - { - channel->SetMode('R',true); - return MODEACTION_ALLOW; - } - } - else - { - if (channel->IsModeSet('R')) - { - channel->SetMode('R',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + Channel_R(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'R') { } }; /** User mode +R - only allow PRIVMSG and NOTICE from registered users */ -class User_R : public ModeHandler +class User_R : public SimpleUserModeHandler { public: - User_R(InspIRCd* Instance) : ModeHandler(Instance, 'R', 0, 0, false, MODETYPE_USER, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!dest->IsModeSet('R')) - { - dest->SetMode('R',true); - return MODEACTION_ALLOW; - } - } - else - { - if (dest->IsModeSet('R')) - { - dest->SetMode('R',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + User_R(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'R') { } }; /** Channel mode +M - only allow privmsg and notice to channel from registered users */ -class Channel_M : public ModeHandler +class Channel_M : public SimpleChannelModeHandler { public: - Channel_M(InspIRCd* Instance) : ModeHandler(Instance, 'M', 0, 0, false, MODETYPE_CHANNEL, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!channel->IsModeSet('M')) - { - channel->SetMode('M',true); - return MODEACTION_ALLOW; - } - } - else - { - if (channel->IsModeSet('M')) - { - channel->SetMode('M',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + Channel_M(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'M') { } }; /** Dreamnforge-like services support diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 70539ddde..3ac333b37 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -18,92 +18,26 @@ /** Channel mode +R - unidentified users cannot join */ -class AChannel_R : public ModeHandler +class AChannel_R : public SimpleChannelModeHandler { public: - AChannel_R(InspIRCd* Instance) : ModeHandler(Instance, 'R', 0, 0, false, MODETYPE_CHANNEL, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!channel->IsModeSet('R')) - { - channel->SetMode('R',true); - return MODEACTION_ALLOW; - } - } - else - { - if (channel->IsModeSet('R')) - { - channel->SetMode('R',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + AChannel_R(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'R') { } }; /** User mode +R - unidentified users cannot message */ -class AUser_R : public ModeHandler +class AUser_R : public SimpleUserModeHandler { public: - AUser_R(InspIRCd* Instance) : ModeHandler(Instance, 'R', 0, 0, false, MODETYPE_USER, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!dest->IsModeSet('R')) - { - dest->SetMode('R',true); - return MODEACTION_ALLOW; - } - } - else - { - if (dest->IsModeSet('R')) - { - dest->SetMode('R',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + AUser_R(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'R') { } }; /** Channel mode +M - unidentified users cannot message channel */ -class AChannel_M : public ModeHandler +class AChannel_M : public SimpleChannelModeHandler { public: - AChannel_M(InspIRCd* Instance) : ModeHandler(Instance, 'M', 0, 0, false, MODETYPE_CHANNEL, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) - { - if (adding) - { - if (!channel->IsModeSet('M')) - { - channel->SetMode('M',true); - return MODEACTION_ALLOW; - } - } - else - { - if (channel->IsModeSet('M')) - { - channel->SetMode('M',false); - return MODEACTION_ALLOW; - } - } - - return MODEACTION_DENY; - } + AChannel_M(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'M') { } }; class ModuleServicesAccount : public Module diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index eb32c60b3..420e2e6e2 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -17,66 +17,18 @@ /** Handles channel mode +S */ -class ChannelStripColor : public ModeHandler +class ChannelStripColor : public SimpleChannelModeHandler { public: - ChannelStripColor(InspIRCd* Instance) : ModeHandler(Instance, 'S', 0, 0, false, MODETYPE_CHANNEL, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode) - { - 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; - } + ChannelStripColor(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'S') { } }; /** Handles user mode +S */ -class UserStripColor : public ModeHandler +class UserStripColor : public SimpleUserModeHandler { public: - UserStripColor(InspIRCd* Instance) : ModeHandler(Instance, 'S', 0, 0, false, MODETYPE_USER, false) { } - - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode) - { - /* Only opers can change other users modes */ - if (source != dest) - 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; - } + UserStripColor(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'S') { } }; |