summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/builtinmodes.h4
-rw-r--r--include/mode.h19
2 files changed, 15 insertions, 8 deletions
diff --git a/include/builtinmodes.h b/include/builtinmodes.h
index bfb46823f..922a86f0e 100644
--- a/include/builtinmodes.h
+++ b/include/builtinmodes.h
@@ -66,7 +66,7 @@ class ModeChannelOp : public PrefixMode
ModeChannelOp()
: PrefixMode(NULL, "op", 'o', OP_VALUE, '@')
{
- levelrequired = OP_VALUE;
+ ranktoset = ranktounset = OP_VALUE;
}
};
@@ -78,7 +78,7 @@ class ModeChannelVoice : public PrefixMode
ModeChannelVoice()
: PrefixMode(NULL, "voice", 'v', VOICE_VALUE, '+')
{
- levelrequired = HALFOP_VALUE;
+ ranktoset = ranktounset = HALFOP_VALUE;
}
};
diff --git a/include/mode.h b/include/mode.h
index ec293e497..5cfbe4015 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -148,10 +148,11 @@ class CoreExport ModeHandler : public ServiceProvider
*/
const Class type_id;
- /** The prefix char needed on channel to use this mode,
- * only checked for channel modes
- */
- int levelrequired;
+ /** The prefix rank required to set this mode on channels. */
+ unsigned int ranktoset;
+
+ /** The prefix rank required to unset this mode on channels. */
+ unsigned int ranktounset;
public:
/**
@@ -320,7 +321,13 @@ class CoreExport ModeHandler : public ServiceProvider
*/
virtual void RemoveMode(Channel* channel, Modes::ChangeList& changelist);
- inline unsigned int GetLevelRequired() const { return levelrequired; }
+ /** Retrieves the level required to modify this mode.
+ * @param adding Whether the mode is being added or removed.
+ */
+ inline unsigned int GetLevelRequired(bool adding) const
+ {
+ return adding ? ranktoset : ranktounset;
+ }
friend class ModeParser;
};
@@ -616,7 +623,7 @@ class CoreExport ModeParser : public fakederef<ModeParser>
/** If this flag is set then the mode change will be subject to access checks.
* For more information see the documentation of the PrefixMode class,
- * ModeHandler::levelrequired and ModeHandler::AccessCheck().
+ * ModeHandler::ranktoset and ModeHandler::AccessCheck().
* Modules may explicitly allow a mode change regardless of this flag by returning
* MOD_RES_ALLOW from the OnPreMode hook. Only affects channel mode changes.
*/