summaryrefslogtreecommitdiff
path: root/src/modules/m_operprefix.cpp
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-10-24 17:38:39 +0200
committerattilamolnar <attilamolnar@hush.com>2012-11-12 21:33:44 +0100
commitfda5e8d0556dadd2840909bbbfda169de29a7ccb (patch)
tree06c8fc14dc0ebb75ebe66ab2ad8e89fad0e9791b /src/modules/m_operprefix.cpp
parent4a57d129fbbe9858f2a8c4d14cef7e0d78f08329 (diff)
m_operprefix Remove unused hooks, move module initialization to init()
Diffstat (limited to 'src/modules/m_operprefix.cpp')
-rw-r--r--src/modules/m_operprefix.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp
index 9808ab322..b0cb0e4e9 100644
--- a/src/modules/m_operprefix.cpp
+++ b/src/modules/m_operprefix.cpp
@@ -31,10 +31,11 @@
class OperPrefixMode : public ModeHandler
{
public:
- OperPrefixMode(Module* Creator, char pfx) : ModeHandler(Creator, "operprefix", 'y', PARAM_ALWAYS, MODETYPE_CHANNEL)
+ OperPrefixMode(Module* Creator) : ModeHandler(Creator, "operprefix", 'y', PARAM_ALWAYS, MODETYPE_CHANNEL)
{
+ std::string pfx = ServerInstance->Config->ConfValue("operprefix")->getString("prefix", "!");
list = true;
- prefix = pfx;
+ prefix = pfx.empty() ? '!' : pfx[0];
levelrequired = OPERPREFIX_VALUE;
m_paramtype = TR_NICK;
}
@@ -62,18 +63,19 @@ class OperPrefixMode : public ModeHandler
class ModuleOperPrefixMode : public Module
{
private:
- OperPrefixMode* opm;
+ OperPrefixMode opm;
public:
- ModuleOperPrefixMode() {
- ConfigReader Conf;
- std::string pfx = Conf.ReadValue("operprefix", "prefix", "!", 0, false);
+ ModuleOperPrefixMode()
+ : opm(this)
+ {
+ }
- opm = new OperPrefixMode(this, pfx[0]);
- if ((!ServerInstance->Modes->AddMode(opm)))
- throw ModuleException("Could not add a new mode!");
+ void init()
+ {
+ ServerInstance->Modules->AddService(opm);
- Implementation eventlist[] = { I_OnPostJoin, I_OnUserQuit, I_OnUserKick, I_OnUserPart, I_OnOper };
- ServerInstance->Modules->Attach(eventlist, this, 5);
+ Implementation eventlist[] = { I_OnPostJoin, I_OnOper };
+ ServerInstance->Modules->Attach(eventlist, this, 2);
}
void PushChanMode(Channel* channel, User* user)
@@ -114,7 +116,6 @@ class ModuleOperPrefixMode : public Module
~ModuleOperPrefixMode()
{
- delete opm;
}
Version GetVersion()