diff options
-rw-r--r-- | include/mode.h | 7 | ||||
-rw-r--r-- | src/mode.cpp | 7 | ||||
-rw-r--r-- | src/modes/cmode_o.cpp | 6 | ||||
-rw-r--r-- | src/modes/cmode_v.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_customprefix.cpp | 13 | ||||
-rw-r--r-- | src/modules/m_ojoin.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_operprefix.cpp | 6 |
7 files changed, 15 insertions, 36 deletions
diff --git a/include/mode.h b/include/mode.h index 172b014de..3805b174b 100644 --- a/include/mode.h +++ b/include/mode.h @@ -155,6 +155,11 @@ class CoreExport ModeHandler : public ServiceProvider */ int levelrequired; + /** The prefix rank of this mode, used to compare prefix + * modes + */ + unsigned int prefixrank; + public: /** * The constructor for ModeHandler initalizes the mode handler. @@ -186,7 +191,7 @@ class CoreExport ModeHandler : public ServiceProvider * PrefixModeValue enum and Channel::GetPrefixValue() for * more information. */ - virtual unsigned int GetPrefixRank(); + unsigned int GetPrefixRank() const { return prefixrank; } /** * Returns the mode's type */ diff --git a/src/mode.cpp b/src/mode.cpp index ac0b111b1..2f56c3327 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -29,7 +29,7 @@ ModeHandler::ModeHandler(Module* Creator, const std::string& Name, char modeletter, ParamSpec Params, ModeType type) : ServiceProvider(Creator, Name, SERVICE_MODE), m_paramtype(TR_TEXT), parameters_taken(Params), mode(modeletter), prefix(0), oper(false), - list(false), m_type(type), levelrequired(HALFOP_VALUE) + list(false), m_type(type), levelrequired(HALFOP_VALUE), prefixrank(0) { } @@ -44,11 +44,6 @@ ModeHandler::~ModeHandler() { } -unsigned int ModeHandler::GetPrefixRank() -{ - return 0; -} - int ModeHandler::GetNumParams(bool adding) { switch (parameters_taken) diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp index f0a729480..d500f23b1 100644 --- a/src/modes/cmode_o.cpp +++ b/src/modes/cmode_o.cpp @@ -34,11 +34,7 @@ ModeChannelOp::ModeChannelOp() : ModeHandler(NULL, "op", 'o', PARAM_ALWAYS, MODE prefix = '@'; levelrequired = OP_VALUE; m_paramtype = TR_NICK; -} - -unsigned int ModeChannelOp::GetPrefixRank() -{ - return OP_VALUE; + prefixrank = OP_VALUE; } ModeAction ModeChannelOp::OnModeChange(User* source, User*, Channel* channel, std::string ¶meter, bool adding) diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp index 867c13243..fe62c407f 100644 --- a/src/modes/cmode_v.cpp +++ b/src/modes/cmode_v.cpp @@ -34,11 +34,7 @@ ModeChannelVoice::ModeChannelVoice() : ModeHandler(NULL, "voice", 'v', PARAM_ALW prefix = '+'; levelrequired = HALFOP_VALUE; m_paramtype = TR_NICK; -} - -unsigned int ModeChannelVoice::GetPrefixRank() -{ - return VOICE_VALUE; + prefixrank = VOICE_VALUE; } ModeAction ModeChannelVoice::OnModeChange(User* source, User*, Channel* channel, std::string ¶meter, bool adding) diff --git a/src/modules/m_customprefix.cpp b/src/modules/m_customprefix.cpp index 67d1d2fe9..d627bbb96 100644 --- a/src/modules/m_customprefix.cpp +++ b/src/modules/m_customprefix.cpp @@ -25,8 +25,8 @@ class CustomPrefixMode : public ModeHandler { public: reference<ConfigTag> tag; - int rank; bool depriv; + CustomPrefixMode(Module* parent, ConfigTag* Tag) : ModeHandler(parent, Tag->getString("name"), 0, PARAM_ALWAYS, MODETYPE_CHANNEL), tag(Tag) { @@ -36,16 +36,11 @@ class CustomPrefixMode : public ModeHandler prefix = v.c_str()[0]; v = tag->getString("letter"); mode = v.c_str()[0]; - rank = tag->getInt("rank"); - levelrequired = tag->getInt("ranktoset", rank); + prefixrank = tag->getInt("rank"); + levelrequired = tag->getInt("ranktoset", prefixrank); depriv = tag->getBool("depriv", true); } - unsigned int GetPrefixRank() - { - return rank; - } - ModResult AccessCheck(User* src, Channel*, std::string& value, bool adding) { if (!adding && src->nick == value && depriv) @@ -72,7 +67,7 @@ class ModuleCustomPrefix : public Module tags.first++; CustomPrefixMode* mh = new CustomPrefixMode(this, tag); modes.push_back(mh); - if (mh->rank <= 0) + if (mh->GetPrefixRank() == 0) throw ModuleException("Rank must be specified for prefix at " + tag->getTagLocation()); if (!isalpha(mh->GetModeChar())) throw ModuleException("Mode must be a letter for prefix at " + tag->getTagLocation()); diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index ff92f3fae..999cd5b64 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -110,11 +110,7 @@ class NetworkPrefix : public ModeHandler prefix = NPrefix; levelrequired = INT_MAX; m_paramtype = TR_NICK; - } - - unsigned int GetPrefixRank() - { - return NETWORK_VALUE; + 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 d061a5eab..9c15cf5b2 100644 --- a/src/modules/m_operprefix.cpp +++ b/src/modules/m_operprefix.cpp @@ -38,11 +38,7 @@ class OperPrefixMode : public ModeHandler prefix = pfx.empty() ? '!' : pfx[0]; levelrequired = OPERPREFIX_VALUE; m_paramtype = TR_NICK; - } - - unsigned int GetPrefixRank() - { - return OPERPREFIX_VALUE; + prefixrank = OPERPREFIX_VALUE; } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) |