diff options
author | attilamolnar <attilamolnar@hush.com> | 2012-10-13 03:12:29 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2012-12-02 19:39:46 +0100 |
commit | ac7defcd3e52695dcf5e5150e9fe3e1624205e64 (patch) | |
tree | da428a276376986ca64390d5cf5662083f8197c6 | |
parent | 6dd61235fc8cb67ba9919b84be42c966b7273fac (diff) |
Attach to events and register services in init()
111 files changed, 379 insertions, 60 deletions
diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp index c7cb8efb4..fa3b738ba 100644 --- a/src/commands/cmd_whowas.cpp +++ b/src/commands/cmd_whowas.cpp @@ -319,6 +319,10 @@ class ModuleWhoWas : public Module public: ModuleWhoWas() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/extra/m_ldapoper.cpp b/src/modules/extra/m_ldapoper.cpp index 84a3b8729..e8455529d 100644 --- a/src/modules/extra/m_ldapoper.cpp +++ b/src/modules/extra/m_ldapoper.cpp @@ -45,8 +45,8 @@ class ModuleLDAPAuth : public Module LDAP *conn; public: - ModuleLDAPAuth() - { + void init() + { conn = NULL; Implementation eventlist[] = { I_OnRehash, I_OnPassCompare }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 71f494dd9..ab6908d17 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -152,7 +152,7 @@ class SQLConn : public SQLProvider, public EventHandler { if (!DoConnect()) { - ServerInstance->Logs->Log("m_pgsql",DEFAULT, "WARNING: Could not connect to database " + tag->getString("id")); + ServerInstance->Logs->Log("m_pgsql",DEFAULT, "WARNING: Could not connect to database " + tag->getString("id")); DelayReconnect(); } } diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 6e06af74a..991d6f264 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -101,7 +101,7 @@ class ModuleAlias : public Module public: - ModuleAlias() + void init() { ReadAliases(); ServerInstance->Modules->Attach(I_OnPreCommand, this); diff --git a/src/modules/m_allowinvite.cpp b/src/modules/m_allowinvite.cpp index 19a8640e7..7dd2efc24 100644 --- a/src/modules/m_allowinvite.cpp +++ b/src/modules/m_allowinvite.cpp @@ -34,6 +34,10 @@ class ModuleAllowInvite : public Module ModuleAllowInvite() : ni(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&ni)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnUserPreInvite, I_On005Numeric }; diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp index 76536ed3f..682e94cd8 100644 --- a/src/modules/m_alltime.cpp +++ b/src/modules/m_alltime.cpp @@ -60,6 +60,10 @@ class Modulealltime : public Module Modulealltime() : mycommand(this) { + } + + void init() + { ServerInstance->AddCommand(&mycommand); } diff --git a/src/modules/m_autoop.cpp b/src/modules/m_autoop.cpp index 8f37f1cf9..e3adfdfe0 100644 --- a/src/modules/m_autoop.cpp +++ b/src/modules/m_autoop.cpp @@ -85,6 +85,10 @@ class ModuleAutoOp : public Module public: ModuleAutoOp() : mh(this) { + } + + void init() + { ServerInstance->Modules->AddService(mh); mh.DoImplements(this); diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp index 14908fafc..afa198e04 100644 --- a/src/modules/m_banexception.cpp +++ b/src/modules/m_banexception.cpp @@ -52,13 +52,16 @@ class ModuleBanException : public Module public: ModuleBanException() : be(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&be)) throw ModuleException("Could not add new modes!"); be.DoImplements(this); Implementation list[] = { I_OnRehash, I_On005Numeric, I_OnExtBanCheck, I_OnCheckChannelBan }; ServerInstance->Modules->Attach(list, this, 4); - } void On005Numeric(std::string &output) diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index 865626f87..b0001574a 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -57,13 +57,16 @@ class ModuleBlockAmsg : public Module public: ModuleBlockAmsg() : blockamsg("blockamsg", this) { + } + + void init() + { this->OnRehash(NULL); ServerInstance->Extensions.Register(&blockamsg); Implementation eventlist[] = { I_OnRehash, I_OnPreCommand }; ServerInstance->Modules->Attach(eventlist, this, 2); } - virtual ~ModuleBlockAmsg() { } diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index 4c19ef0a7..ca452945b 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -43,6 +43,10 @@ public: ModuleBlockCAPS() : bc(this) { + } + + void init() + { OnRehash(NULL); if (!ServerInstance->Modes->AddMode(&bc)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index 19b5c9231..90e3f912a 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -41,6 +41,10 @@ class ModuleBlockColor : public Module ModuleBlockColor() : bc(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&bc)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric }; diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index 23094ddc5..3e7fd2fc6 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -38,13 +38,16 @@ class ModuleBotMode : public Module ModuleBotMode() : bm(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&bm)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnWhois }; ServerInstance->Modules->Attach(eventlist, this, 1); } - virtual ~ModuleBotMode() { } diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 662e128a4..af53452c9 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -130,6 +130,10 @@ class ModuleCAP : public Module ModuleCAP() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); ServerInstance->Extensions.Register(&cmd.reghold); diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 6c7164c7d..f6cdfdb88 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -159,6 +159,10 @@ class ModuleCBan : public Module public: ModuleCBan() : mycommand(this) { + } + + void init() + { ServerInstance->XLines->RegisterFactory(&f); ServerInstance->AddCommand(&mycommand); diff --git a/src/modules/m_chancreate.cpp b/src/modules/m_chancreate.cpp index 833d6a774..60dbed10b 100644 --- a/src/modules/m_chancreate.cpp +++ b/src/modules/m_chancreate.cpp @@ -27,8 +27,8 @@ class ModuleChanCreate : public Module { private: public: - ModuleChanCreate() - { + void init() + { ServerInstance->SNO->EnableSnomask('j', "CHANCREATE"); Implementation eventlist[] = { I_OnUserJoin }; ServerInstance->Modules->Attach(eventlist, this, 1); diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index 3bc1082a6..2c8995044 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -76,6 +76,10 @@ class ModuleChanFilter : public Module ModuleChanFilter() : cf(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&cf)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp index f2c2f6c6f..123b20164 100644 --- a/src/modules/m_chanlog.cpp +++ b/src/modules/m_chanlog.cpp @@ -32,7 +32,8 @@ class ModuleChanLog : public Module ChanLogTargets logstreams; public: - ModuleChanLog() { + void init() + { Implementation eventlist[] = { I_OnRehash, I_OnSendSnotice }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp index 49fd7af7b..559ec5314 100644 --- a/src/modules/m_channames.cpp +++ b/src/modules/m_channames.cpp @@ -55,10 +55,13 @@ class ModuleChannelNames : public Module bool badchan; public: - ModuleChannelNames() : rememberer(ServerInstance->IsChannel) + ModuleChannelNames() : rememberer(ServerInstance->IsChannel), badchan(false) + { + } + + void init() { ServerInstance->IsChannel = &myhandler; - badchan = false; Implementation eventlist[] = { I_OnRehash, I_OnUserKick }; ServerInstance->Modules->Attach(eventlist, this, 2); OnRehash(NULL); diff --git a/src/modules/m_channelban.cpp b/src/modules/m_channelban.cpp index 8c5962f2a..71d4de784 100644 --- a/src/modules/m_channelban.cpp +++ b/src/modules/m_channelban.cpp @@ -26,7 +26,8 @@ class ModuleBadChannelExtban : public Module { private: public: - ModuleBadChannelExtban() { + void init() + { Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index b259bea8e..d98e14d75 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -93,13 +93,16 @@ class ModuleChgHost : public Module public: ModuleChgHost() : cmd(this, hostmap) { + } + + void init() + { OnRehash(NULL); ServerInstance->AddCommand(&cmd); Implementation eventlist[] = { I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 1); } - void OnRehash(User* user) { std::string hmap = ServerInstance->Config->ConfValue("hostname")->getString("charmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789"); diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index c8d4be4a0..14af29829 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -86,6 +86,10 @@ class ModuleChgIdent : public Module public: ModuleChgIdent() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index 2ac24c5d5..e3ba3fea4 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -82,6 +82,10 @@ class ModuleChgName : public Module public: ModuleChgName() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_clones.cpp b/src/modules/m_clones.cpp index 9c2b2cfa7..6b808b926 100644 --- a/src/modules/m_clones.cpp +++ b/src/modules/m_clones.cpp @@ -71,6 +71,10 @@ class ModuleClones : public Module public: ModuleClones() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_close.cpp b/src/modules/m_close.cpp index 5a6e7e963..0f38f84a1 100644 --- a/src/modules/m_close.cpp +++ b/src/modules/m_close.cpp @@ -69,6 +69,10 @@ class ModuleClose : public Module ModuleClose() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp index 877ba87d7..d91ab1231 100644 --- a/src/modules/m_commonchans.cpp +++ b/src/modules/m_commonchans.cpp @@ -35,13 +35,16 @@ class ModulePrivacyMode : public Module public: ModulePrivacyMode() : pm(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&pm)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice }; ServerInstance->Modules->Attach(eventlist, this, 2); } - virtual ~ModulePrivacyMode() { } diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp index eaa472e15..a21462ddf 100644 --- a/src/modules/m_conn_umodes.cpp +++ b/src/modules/m_conn_umodes.cpp @@ -27,7 +27,8 @@ class ModuleModesOnConnect : public Module { public: - ModuleModesOnConnect() { + void init() + { ServerInstance->Modules->Attach(I_OnUserConnect, this); } diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index 50aeffd0a..381beb18f 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -36,6 +36,10 @@ class ModuleWaitPong : public Module ModuleWaitPong() : ext("waitpong_pingstr", this) { + } + + void init() + { ServerInstance->Modules->AddService(ext); OnRehash(NULL); Implementation eventlist[] = { I_OnUserRegister, I_OnCheckReady, I_OnPreCommand, I_OnRehash }; diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index 6ba7f53a9..010190046 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -31,7 +31,8 @@ class ModuleConnectBan : public Module unsigned int ipv4_cidr; unsigned int ipv6_cidr; public: - ModuleConnectBan() { + void init() + { Implementation eventlist[] = { I_OnUserConnect, I_OnGarbageCollect, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 3); OnRehash(NULL); diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp index 71516063b..85aa85a9b 100644 --- a/src/modules/m_connflood.cpp +++ b/src/modules/m_connflood.cpp @@ -37,6 +37,10 @@ public: ModuleConnFlood() : conns(0), throttled(false) { + } + + void init() + { InitConf(); Implementation eventlist[] = { I_OnRehash, I_OnUserRegister }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index efe4b3247..6223085f5 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -95,6 +95,10 @@ class ModuleCustomTitle : public Module public: ModuleCustomTitle() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); ServerInstance->Extensions.Register(&cmd.ctitle); ServerInstance->Modules->Attach(I_OnWhoisLine, this); diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp index 10b593fdd..358825a26 100644 --- a/src/modules/m_cycle.cpp +++ b/src/modules/m_cycle.cpp @@ -88,6 +88,10 @@ class ModuleCycle : public Module ModuleCycle() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 3b0467ae5..68fee4a19 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -252,6 +252,11 @@ class ModuleDCCAllow : public Module ModuleDCCAllow() : cmd(this) { + ext = NULL; + } + + void init() + { ext = new SimpleExtItem<dccallowlist>("dccallow", this); ServerInstance->Extensions.Register(ext); ServerInstance->AddCommand(&cmd); @@ -260,7 +265,6 @@ class ModuleDCCAllow : public Module ServerInstance->Modules->Attach(eventlist, this, 5); } - virtual void OnRehash(User* user) { ReadFileConf(); diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp index 958abcdd4..45a53491c 100644 --- a/src/modules/m_deaf.cpp +++ b/src/modules/m_deaf.cpp @@ -64,6 +64,10 @@ class ModuleDeaf : public Module ModuleDeaf() : m1(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&m1)) throw ModuleException("Could not add new modes!"); @@ -72,7 +76,6 @@ class ModuleDeaf : public Module ServerInstance->Modules->Attach(eventlist, this, 3); } - virtual void OnRehash(User* user) { ConfigTag* tag = ServerInstance->Config->ConfValue("deaf"); diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 34d782c77..98d50455a 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -45,6 +45,10 @@ class ModuleDelayJoin : public Module LocalIntExt unjoined; ModuleDelayJoin() : djm(this), unjoined("delayjoin", this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&djm)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnUserJoin, I_OnUserPart, I_OnUserKick, I_OnBuildNeighborList, I_OnNamesListItem, I_OnText, I_OnRawMode }; diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp index 1a0734ed9..63da04a63 100644 --- a/src/modules/m_delaymsg.cpp +++ b/src/modules/m_delaymsg.cpp @@ -46,6 +46,10 @@ class ModuleDelayMsg : public Module public: ModuleDelayMsg() : djm(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&djm)) throw ModuleException("Could not add new modes!"); ServerInstance->Extensions.Register(&djm.jointime); diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index c280174f5..2b2b343a4 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -27,7 +27,8 @@ class ModuleDenyChannels : public Module { public: - ModuleDenyChannels() { + void init() + { Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp index 4156e038d..05f2d0d48 100644 --- a/src/modules/m_devoice.cpp +++ b/src/modules/m_devoice.cpp @@ -63,6 +63,10 @@ class ModuleDeVoice : public Module public: ModuleDeVoice() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_gecosban.cpp b/src/modules/m_gecosban.cpp index 73bfdb649..53cbf0fa4 100644 --- a/src/modules/m_gecosban.cpp +++ b/src/modules/m_gecosban.cpp @@ -24,7 +24,7 @@ class ModuleGecosBan : public Module { public: - ModuleGecosBan() + void init() { Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index f10d7f465..5ece45081 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -178,6 +178,10 @@ class ModuleGlobalLoad : public Module ModuleGlobalLoad() : cmd1(this), cmd2(this), cmd3(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd1); ServerInstance->AddCommand(&cmd2); ServerInstance->AddCommand(&cmd3); diff --git a/src/modules/m_halfop.cpp b/src/modules/m_halfop.cpp index 7a43f0241..78c4234e2 100644 --- a/src/modules/m_halfop.cpp +++ b/src/modules/m_halfop.cpp @@ -88,6 +88,10 @@ class ModuleHalfop : public Module public: ModuleHalfop() : mh(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&mh)) throw ModuleException("Could not add new modes!"); } diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp index 023189748..bb67c05a6 100644 --- a/src/modules/m_hidechans.cpp +++ b/src/modules/m_hidechans.cpp @@ -37,6 +37,10 @@ class ModuleHideChans : public Module public: ModuleHideChans() : hm(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&hm)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnWhoisLine, I_OnRehash }; diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index 998a57bb3..fe06ad8c6 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -41,6 +41,10 @@ class ModuleHideOper : public Module ModuleHideOper() : hm(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&hm)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnWhoisLine, I_OnSendWhoLine }; diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index 508171c96..68f3fdcbe 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -54,8 +54,8 @@ class ModuleHostChange : public Module std::string MySeparator; public: - ModuleHostChange() - { + void init() + { OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnUserConnect }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 8cc142f11..dee0a9d48 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -336,7 +336,8 @@ class ModuleHttpServer : public Module std::vector<HttpServerSocket *> httpsocks; public: - ModuleHttpServer() { + void init() + { HttpModule = this; ServerInstance->Modules->Attach(I_OnAcceptConnection, this); } diff --git a/src/modules/m_httpd_acl.cpp b/src/modules/m_httpd_acl.cpp index abbab1d87..e97febc6e 100644 --- a/src/modules/m_httpd_acl.cpp +++ b/src/modules/m_httpd_acl.cpp @@ -94,7 +94,8 @@ class ModuleHTTPAccessList : public Module } } - ModuleHTTPAccessList() { + void init() + { ReadConfig(); Implementation eventlist[] = { I_OnEvent }; ServerInstance->Modules->Attach(eventlist, this, 1); diff --git a/src/modules/m_httpd_config.cpp b/src/modules/m_httpd_config.cpp index 0df1c12fb..e2a70dba3 100644 --- a/src/modules/m_httpd_config.cpp +++ b/src/modules/m_httpd_config.cpp @@ -27,7 +27,8 @@ class ModuleHttpConfig : public Module { public: - ModuleHttpConfig() { + void init() + { Implementation eventlist[] = { I_OnEvent }; ServerInstance->Modules->Attach(eventlist, this, 1); } diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index b1613d5a5..ee5b213f7 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -34,7 +34,8 @@ class ModuleHttpStats : public Module public: - ModuleHttpStats() { + void init() + { Implementation eventlist[] = { I_OnEvent }; ServerInstance->Modules->Attach(eventlist, this, 1); } diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 35084fd45..b046079f0 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -270,6 +270,10 @@ class ModuleIdent : public Module public: ModuleIdent() : ext("ident_socket", this) { + } + + void init() + { OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnUserInit, I_OnCheckReady, diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp index 9c7573185..e961c7483 100644 --- a/src/modules/m_inviteexception.cpp +++ b/src/modules/m_inviteexception.cpp @@ -52,6 +52,10 @@ class ModuleInviteException : public Module public: ModuleInviteException() : ie(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&ie)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_ircv3.cpp b/src/modules/m_ircv3.cpp index 06765d696..166bbbea7 100644 --- a/src/modules/m_ircv3.cpp +++ b/src/modules/m_ircv3.cpp @@ -76,6 +76,10 @@ class ModuleIRCv3 : public Module cap_awaynotify(this, "away-notify"), cap_extendedjoin(this, "extended-join") { + } + + void init() + { OnRehash(NULL); Implementation eventlist[] = { I_OnUserJoin, I_OnPostJoin, I_OnSetAway, I_OnEvent, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 5); diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index e58445327..544995fe1 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -198,7 +198,10 @@ class ModuleJoinFlood : public Module ModuleJoinFlood() : jf(this) { + } + void init() + { if (!ServerInstance->Modes->AddMode(&jf)) throw ModuleException("Could not add new modes!"); ServerInstance->Extensions.Register(&jf.ext); diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp index ac3add29b..f4f5c4e84 100644 --- a/src/modules/m_jumpserver.cpp +++ b/src/modules/m_jumpserver.cpp @@ -141,6 +141,10 @@ class ModuleJumpServer : public Module public: ModuleJumpServer() : js(this) { + } + + void init() + { ServerInstance->AddCommand(&js); Implementation eventlist[] = { I_OnUserRegister, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 7abb9be7b..f2df9dab7 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -64,6 +64,10 @@ public: ModuleKickNoRejoin() : kr(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&kr)) throw ModuleException("Could not add new modes!"); ServerInstance->Extensions.Register(&kr.ext); diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 97eb0e005..ef3b617cd 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -95,6 +95,10 @@ class ModuleKnock : public Module public: ModuleKnock() : cmd(this), kn(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&kn)) throw ModuleException("Could not add new modes!"); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp index 3408e4621..cf25e9a92 100644 --- a/src/modules/m_lockserv.cpp +++ b/src/modules/m_lockserv.cpp @@ -88,6 +88,10 @@ private: public: ModuleLockserv() : lockcommand(this, locked), unlockcommand(this, locked) { + } + + void init() + { locked = false; ServerInstance->AddCommand(&lockcommand); ServerInstance->AddCommand(&unlockcommand); diff --git a/src/modules/m_maphide.cpp b/src/modules/m_maphide.cpp index f3f472519..de4c82fa4 100644 --- a/src/modules/m_maphide.cpp +++ b/src/modules/m_maphide.cpp @@ -25,7 +25,7 @@ class ModuleMapHide : public Module { std::string url; public: - ModuleMapHide() + void init() { Implementation eventlist[] = { I_OnPreCommand, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index ff92fcaa3..a2fdc115e 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -126,6 +126,10 @@ class ModuleMsgFlood : public Module ModuleMsgFlood() : mf(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&mf)) throw ModuleException("Could not add new modes!"); ServerInstance->Extensions.Register(&mf.ext); diff --git a/src/modules/m_muteban.cpp b/src/modules/m_muteban.cpp index 03e3d646e..c486a5868 100644 --- a/src/modules/m_muteban.cpp +++ b/src/modules/m_muteban.cpp @@ -26,7 +26,8 @@ class ModuleQuietBan : public Module { private: public: - ModuleQuietBan() { + void init() + { Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 3); } diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index e2b3efce3..15f6d44a6 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -31,6 +31,10 @@ class ModuleNamesX : public Module GenericCap cap; ModuleNamesX() : cap(this, "multi-prefix") { + } + + void init() + { Implementation eventlist[] = { I_OnPreCommand, I_OnNamesListItem, I_On005Numeric, I_OnEvent, I_OnSendWhoLine }; ServerInstance->Modules->Attach(eventlist, this, 5); } diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp index 587eaf56d..c60f214e6 100644 --- a/src/modules/m_nationalchars.cpp +++ b/src/modules/m_nationalchars.cpp @@ -230,9 +230,13 @@ class ModuleNationalChars : public Module const unsigned char * lowermap_rememberer; public: - ModuleNationalChars() : rememberer(ServerInstance->IsNick) + ModuleNationalChars() + : rememberer(ServerInstance->IsNick), lowermap_rememberer(national_case_insensitive_map) + { + } + + void init() { - lowermap_rememberer = national_case_insensitive_map; memcpy(m_lower, rfc_case_insensitive_map, 256); national_case_insensitive_map = m_lower; diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index ec9d9a261..fbb090620 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -139,6 +139,10 @@ class ModuleNickFlood : public Module ModuleNickFlood() : nf(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&nf)) throw ModuleException("Could not add new modes!"); ServerInstance->Extensions.Register(&nf.ext); diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index acea9f4f4..924ab8d81 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -149,6 +149,10 @@ class ModuleNickLock : public Module ModuleNickLock() : locked("nick_locked", this), cmd1(this, locked), cmd2(this, locked) { + } + + void init() + { ServerInstance->AddCommand(&cmd1); ServerInstance->AddCommand(&cmd2); ServerInstance->Extensions.Register(&locked); diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index b6044b3fe..144ac312b 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -39,6 +39,10 @@ class ModuleNoCTCP : public Module ModuleNoCTCP() : nc(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&nc)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric }; diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index 0d380facd..e8bceffd4 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -38,6 +38,10 @@ class ModuleNoKicks : public Module ModuleNoKicks() : nk(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&nk)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnUserPreKick, I_On005Numeric }; diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 4fa717d73..9bcc01b59 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -36,6 +36,10 @@ class ModuleNoNickChange : public Module public: ModuleNoNickChange() : nn(this) { + } + + void init() + { OnRehash(NULL); ServerInstance->Modes->AddMode(&nn); Implementation eventlist[] = { I_OnUserPreNick, I_On005Numeric, I_OnRehash }; diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index ccb44ccde..1a806d083 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -37,6 +37,10 @@ class ModuleNoNotice : public Module ModuleNoNotice() : nt(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&nt)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnUserPreNotice, I_On005Numeric }; diff --git a/src/modules/m_nopartmsg.cpp b/src/modules/m_nopartmsg.cpp index a8c4a5e2b..f061d278b 100644 --- a/src/modules/m_nopartmsg.cpp +++ b/src/modules/m_nopartmsg.cpp @@ -25,7 +25,7 @@ class ModulePartMsgBan : public Module { private: public: - ModulePartMsgBan() + void init() { Implementation eventlist[] = { I_OnUserPart, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index 8db2a4041..6df55696e 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -40,6 +40,10 @@ class ModuleOperChans : public Module public: ModuleOperChans() : oc(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&oc)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric, I_OnUserPreJoin }; diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index b717ac3ef..c4b2d5599 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -53,7 +53,7 @@ class ModuleOperjoin : public Module } public: - ModuleOperjoin() + void init() { OnRehash(NULL); Implementation eventlist[] = { I_OnPostOper, I_OnRehash }; diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index 4fc4c6aef..569defd49 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -27,7 +27,7 @@ class ModuleOperLevels : public Module { public: - ModuleOperLevels() + void init() { ServerInstance->Modules->Attach(I_OnKill, this); } diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index 17b9887c2..515fbd82b 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -28,8 +28,8 @@ class ModuleOperLog : public Module bool tosnomask; public: - ModuleOperLog() { - + void init() + { Implementation eventlist[] = { I_OnPreCommand, I_On005Numeric, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 3); ServerInstance->SNO->EnableSnomask('r', "OPERLOG"); diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index 0b04ff576..8b49f685e 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -27,7 +27,7 @@ class ModuleModesOnOper : public Module { public: - ModuleModesOnOper() + void init() { ServerInstance->Modules->Attach(I_OnPostOper, this); } diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 118c3d6e7..4d29b3878 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -80,6 +80,10 @@ class ModuleOpermotd : public Module ModuleOpermotd() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnOper }; diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index c7a6b8bfd..caaa67acb 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -35,8 +35,8 @@ class ModuleOverride : public Module public: - ModuleOverride() - { + void init() + { // read our config options (main config file) OnRehash(NULL); ServerInstance->SNO->EnableSnomask('v', "OVERRIDE"); diff --git a/src/modules/m_passforward.cpp b/src/modules/m_passforward.cpp index 047992d12..f46e79c0f 100644 --- a/src/modules/m_passforward.cpp +++ b/src/modules/m_passforward.cpp @@ -27,7 +27,7 @@ class ModulePassForward : public Module std::string nickrequired, forwardmsg, forwardcmd; public: - ModulePassForward() + void init() { OnRehash(NULL); Implementation eventlist[] = { I_OnPostConnect, I_OnRehash }; diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index 3a5070de0..55741ee0b 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -82,6 +82,10 @@ class ModuleOperHash : public Module ModuleOperHash() : cmd(this) { + } + + void init() + { /* Read the config file first */ OnRehash(NULL); diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index f21d43bf4..2af6a4a85 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -107,6 +107,10 @@ class ModuleRedirect : public Module ModuleRedirect() : re(this), re_u(this) { + } + + void init() + { /* Setting this here so it isn't changable by rehasing the config later. */ UseUsermode = ServerInstance->Config->ConfValue("redirect")->getBool("antiredirect"); @@ -129,7 +133,6 @@ class ModuleRedirect : public Module ServerInstance->Modules->Attach(eventlist, this, 1); } - virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven) { if (chan) diff --git a/src/modules/m_regonlycreate.cpp b/src/modules/m_regonlycreate.cpp index 87704abf6..2476f520b 100644 --- a/src/modules/m_regonlycreate.cpp +++ b/src/modules/m_regonlycreate.cpp @@ -28,7 +28,7 @@ class ModuleRegOnlyCreate : public Module { public: - ModuleRegOnlyCreate() + void init() { Implementation eventlist[] = { I_OnUserPreJoin }; ServerInstance->Modules->Attach(eventlist, this, 1); diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 8b5ae1f1b..1ba51a0eb 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -198,6 +198,10 @@ class ModuleRemove : public Module public: ModuleRemove() : cmd1(this, supportnokicks), cmd2(this, supportnokicks) { + } + + void init() + { ServerInstance->AddCommand(&cmd1); ServerInstance->AddCommand(&cmd2); OnRehash(NULL); @@ -205,7 +209,6 @@ class ModuleRemove : public Module ServerInstance->Modules->Attach(eventlist, this, 2); } - virtual void On005Numeric(std::string &output) { output.append(" REMOVE"); diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index a2f117616..91ad43bc2 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -41,7 +41,7 @@ class ModuleRestrictChans : public Module } public: - ModuleRestrictChans() + void init() { ReadConfig(); Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash }; diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index ef9181a24..9ed092746 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -29,9 +29,8 @@ class ModuleRestrictMsg : public Module public: - ModuleRestrictMsg() - { - + void init() + { Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index df88cd8f7..2153786f6 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -108,6 +108,10 @@ class ModuleSajoin : public Module ModuleSajoin() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp index 3926a18e6..d1c0f6e92 100644 --- a/src/modules/m_sakick.cpp +++ b/src/modules/m_sakick.cpp @@ -105,6 +105,10 @@ class ModuleSakick : public Module ModuleSakick() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 2b5ec1bd8..10d05e397 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -54,6 +54,10 @@ class ModuleSaMode : public Module ModuleSaMode() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); ServerInstance->Modules->Attach(I_OnPreMode, this); } diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 2d8e3cb1f..8bafa5289 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -95,6 +95,10 @@ class ModuleSanick : public Module ModuleSanick() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index 81ca709ef..c1ec7c2fb 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -107,6 +107,10 @@ class ModuleSapart : public Module ModuleSapart() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 46f047550..58af438ec 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -77,6 +77,10 @@ class ModuleSaquit : public Module ModuleSaquit() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp index a0e3319af..3a883421a 100644 --- a/src/modules/m_satopic.cpp +++ b/src/modules/m_satopic.cpp @@ -63,6 +63,10 @@ class ModuleSATopic : public Module ModuleSATopic() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index 6501893f3..9645c2ba9 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -29,7 +29,8 @@ class ModuleSecureList : public Module std::vector<std::string> allowlist; time_t WaitTime; public: - ModuleSecureList() { + void init() + { OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnPreCommand, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 3); diff --git a/src/modules/m_serverban.cpp b/src/modules/m_serverban.cpp index ec38b4754..8b2520fb6 100644 --- a/src/modules/m_serverban.cpp +++ b/src/modules/m_serverban.cpp @@ -25,7 +25,8 @@ class ModuleServerBan : public Module { private: public: - ModuleServerBan() { + void init() + { Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index 797c541eb..4f20ce000 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -51,6 +51,10 @@ class ModuleServProtectMode : public Module ModuleServProtectMode() : bm(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&bm)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnWhois, I_OnKill, I_OnWhoisLine, I_OnRawMode, I_OnUserPreKick }; diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 907649158..e4662791d 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -77,13 +77,16 @@ class ModuleSetHost : public Module ModuleSetHost() : cmd(this, hostmap) { + } + + void init() + { OnRehash(NULL); ServerInstance->AddCommand(&cmd); Implementation eventlist[] = { I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 1); } - void OnRehash(User* user) { std::string hmap = ServerInstance->Config->ConfValue("hostname")->getString("charmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789"); diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index 2e81c1efd..00545e29b 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -70,6 +70,10 @@ class ModuleSetIdent : public Module public: ModuleSetIdent() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index 97008797c..3665afbe6 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -61,6 +61,10 @@ class ModuleSetIdle : public Module ModuleSetIdle() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index 32c1d5dc3..1ca7b1b3f 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -65,6 +65,10 @@ class ModuleSetName : public Module ModuleSetName() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index 3b2ea7de9..9b2604473 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -74,7 +74,12 @@ class ModuleShowwhois : public Module public: - ModuleShowwhois() : cmd(this) + ModuleShowwhois() + : sw(NULL), cmd(this) + { + } + + void init() { ConfigTag* tag = ServerInstance->Config->ConfValue("showwhois"); diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 096d2f9ee..10693e5f3 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -183,6 +183,10 @@ class ModuleShun : public Module public: ModuleShun() : cmd(this) { + } + + void init() + { ServerInstance->XLines->RegisterFactory(&f); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index d56ee145d..40a42c9d7 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -299,6 +299,10 @@ class ModuleSilence : public Module ModuleSilence() : maxsilence(32), cmdsilence(this, maxsilence), cmdsvssilence(this) { + } + + void init() + { OnRehash(NULL); ServerInstance->AddCommand(&cmdsilence); ServerInstance->AddCommand(&cmdsvssilence); diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index f17f30907..fb43422fd 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -83,6 +83,10 @@ class ModuleSSLModes : public Module ModuleSSLModes() : sslm(this) { + } + + void init() + { if (!ServerInstance->Modes->AddMode(&sslm)) throw ModuleException("Could not add new modes!"); Implementation eventlist[] = { I_OnUserPreJoin, I_OnCheckBan, I_On005Numeric }; diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index a2b072921..377179bf0 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -165,13 +165,16 @@ class ModuleSVSHold : public Module public: ModuleSVSHold() : cmd(this) { + } + + void init() + { ServerInstance->XLines->RegisterFactory(&s); ServerInstance->AddCommand(&cmd); Implementation eventlist[] = { I_OnUserPreNick, I_OnStats }; ServerInstance->Modules->Attach(eventlist, this, 2); } - virtual ModResult OnStats(char symbol, User* user, string_list &out) { if(symbol != 'S') diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index a98c06c75..eeb7a8d67 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -36,7 +36,6 @@ class CommandSwhois : public Command CommandSwhois(Module* Creator) : Command(Creator,"SWHOIS", 2,2), swhois("swhois", Creator) { flags_needed = 'o'; syntax = "<nick> :<swhois>"; - ServerInstance->Extensions.Register(&swhois); TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -89,7 +88,12 @@ class ModuleSWhois : public Module public: ModuleSWhois() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd.swhois); Implementation eventlist[] = { I_OnWhoisLine, I_OnPostOper }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/m_testnet.cpp b/src/modules/m_testnet.cpp index c2644dbff..1dcb73f91 100644 --- a/src/modules/m_testnet.cpp +++ b/src/modules/m_testnet.cpp @@ -214,6 +214,10 @@ class ModuleTest : public Module public: ModuleTest() : cmd(this) { + } + + void init() + { if (!strstr(ServerInstance->Config->ServerName.c_str(), ".test")) throw ModuleException("Don't load modules without reading their descriptions!"); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index c639d2039..70027473f 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -112,6 +112,10 @@ class ModuleTimedBans : public Module ModuleTimedBans() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); Implementation eventlist[] = { I_OnDelBan, I_OnBackgroundTimer }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp index 554a12861..a51776527 100644 --- a/src/modules/m_tline.cpp +++ b/src/modules/m_tline.cpp @@ -73,9 +73,12 @@ class ModuleTLine : public Module ModuleTLine() : cmd(this) { - ServerInstance->AddCommand(&cmd); } + void init() + { + ServerInstance->AddCommand(&cmd); + } virtual ~ModuleTLine() { diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp index 5693eb807..e446f88e8 100644 --- a/src/modules/m_uhnames.cpp +++ b/src/modules/m_uhnames.cpp @@ -31,6 +31,10 @@ class ModuleUHNames : public Module ModuleUHNames() : cap(this, "userhost-in-names") { + } + + void init() + { Implementation eventlist[] = { I_OnEvent, I_OnPreCommand, I_OnNamesListItem, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 4); } diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index 9287589bb..873588c93 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -104,6 +104,10 @@ class ModuleUninvite : public Module ModuleUninvite() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index ae826b12a..9e547d106 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -68,12 +68,15 @@ class ModuleUserIP : public Module ModuleUserIP() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); Implementation eventlist[] = { I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 1); } - virtual void On005Numeric(std::string &output) { output = output + " USERIP"; diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 8ae231f33..f3bbc1cfc 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -69,6 +69,10 @@ class ModuleVHost : public Module public: ModuleVHost() : cmd(this) { + } + + void init() + { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 4012f358c..a2a458c33 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -377,10 +377,14 @@ class Modulewatch : public Module public: Modulewatch() - : maxwatch(32), cmdw(this, maxwatch), sw(this) + : maxwatch(32), cmdw(this, maxwatch), sw(this) { - OnRehash(NULL); whos_watching_me = new watchentries(); + } + + void init() + { + OnRehash(NULL); ServerInstance->AddCommand(&cmdw); ServerInstance->AddCommand(&sw); ServerInstance->Extensions.Register(&cmdw.ext); diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp index 6caae07d7..f25f1d597 100644 --- a/src/modules/m_xline_db.cpp +++ b/src/modules/m_xline_db.cpp @@ -32,7 +32,8 @@ class ModuleXLineDB : public Module // DO REMEMBER TO SET IT, otherwise it's annoying :P std::string xlinedbpath; public: - ModuleXLineDB() { + void init() + { Implementation eventlist[] = { I_OnAddLine, I_OnDelLine, I_OnExpireLine }; ServerInstance->Modules->Attach(eventlist, this, 3); diff --git a/src/modules/u_listmode.h b/src/modules/u_listmode.h index dde36a482..3d82a0c81 100644 --- a/src/modules/u_listmode.h +++ b/src/modules/u_listmode.h @@ -100,8 +100,6 @@ class ListModeBase : public ModeHandler configtag(ctag), extItem("listbase_mode_" + name + "_list", Creator) { list = true; - this->DoRehash(); - ServerInstance->Extensions.Register(&extItem); } /** See mode.h @@ -216,6 +214,8 @@ class ListModeBase : public ModeHandler */ virtual void DoImplements(Module* m) { + ServerInstance->Modules->AddService(extItem); + this->DoRehash(); Implementation eventlist[] = { I_OnSyncChannel, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, m, 2); } |