summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-09-01 14:25:15 +0200
committerattilamolnar <attilamolnar@hush.com>2013-09-11 12:10:07 +0200
commit34fa5627de0a0431ca76f34445c680a76a9a7dc5 (patch)
tree4b63f6ce49983e161051f70e066ecf9bf974cc88 /src/modules
parent537ad4740afdbc656326cce766d1818cf5811c37 (diff)
Create a base class for prefix modes
Move Channel::SetPrefix() into Membership
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_customprefix.cpp12
-rw-r--r--src/modules/m_ojoin.cpp12
-rw-r--r--src/modules/m_operprefix.cpp22
3 files changed, 8 insertions, 38 deletions
diff --git a/src/modules/m_customprefix.cpp b/src/modules/m_customprefix.cpp
index bda11e8b3..f0b6d88e3 100644
--- a/src/modules/m_customprefix.cpp
+++ b/src/modules/m_customprefix.cpp
@@ -19,17 +19,16 @@
#include "inspircd.h"
-class CustomPrefixMode : public ModeHandler
+class CustomPrefixMode : public PrefixMode
{
public:
reference<ConfigTag> tag;
bool depriv;
CustomPrefixMode(Module* parent, ConfigTag* Tag)
- : ModeHandler(parent, Tag->getString("name"), 0, PARAM_ALWAYS, MODETYPE_CHANNEL), tag(Tag)
+ : PrefixMode(parent, Tag->getString("name"), 0)
+ , tag(Tag)
{
- list = true;
- m_paramtype = TR_NICK;
std::string v = tag->getString("prefix");
prefix = v.c_str()[0];
v = tag->getString("letter");
@@ -45,11 +44,6 @@ class CustomPrefixMode : public ModeHandler
return MOD_RES_ALLOW;
return MOD_RES_PASSTHRU;
}
-
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
- {
- return MODEACTION_ALLOW;
- }
};
class ModuleCustomPrefix : public Module
diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp
index 54c7bfa73..0a5a57f40 100644
--- a/src/modules/m_ojoin.cpp
+++ b/src/modules/m_ojoin.cpp
@@ -84,16 +84,14 @@ class CommandOjoin : public SplitCommand
/** channel mode +Y
*/
-class NetworkPrefix : public ModeHandler
+class NetworkPrefix : public PrefixMode
{
public:
NetworkPrefix(Module* parent, char NPrefix)
- : ModeHandler(parent, "official-join", 'Y', PARAM_ALWAYS, MODETYPE_CHANNEL)
+ : PrefixMode(parent, "official-join", 'Y')
{
- list = true;
prefix = NPrefix;
levelrequired = INT_MAX;
- m_paramtype = TR_NICK;
prefixrank = NETWORK_VALUE;
}
@@ -106,12 +104,6 @@ class NetworkPrefix : public ModeHandler
return MOD_RES_PASSTHRU;
}
-
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
- {
- return MODEACTION_ALLOW;
- }
-
};
class ModuleOjoin : public Module
diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp
index 23390baea..3d2a34bdb 100644
--- a/src/modules/m_operprefix.cpp
+++ b/src/modules/m_operprefix.cpp
@@ -26,32 +26,16 @@
#define OPERPREFIX_VALUE 1000000
-class OperPrefixMode : public ModeHandler
+class OperPrefixMode : public PrefixMode
{
public:
- OperPrefixMode(Module* Creator) : ModeHandler(Creator, "operprefix", 'y', PARAM_ALWAYS, MODETYPE_CHANNEL)
+ OperPrefixMode(Module* Creator) : PrefixMode(Creator, "operprefix", 'y')
{
std::string pfx = ServerInstance->Config->ConfValue("operprefix")->getString("prefix", "!");
- list = true;
prefix = pfx.empty() ? '!' : pfx[0];
- levelrequired = OPERPREFIX_VALUE;
- m_paramtype = TR_NICK;
+ levelrequired = INT_MAX;
prefixrank = OPERPREFIX_VALUE;
}
-
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
- {
- if (IS_SERVER(source) || ServerInstance->ULine(source->server))
- return MODEACTION_ALLOW;
- else
- {
- if (channel)
- source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Only servers are permitted to change channel mode '%c'", source->nick.c_str(), channel->name.c_str(), 'y');
- return MODEACTION_DENY;
- }
- }
-
- bool NeedsOper() { return true; }
};
class ModuleOperPrefixMode;