summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mode.h8
-rw-r--r--src/inspircd.cpp1
-rw-r--r--src/mode.cpp29
3 files changed, 16 insertions, 22 deletions
diff --git a/include/mode.h b/include/mode.h
index 1dab442d4..de8d4c5f8 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -445,9 +445,6 @@ class CoreExport ModeParser
unsigned int seq;
public:
-
- /** The constructor initializes all the RFC basic modes by using ModeParserAddMode().
- */
ModeParser();
~ModeParser();
@@ -455,6 +452,11 @@ class CoreExport ModeParser
* for example, should 'user A' be able to 'op' on 'channel B'.
*/
User* SanityChecks(User *user,const char *dest,Channel *chan,int status);
+
+ /** Initialize all built-in modes
+ */
+ static void InitBuiltinModes();
+
/** Tidy a banmask. This makes a banmask 'acceptable' if fields are left out.
* E.g.
*
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index b3c4ca27d..bac96b2d6 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -516,6 +516,7 @@ InspIRCd::InspIRCd(int argc, char** argv) :
this->Config->Read();
this->Config->Apply(NULL, "");
Logs->OpenFileLogs();
+ ModeParser::InitBuiltinModes();
this->Res = new DNS();
diff --git a/src/mode.cpp b/src/mode.cpp
index bbd29c621..8cf04ef08 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -933,28 +933,21 @@ struct builtin_modes
ModeUserOperator uo;
ModeUserServerNoticeMask us;
- void init(ModeParser* modes)
- {
- modes->AddMode(&s);
- modes->AddMode(&p);
- modes->AddMode(&m);
- modes->AddMode(&t);
- modes->AddMode(&n);
- modes->AddMode(&i);
- modes->AddMode(&k);
- modes->AddMode(&l);
- modes->AddMode(&b);
- modes->AddMode(&o);
- modes->AddMode(&v);
- modes->AddMode(&uw);
- modes->AddMode(&ui);
- modes->AddMode(&uo);
- modes->AddMode(&us);
+ void init()
+ {
+ ServiceProvider* modes[] = { &s, &p, &m, &t, &n, &i, &k, &l, &b, &o, &v,
+ &uw, &ui, &uo, &us };
+ ServerInstance->Modules->AddServices(modes, sizeof(modes)/sizeof(ServiceProvider*));
}
};
static builtin_modes static_modes;
+void ModeParser::InitBuiltinModes()
+{
+ static_modes.init();
+}
+
ModeParser::ModeParser()
{
/* Clear mode handler list */
@@ -965,8 +958,6 @@ ModeParser::ModeParser()
seq = 0;
memset(&sent, 0, sizeof(sent));
-
- static_modes.init(this);
}
ModeParser::~ModeParser()