summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mode.cpp11
-rw-r--r--src/modules/m_customprefix.cpp10
2 files changed, 11 insertions, 10 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index cff625c46..fd25a9a9f 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -162,11 +162,20 @@ void ModeWatcher::AfterMode(User*, User*, Channel*, const std::string&, bool)
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(PrefixChar), prefixrank(Rank)
+ , prefix(PrefixChar)
+ , prefixrank(Rank)
+ , selfremove(true)
{
list = true;
}
+ModResult PrefixMode::AccessCheck(User* src, Channel*, std::string& value, bool adding)
+{
+ if (!adding && src->nick == value && selfremove)
+ return MOD_RES_ALLOW;
+ return MOD_RES_PASSTHRU;
+}
+
ModeAction PrefixMode::OnModeChange(User* source, User*, Channel* chan, std::string& parameter, bool adding)
{
User* target;
diff --git a/src/modules/m_customprefix.cpp b/src/modules/m_customprefix.cpp
index 1be9676b5..7e162c72a 100644
--- a/src/modules/m_customprefix.cpp
+++ b/src/modules/m_customprefix.cpp
@@ -23,7 +23,6 @@ class CustomPrefixMode : public PrefixMode
{
public:
reference<ConfigTag> tag;
- bool depriv;
CustomPrefixMode(Module* parent, ConfigTag* Tag)
: PrefixMode(parent, Tag->getString("name"), 0, Tag->getInt("rank"))
@@ -35,14 +34,7 @@ class CustomPrefixMode : public PrefixMode
mode = v.c_str()[0];
ranktoset = tag->getInt("ranktoset", prefixrank, prefixrank, UINT_MAX);
ranktounset = tag->getInt("ranktounset", ranktoset, ranktoset, UINT_MAX);
- depriv = tag->getBool("depriv", true);
- }
-
- ModResult AccessCheck(User* src, Channel*, std::string& value, bool adding)
- {
- if (!adding && src->nick == value && depriv)
- return MOD_RES_ALLOW;
- return MOD_RES_PASSTHRU;
+ selfremove = tag->getBool("depriv", true);
}
};