diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-08-06 13:35:40 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-08-06 13:35:40 +0200 |
commit | 51da1d3b59c25af4931b998cc23e2066392e548e (patch) | |
tree | 7f04223551f1a475f304befc744776bfadad0d9a | |
parent | 00660293338f6a78278e52d05f6cf9a7ef9acc64 (diff) |
Pass prefix rank and prefix char to PrefixMode constructor
-rw-r--r-- | include/mode.h | 4 | ||||
-rw-r--r-- | src/mode.cpp | 4 | ||||
-rw-r--r-- | src/modes/cmode_o.cpp | 4 | ||||
-rw-r--r-- | src/modes/cmode_v.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_customprefix.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_ojoin.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_operprefix.cpp | 4 |
7 files changed, 11 insertions, 16 deletions
diff --git a/include/mode.h b/include/mode.h index ffa5308f3..3e30d5b88 100644 --- a/include/mode.h +++ b/include/mode.h @@ -344,8 +344,10 @@ class CoreExport PrefixMode : public ModeHandler * @param Creator The module creating this mode * @param Name The user-friendly one word name of the prefix mode, e.g.: "op", "voice" * @param ModeLetter The mode letter of this mode + * @param Rank Rank given by this prefix mode, see explanation above + * @param PrefixChar Prefix character, or 0 if the mode has no prefix character */ - PrefixMode(Module* Creator, const std::string& Name, char ModeLetter); + PrefixMode(Module* Creator, const std::string& Name, char ModeLetter, unsigned int Rank = 0, char PrefixChar = 0); /** * Handles setting and unsetting the prefix mode. diff --git a/src/mode.cpp b/src/mode.cpp index bd7adbd65..3fcfcbd51 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -182,9 +182,9 @@ void ModeParser::DisplayCurrentModes(User *user, User* targetuser, Channel* targ } } -PrefixMode::PrefixMode(Module* Creator, const std::string& Name, char ModeLetter) +PrefixMode::PrefixMode(Module* Creator, const std::string& Name, char ModeLetter, unsigned int Rank, char PrefixChar) : ModeHandler(Creator, Name, ModeLetter, PARAM_ALWAYS, MODETYPE_CHANNEL, MC_PREFIX) - , prefix(0), prefixrank(0) + , prefix(PrefixChar), prefixrank(Rank) { list = true; m_paramtype = TR_NICK; diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp index 496a32718..4325b94a3 100644 --- a/src/modes/cmode_o.cpp +++ b/src/modes/cmode_o.cpp @@ -23,9 +23,7 @@ #include "inspircd.h" #include "builtinmodes.h" -ModeChannelOp::ModeChannelOp() : PrefixMode(NULL, "op", 'o') +ModeChannelOp::ModeChannelOp() : PrefixMode(NULL, "op", 'o', OP_VALUE, '@') { - prefix = '@'; levelrequired = OP_VALUE; - prefixrank = OP_VALUE; } diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp index d6108a984..5ecc10c9d 100644 --- a/src/modes/cmode_v.cpp +++ b/src/modes/cmode_v.cpp @@ -23,9 +23,7 @@ #include "inspircd.h" #include "builtinmodes.h" -ModeChannelVoice::ModeChannelVoice() : PrefixMode(NULL, "voice", 'v') +ModeChannelVoice::ModeChannelVoice() : PrefixMode(NULL, "voice", 'v', VOICE_VALUE, '+') { - prefix = '+'; levelrequired = HALFOP_VALUE; - prefixrank = VOICE_VALUE; } diff --git a/src/modules/m_customprefix.cpp b/src/modules/m_customprefix.cpp index 65c2cbd31..f6f9a84f6 100644 --- a/src/modules/m_customprefix.cpp +++ b/src/modules/m_customprefix.cpp @@ -26,14 +26,13 @@ class CustomPrefixMode : public PrefixMode bool depriv; CustomPrefixMode(Module* parent, ConfigTag* Tag) - : PrefixMode(parent, Tag->getString("name"), 0) + : PrefixMode(parent, Tag->getString("name"), 0, Tag->getInt("rank")) , tag(Tag) { std::string v = tag->getString("prefix"); prefix = v.c_str()[0]; v = tag->getString("letter"); mode = v.c_str()[0]; - prefixrank = tag->getInt("rank"); levelrequired = tag->getInt("ranktoset", prefixrank); depriv = tag->getBool("depriv", true); } diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index 120715429..e3cbbbb41 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -87,11 +87,9 @@ class NetworkPrefix : public PrefixMode { public: NetworkPrefix(Module* parent, char NPrefix) - : PrefixMode(parent, "official-join", 'Y') + : PrefixMode(parent, "official-join", 'Y', NETWORK_VALUE, NPrefix) { - prefix = NPrefix; levelrequired = INT_MAX; - prefixrank = NETWORK_VALUE; } ModResult AccessCheck(User* source, Channel* channel, std::string ¶meter, bool adding) diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp index 3f05dd086..262c034db 100644 --- a/src/modules/m_operprefix.cpp +++ b/src/modules/m_operprefix.cpp @@ -29,12 +29,12 @@ class OperPrefixMode : public PrefixMode { public: - OperPrefixMode(Module* Creator) : PrefixMode(Creator, "operprefix", 'y') + OperPrefixMode(Module* Creator) + : PrefixMode(Creator, "operprefix", 'y', OPERPREFIX_VALUE) { std::string pfx = ServerInstance->Config->ConfValue("operprefix")->getString("prefix", "!"); prefix = pfx.empty() ? '!' : pfx[0]; levelrequired = INT_MAX; - prefixrank = OPERPREFIX_VALUE; } }; |