From 349106f3f9f75d7f957fc5d1e71ca650f4807bb9 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sun, 2 Dec 2012 19:40:17 +0100 Subject: Register all commands, modes and extensions using AddService() AddService() throws an exception if an item cannot be registered, modules no longer need to worry about AddMode() etc. failing --- src/commands/cmd_whowas.cpp | 2 +- src/modules/extra/m_ssl_gnutls.cpp | 2 +- src/modules/m_allowinvite.cpp | 3 +-- src/modules/m_alltime.cpp | 2 +- src/modules/m_banexception.cpp | 3 +-- src/modules/m_banredirect.cpp | 2 +- src/modules/m_blockamsg.cpp | 2 +- src/modules/m_blockcaps.cpp | 3 +-- src/modules/m_blockcolor.cpp | 3 +-- src/modules/m_botmode.cpp | 3 +-- src/modules/m_cap.cpp | 4 ++-- src/modules/m_cap.h | 2 +- src/modules/m_cban.cpp | 2 +- src/modules/m_cgiirc.cpp | 8 ++------ src/modules/m_chanfilter.cpp | 3 +-- src/modules/m_chghost.cpp | 2 +- src/modules/m_chgident.cpp | 2 +- src/modules/m_chgname.cpp | 2 +- src/modules/m_clones.cpp | 2 +- src/modules/m_close.cpp | 2 +- src/modules/m_commonchans.cpp | 3 +-- src/modules/m_customtitle.cpp | 4 ++-- src/modules/m_cycle.cpp | 2 +- src/modules/m_dccallow.cpp | 4 ++-- src/modules/m_deaf.cpp | 3 +-- src/modules/m_delayjoin.cpp | 3 +-- src/modules/m_delaymsg.cpp | 5 ++--- src/modules/m_devoice.cpp | 2 +- src/modules/m_filter.cpp | 2 +- src/modules/m_globalload.cpp | 6 +++--- src/modules/m_globops.cpp | 2 +- src/modules/m_halfop.cpp | 3 +-- src/modules/m_hidechans.cpp | 3 +-- src/modules/m_hideoper.cpp | 3 +-- src/modules/m_inviteexception.cpp | 3 +-- src/modules/m_joinflood.cpp | 5 ++--- src/modules/m_jumpserver.cpp | 2 +- src/modules/m_kicknorejoin.cpp | 5 ++--- src/modules/m_knock.cpp | 5 ++--- src/modules/m_lockserv.cpp | 4 ++-- src/modules/m_messageflood.cpp | 5 ++--- src/modules/m_mlock.cpp | 2 +- src/modules/m_nickflood.cpp | 5 ++--- src/modules/m_nicklock.cpp | 6 +++--- src/modules/m_noctcp.cpp | 3 +-- src/modules/m_nokicks.cpp | 3 +-- src/modules/m_nonicks.cpp | 2 +- src/modules/m_nonotice.cpp | 3 +-- src/modules/m_operchans.cpp | 3 +-- src/modules/m_opermotd.cpp | 2 +- src/modules/m_password_hash.cpp | 2 +- src/modules/m_randquote.cpp | 2 +- src/modules/m_redirect.cpp | 6 ++---- src/modules/m_remove.cpp | 4 ++-- src/modules/m_rline.cpp | 2 +- src/modules/m_sajoin.cpp | 2 +- src/modules/m_sakick.cpp | 2 +- src/modules/m_samode.cpp | 2 +- src/modules/m_sanick.cpp | 2 +- src/modules/m_sapart.cpp | 2 +- src/modules/m_saquit.cpp | 2 +- src/modules/m_satopic.cpp | 2 +- src/modules/m_services_account.cpp | 8 ++------ src/modules/m_servprotect.cpp | 3 +-- src/modules/m_sethost.cpp | 2 +- src/modules/m_setident.cpp | 2 +- src/modules/m_setidle.cpp | 2 +- src/modules/m_setname.cpp | 2 +- src/modules/m_showwhois.cpp | 5 ++--- src/modules/m_shun.cpp | 2 +- src/modules/m_silence.cpp | 6 +++--- src/modules/m_sslinfo.cpp | 4 ++-- src/modules/m_sslmodes.cpp | 3 +-- src/modules/m_svshold.cpp | 2 +- src/modules/m_swhois.cpp | 2 +- src/modules/m_testnet.cpp | 2 +- src/modules/m_timedbans.cpp | 2 +- src/modules/m_tline.cpp | 2 +- src/modules/m_uninvite.cpp | 2 +- src/modules/m_userip.cpp | 2 +- src/modules/m_vhost.cpp | 2 +- src/modules/m_watch.cpp | 6 +++--- 82 files changed, 106 insertions(+), 142 deletions(-) (limited to 'src') diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp index fa3b738ba..17a779ec3 100644 --- a/src/commands/cmd_whowas.cpp +++ b/src/commands/cmd_whowas.cpp @@ -323,7 +323,7 @@ class ModuleWhoWas : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } void OnRequest(Request& request) diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index a8a35fa78..fd487ed39 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -221,7 +221,7 @@ class ModuleSSLGnuTLS : public Module ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); ServerInstance->Modules->AddService(iohook); - ServerInstance->AddCommand(&starttls); + ServerInstance->Modules->AddService(starttls); } void OnRehash(User* user) diff --git a/src/modules/m_allowinvite.cpp b/src/modules/m_allowinvite.cpp index a53b934a6..2bfa88823 100644 --- a/src/modules/m_allowinvite.cpp +++ b/src/modules/m_allowinvite.cpp @@ -38,8 +38,7 @@ class ModuleAllowInvite : public Module void init() { - if (!ServerInstance->Modes->AddMode(&ni)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(ni); Implementation eventlist[] = { I_OnUserPreInvite, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp index 682e94cd8..38ae4b254 100644 --- a/src/modules/m_alltime.cpp +++ b/src/modules/m_alltime.cpp @@ -64,7 +64,7 @@ class Modulealltime : public Module void init() { - ServerInstance->AddCommand(&mycommand); + ServerInstance->Modules->AddService(mycommand); } virtual ~Modulealltime() diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp index de217d2b9..1811f743d 100644 --- a/src/modules/m_banexception.cpp +++ b/src/modules/m_banexception.cpp @@ -56,8 +56,7 @@ public: void init() { - if (!ServerInstance->Modes->AddMode(&be)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(be); be.DoImplements(this); Implementation list[] = { I_OnRehash, I_On005Numeric, I_OnExtBanCheck, I_OnCheckChannelBan }; diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 9a7ba0c4f..95aff080a 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -229,7 +229,7 @@ class ModuleBanRedirect : public Module OnRehash(NULL); - ServerInstance->Extensions.Register(&re.extItem); + ServerInstance->Modules->AddService(re.extItem); Implementation list[] = { I_OnRehash, I_OnUserPreJoin, I_OnChannelDelete }; ServerInstance->Modules->Attach(list, this, sizeof(list)/sizeof(Implementation)); } diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index 5f0dbcdd4..be861447f 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -62,7 +62,7 @@ class ModuleBlockAmsg : public Module void init() { this->OnRehash(NULL); - ServerInstance->Extensions.Register(&blockamsg); + ServerInstance->Modules->AddService(blockamsg); Implementation eventlist[] = { I_OnRehash, I_OnPreCommand }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index 6807c1fd7..200693699 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -48,8 +48,7 @@ public: void init() { OnRehash(NULL); - if (!ServerInstance->Modes->AddMode(&bc)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(bc); Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index aebdf9792..d25582850 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -45,8 +45,7 @@ class ModuleBlockColor : public Module void init() { - if (!ServerInstance->Modes->AddMode(&bc)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(bc); Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index 949332ba5..b29c58240 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -42,8 +42,7 @@ class ModuleBotMode : public Module void init() { - if (!ServerInstance->Modes->AddMode(&bm)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(bm); Implementation eventlist[] = { I_OnWhois }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index af8357cf0..e9f4dae90 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -134,8 +134,8 @@ class ModuleCAP : public Module void init() { - ServerInstance->AddCommand(&cmd); - ServerInstance->Extensions.Register(&cmd.reghold); + ServerInstance->Modules->AddService(cmd); + ServerInstance->Modules->AddService(cmd.reghold); Implementation eventlist[] = { I_OnCheckReady }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); diff --git a/src/modules/m_cap.h b/src/modules/m_cap.h index ce7e7f394..409671f48 100644 --- a/src/modules/m_cap.h +++ b/src/modules/m_cap.h @@ -46,7 +46,7 @@ class GenericCap const std::string cap; GenericCap(Module* parent, const std::string &Cap) : ext("cap_" + Cap, parent), cap(Cap) { - ServerInstance->Extensions.Register(&ext); + ServerInstance->Modules->AddService(ext); } void HandleEvent(Event& ev) diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index c864f25c1..20e95ebe4 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -165,7 +165,7 @@ class ModuleCBan : public Module { ServerInstance->XLines->RegisterFactory(&f); - ServerInstance->AddCommand(&mycommand); + ServerInstance->Modules->AddService(mycommand); Implementation eventlist[] = { I_OnUserPreJoin, I_OnStats }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 0e3e39e0e..63efd6bae 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -225,12 +225,8 @@ public: void init() { OnRehash(NULL); - ServerInstance->AddCommand(&cmd); - ServerInstance->Extensions.Register(&cmd.realhost); - ServerInstance->Extensions.Register(&cmd.realip); - ServerInstance->Extensions.Register(&cmd.webirc_hostname); - ServerInstance->Extensions.Register(&cmd.webirc_ip); - ServerInstance->Extensions.Register(&waiting); + ServiceProvider* providerlist[] = { &cmd, &cmd.realhost, &cmd.realip, &cmd.webirc_hostname, &cmd.webirc_ip, &waiting }; + ServerInstance->Modules->AddServices(providerlist, sizeof(providerlist)/sizeof(ServiceProvider*)); Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCheckReady }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index 67ea6bde7..651e659b5 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -80,8 +80,7 @@ class ModuleChanFilter : public Module void init() { - if (!ServerInstance->Modes->AddMode(&cf)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(cf); cf.DoImplements(this); Implementation eventlist[] = { I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice, I_OnSyncChannel }; diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 5855104de..4d39127e7 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -98,7 +98,7 @@ class ModuleChgHost : public Module void init() { OnRehash(NULL); - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); Implementation eventlist[] = { I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 14af29829..968497f8c 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -90,7 +90,7 @@ public: void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleChgIdent() diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index e3ba3fea4..aadf29fdb 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -86,7 +86,7 @@ public: void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleChgName() diff --git a/src/modules/m_clones.cpp b/src/modules/m_clones.cpp index 6b808b926..92b1bda78 100644 --- a/src/modules/m_clones.cpp +++ b/src/modules/m_clones.cpp @@ -75,7 +75,7 @@ class ModuleClones : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleClones() diff --git a/src/modules/m_close.cpp b/src/modules/m_close.cpp index 0f38f84a1..8b0ea3417 100644 --- a/src/modules/m_close.cpp +++ b/src/modules/m_close.cpp @@ -73,7 +73,7 @@ class ModuleClose : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleClose() diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp index d5e7d4b1c..afa17add4 100644 --- a/src/modules/m_commonchans.cpp +++ b/src/modules/m_commonchans.cpp @@ -39,8 +39,7 @@ class ModulePrivacyMode : public Module void init() { - if (!ServerInstance->Modes->AddMode(&pm)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(pm); Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 6223085f5..c65645bc9 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -99,8 +99,8 @@ class ModuleCustomTitle : public Module void init() { - ServerInstance->AddCommand(&cmd); - ServerInstance->Extensions.Register(&cmd.ctitle); + ServerInstance->Modules->AddService(cmd); + ServerInstance->Modules->AddService(cmd.ctitle); ServerInstance->Modules->Attach(I_OnWhoisLine, this); } diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp index 358825a26..383e7b5a2 100644 --- a/src/modules/m_cycle.cpp +++ b/src/modules/m_cycle.cpp @@ -92,7 +92,7 @@ class ModuleCycle : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleCycle() diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 26dd13bb3..712dd91b8 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -258,8 +258,8 @@ class ModuleDCCAllow : public Module void init() { ext = new SimpleExtItem("dccallow", this); - ServerInstance->Extensions.Register(ext); - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(*ext); + ServerInstance->Modules->AddService(cmd); ReadFileConf(); Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserQuit, I_OnUserPostNick, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp index 31c498030..43b24cfae 100644 --- a/src/modules/m_deaf.cpp +++ b/src/modules/m_deaf.cpp @@ -68,8 +68,7 @@ class ModuleDeaf : public Module void init() { - if (!ServerInstance->Modes->AddMode(&m1)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(m1); OnRehash(NULL); Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash }; diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 49ca93788..dfc2e2361 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -49,8 +49,7 @@ class ModuleDelayJoin : public Module void init() { - if (!ServerInstance->Modes->AddMode(&djm)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(djm); Implementation eventlist[] = { I_OnUserJoin, I_OnUserPart, I_OnUserKick, I_OnBuildNeighborList, I_OnNamesListItem, I_OnText, I_OnRawMode }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp index 1889f6c47..cfc06866a 100644 --- a/src/modules/m_delaymsg.cpp +++ b/src/modules/m_delaymsg.cpp @@ -50,9 +50,8 @@ class ModuleDelayMsg : public Module void init() { - if (!ServerInstance->Modes->AddMode(&djm)) - throw ModuleException("Could not add new modes!"); - ServerInstance->Extensions.Register(&djm.jointime); + ServerInstance->Modules->AddService(djm); + ServerInstance->Modules->AddService(djm.jointime); Implementation eventlist[] = { I_OnUserJoin, I_OnUserPreMessage}; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp index 05f2d0d48..2b5de2bd6 100644 --- a/src/modules/m_devoice.cpp +++ b/src/modules/m_devoice.cpp @@ -67,7 +67,7 @@ class ModuleDeVoice : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleDeVoice() diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index eb9f17b75..86ef0d4f6 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -298,7 +298,7 @@ ModuleFilter::ModuleFilter() : filtcommand(this), RegexEngine(this, "regex") void ModuleFilter::init() { - ServerInstance->AddCommand(&filtcommand); + ServerInstance->Modules->AddService(filtcommand); Implementation eventlist[] = { I_OnPreCommand, I_OnStats, I_OnSyncNetwork, I_OnDecodeMetaData, I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index 5ece45081..22286b950 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -182,9 +182,9 @@ class ModuleGlobalLoad : public Module void init() { - ServerInstance->AddCommand(&cmd1); - ServerInstance->AddCommand(&cmd2); - ServerInstance->AddCommand(&cmd3); + ServerInstance->Modules->AddService(cmd1); + ServerInstance->Modules->AddService(cmd2); + ServerInstance->Modules->AddService(cmd3); } ~ModuleGlobalLoad() diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index d9dd8f2ac..85d84252b 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -51,7 +51,7 @@ class ModuleGlobops : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); ServerInstance->SNO->EnableSnomask('g',"GLOBOPS"); } diff --git a/src/modules/m_halfop.cpp b/src/modules/m_halfop.cpp index 78c4234e2..3194fcde8 100644 --- a/src/modules/m_halfop.cpp +++ b/src/modules/m_halfop.cpp @@ -92,8 +92,7 @@ class ModuleHalfop : public Module void init() { - if (!ServerInstance->Modes->AddMode(&mh)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(mh); } Version GetVersion() diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp index b2497cbe0..008c62208 100644 --- a/src/modules/m_hidechans.cpp +++ b/src/modules/m_hidechans.cpp @@ -41,8 +41,7 @@ class ModuleHideChans : public Module void init() { - if (!ServerInstance->Modes->AddMode(&hm)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(hm); Implementation eventlist[] = { I_OnWhoisLine, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index 00e7deb91..fbab9685f 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -45,8 +45,7 @@ class ModuleHideOper : public Module void init() { - if (!ServerInstance->Modes->AddMode(&hm)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(hm); Implementation eventlist[] = { I_OnWhoisLine, I_OnSendWhoLine }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp index 67fda5637..747a3b30a 100644 --- a/src/modules/m_inviteexception.cpp +++ b/src/modules/m_inviteexception.cpp @@ -56,8 +56,7 @@ public: void init() { - if (!ServerInstance->Modes->AddMode(&ie)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(ie); OnRehash(NULL); ie.DoImplements(this); diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index a94f7d9cf..0c68da1fb 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -202,9 +202,8 @@ class ModuleJoinFlood : public Module void init() { - if (!ServerInstance->Modes->AddMode(&jf)) - throw ModuleException("Could not add new modes!"); - ServerInstance->Extensions.Register(&jf.ext); + ServerInstance->Modules->AddService(jf); + ServerInstance->Modules->AddService(jf.ext); Implementation eventlist[] = { I_OnUserPreJoin, I_OnUserJoin }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp index 9c21b6883..dce8f0bd5 100644 --- a/src/modules/m_jumpserver.cpp +++ b/src/modules/m_jumpserver.cpp @@ -145,7 +145,7 @@ class ModuleJumpServer : public Module void init() { - ServerInstance->AddCommand(&js); + ServerInstance->Modules->AddService(js); Implementation eventlist[] = { I_OnUserRegister, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 3e2d52360..836f92e6c 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -68,9 +68,8 @@ public: void init() { - if (!ServerInstance->Modes->AddMode(&kr)) - throw ModuleException("Could not add new modes!"); - ServerInstance->Extensions.Register(&kr.ext); + ServerInstance->Modules->AddService(kr); + ServerInstance->Modules->AddService(kr.ext); Implementation eventlist[] = { I_OnUserPreJoin, I_OnUserKick }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index ef3b617cd..8d2aa4543 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -99,9 +99,8 @@ class ModuleKnock : public Module void init() { - if (!ServerInstance->Modes->AddMode(&kn)) - throw ModuleException("Could not add new modes!"); - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(kn); + ServerInstance->Modules->AddService(cmd); ServerInstance->Modules->Attach(I_OnRehash, this); OnRehash(NULL); diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp index eef767c5b..4983ae16a 100644 --- a/src/modules/m_lockserv.cpp +++ b/src/modules/m_lockserv.cpp @@ -93,8 +93,8 @@ public: void init() { locked = false; - ServerInstance->AddCommand(&lockcommand); - ServerInstance->AddCommand(&unlockcommand); + ServerInstance->Modules->AddService(lockcommand); + ServerInstance->Modules->AddService(unlockcommand); Implementation eventlist[] = { I_OnUserRegister, I_OnRehash, I_OnCheckReady }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 27c2f88db..814eee5ef 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -130,9 +130,8 @@ class ModuleMsgFlood : public Module void init() { - if (!ServerInstance->Modes->AddMode(&mf)) - throw ModuleException("Could not add new modes!"); - ServerInstance->Extensions.Register(&mf.ext); + ServerInstance->Modules->AddService(mf); + ServerInstance->Modules->AddService(mf.ext); Implementation eventlist[] = { I_OnUserPreNotice, I_OnUserPreMessage }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_mlock.cpp b/src/modules/m_mlock.cpp index 3fb60a3d2..719701d02 100644 --- a/src/modules/m_mlock.cpp +++ b/src/modules/m_mlock.cpp @@ -32,7 +32,7 @@ public: void init() { ServerInstance->Modules->Attach(I_OnPreMode, this); - ServerInstance->Extensions.Register(&this->mlock); + ServerInstance->Modules->AddService(this->mlock); } Version GetVersion() diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index 349bf1a5d..04d7c8b5e 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -143,9 +143,8 @@ class ModuleNickFlood : public Module void init() { - if (!ServerInstance->Modes->AddMode(&nf)) - throw ModuleException("Could not add new modes!"); - ServerInstance->Extensions.Register(&nf.ext); + ServerInstance->Modules->AddService(nf); + ServerInstance->Modules->AddService(nf.ext); Implementation eventlist[] = { I_OnUserPreNick, I_OnUserPostNick }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 924ab8d81..a67c1b433 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -153,9 +153,9 @@ class ModuleNickLock : public Module void init() { - ServerInstance->AddCommand(&cmd1); - ServerInstance->AddCommand(&cmd2); - ServerInstance->Extensions.Register(&locked); + ServerInstance->Modules->AddService(cmd1); + ServerInstance->Modules->AddService(cmd2); + ServerInstance->Modules->AddService(locked); ServerInstance->Modules->Attach(I_OnUserPreNick, this); } diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index cc57f9d93..1dd6fe34a 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -43,8 +43,7 @@ class ModuleNoCTCP : public Module void init() { - if (!ServerInstance->Modes->AddMode(&nc)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(nc); Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index a17e6eb35..1f58a2e08 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -42,8 +42,7 @@ class ModuleNoKicks : public Module void init() { - if (!ServerInstance->Modes->AddMode(&nk)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(nk); Implementation eventlist[] = { I_OnUserPreKick, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 42e133a2c..672a48f8d 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -41,7 +41,7 @@ class ModuleNoNickChange : public Module void init() { OnRehash(NULL); - ServerInstance->Modes->AddMode(&nn); + ServerInstance->Modules->AddService(nn); Implementation eventlist[] = { I_OnUserPreNick, I_On005Numeric, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index c1f8bca77..d95ea8b8a 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -41,8 +41,7 @@ class ModuleNoNotice : public Module void init() { - if (!ServerInstance->Modes->AddMode(&nt)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(nt); Implementation eventlist[] = { I_OnUserPreNotice, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index ae5ea79c9..ca948d95b 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -44,8 +44,7 @@ class ModuleOperChans : public Module void init() { - if (!ServerInstance->Modes->AddMode(&oc)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(oc); Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric, I_OnUserPreJoin }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 56acef175..989f97689 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -84,7 +84,7 @@ class ModuleOpermotd : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnOper }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index 5026749aa..98462780b 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -89,7 +89,7 @@ class ModuleOperHash : public Module /* Read the config file first */ OnRehash(NULL); - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); Implementation eventlist[] = { I_OnPassCompare }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index f353701e1..dab3c93cd 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -75,7 +75,7 @@ class ModuleRandQuote : public Module { throw ModuleException("m_randquote: QuoteFile not Found!! Please check your config - module will not function."); } - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); Implementation eventlist[] = { I_OnUserConnect }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 4c44e630c..26d6b162b 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -115,8 +115,7 @@ class ModuleRedirect : public Module UseUsermode = ServerInstance->Config->ConfValue("redirect")->getBool("antiredirect"); /* Channel mode */ - if (!ServerInstance->Modes->AddMode(&re)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(re); /* Check to see if the usermode is enabled in the config */ if (UseUsermode) @@ -125,8 +124,7 @@ class ModuleRedirect : public Module ServerInstance->Logs->Log("m_redirect", DEFAULT, "REDIRECT: Enabled usermode +L. This breaks linking with servers that do not have this enabled. This is disabled by default in the 2.0 branch but will be enabled in the next version."); /* Try to add the usermode */ - if (!ServerInstance->Modes->AddMode(&re_u)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(re_u); } Implementation eventlist[] = { I_OnUserPreJoin }; diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 460004d1b..51cbf335a 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -202,8 +202,8 @@ class ModuleRemove : public Module void init() { - ServerInstance->AddCommand(&cmd1); - ServerInstance->AddCommand(&cmd2); + ServerInstance->Modules->AddService(cmd1); + ServerInstance->Modules->AddService(cmd2); OnRehash(NULL); Implementation eventlist[] = { I_On005Numeric, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 5790a6a27..22e8b84eb 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -231,7 +231,7 @@ class ModuleRLine : public Module { OnRehash(NULL); - ServerInstance->AddCommand(&r); + ServerInstance->Modules->AddService(r); ServerInstance->XLines->RegisterFactory(&f); Implementation eventlist[] = { I_OnUserConnect, I_OnRehash, I_OnUserPostNick, I_OnStats, I_OnBackgroundTimer }; diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 2153786f6..d3c939b04 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -112,7 +112,7 @@ class ModuleSajoin : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleSajoin() diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp index d1c0f6e92..efd991ff0 100644 --- a/src/modules/m_sakick.cpp +++ b/src/modules/m_sakick.cpp @@ -109,7 +109,7 @@ class ModuleSakick : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleSakick() diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 10d05e397..c0cf1b93d 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -58,7 +58,7 @@ class ModuleSaMode : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); ServerInstance->Modules->Attach(I_OnPreMode, this); } diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 8bafa5289..722c9596d 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -99,7 +99,7 @@ class ModuleSanick : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleSanick() diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index c1ec7c2fb..6bd961ea7 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -111,7 +111,7 @@ class ModuleSapart : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleSapart() diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 58af438ec..6afae913d 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -81,7 +81,7 @@ class ModuleSaquit : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleSaquit() diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp index 3a883421a..ae1c19d91 100644 --- a/src/modules/m_satopic.cpp +++ b/src/modules/m_satopic.cpp @@ -67,7 +67,7 @@ class ModuleSATopic : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleSATopic() diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 5b92c8a26..50e2c76a6 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -120,12 +120,8 @@ class ModuleServicesAccount : public Module void init() { - ServerInstance->Modules->AddService(m1); - ServerInstance->Modules->AddService(m2); - ServerInstance->Modules->AddService(m3); - ServerInstance->Modules->AddService(m4); - ServerInstance->Modules->AddService(m5); - ServerInstance->Modules->AddService(accountname); + ServiceProvider* providerlist[] = { &m1, &m2, &m3, &m4, &m5, &accountname }; + ServerInstance->Modules->AddServices(providerlist, sizeof(providerlist)/sizeof(ServiceProvider*)); Implementation eventlist[] = { I_OnWhois, I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserPreJoin, I_OnCheckBan, I_OnDecodeMetaData, I_On005Numeric, I_OnUserPostNick, I_OnSetConnectClass }; diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index 4c04fb292..b4f2b5bbd 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -55,8 +55,7 @@ class ModuleServProtectMode : public Module void init() { - if (!ServerInstance->Modes->AddMode(&bm)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(bm); Implementation eventlist[] = { I_OnWhois, I_OnKill, I_OnWhoisLine, I_OnRawMode, I_OnUserPreKick }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 7bd577924..a036085ea 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -82,7 +82,7 @@ class ModuleSetHost : public Module void init() { OnRehash(NULL); - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); Implementation eventlist[] = { I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index 00545e29b..534742097 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -74,7 +74,7 @@ class ModuleSetIdent : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleSetIdent() diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index 3665afbe6..fdb29d14f 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -65,7 +65,7 @@ class ModuleSetIdle : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleSetIdle() diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index 1ca7b1b3f..f89c411b4 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -69,7 +69,7 @@ class ModuleSetName : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleSetName() diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index ba4ba9e6e..434d1b07f 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -87,9 +87,8 @@ class ModuleShowwhois : public Module ShowWhoisFromOpers = tag->getBool("showfromopers", true); sw = new SeeWhois(this, OpersOnly); - if (!ServerInstance->Modes->AddMode(sw)) - throw ModuleException("Could not add new modes!"); - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(*sw); + ServerInstance->Modules->AddService(cmd); Implementation eventlist[] = { I_OnWhois }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 5e13f1090..701152889 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -188,7 +188,7 @@ class ModuleShun : public Module void init() { ServerInstance->XLines->RegisterFactory(&f); - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); Implementation eventlist[] = { I_OnStats, I_OnPreCommand, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index db2ab12d1..ab2134e4c 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -304,9 +304,9 @@ class ModuleSilence : public Module void init() { OnRehash(NULL); - ServerInstance->AddCommand(&cmdsilence); - ServerInstance->AddCommand(&cmdsvssilence); - ServerInstance->Extensions.Register(&cmdsilence.ext); + ServerInstance->Modules->AddService(cmdsilence); + ServerInstance->Modules->AddService(cmdsvssilence); + ServerInstance->Modules->AddService(cmdsilence.ext); Implementation eventlist[] = { I_OnRehash, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage, I_OnUserPreInvite }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 427f3f71c..161e7055c 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -132,9 +132,9 @@ class ModuleSSLInfo : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); - ServerInstance->Extensions.Register(&cmd.CertExt); + ServerInstance->Modules->AddService(cmd.CertExt); Implementation eventlist[] = { I_OnWhois, I_OnPreCommand, I_OnSetConnectClass, I_OnUserConnect, I_OnPostConnect }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index 66a67f05a..c81c74207 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -87,8 +87,7 @@ class ModuleSSLModes : public Module void init() { - if (!ServerInstance->Modes->AddMode(&sslm)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(sslm); Implementation eventlist[] = { I_OnUserPreJoin, I_OnCheckBan, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index e27adf1e1..9915ef7be 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -170,7 +170,7 @@ class ModuleSVSHold : public Module void init() { ServerInstance->XLines->RegisterFactory(&s); - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); Implementation eventlist[] = { I_OnUserPreNick, I_OnStats }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index f581a4808..2e5abe95a 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -92,7 +92,7 @@ class ModuleSWhois : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); ServerInstance->Modules->AddService(cmd.swhois); Implementation eventlist[] = { I_OnWhoisLine, I_OnPostOper }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); diff --git a/src/modules/m_testnet.cpp b/src/modules/m_testnet.cpp index 1dcb73f91..401766d8a 100644 --- a/src/modules/m_testnet.cpp +++ b/src/modules/m_testnet.cpp @@ -220,7 +220,7 @@ class ModuleTest : public Module { if (!strstr(ServerInstance->Config->ServerName.c_str(), ".test")) throw ModuleException("Don't load modules without reading their descriptions!"); - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } Version GetVersion() diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 5023f4c01..90e814a18 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -116,7 +116,7 @@ class ModuleTimedBans : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); Implementation eventlist[] = { I_OnDelBan, I_OnBackgroundTimer }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp index a51776527..b4e7e5a99 100644 --- a/src/modules/m_tline.cpp +++ b/src/modules/m_tline.cpp @@ -77,7 +77,7 @@ class ModuleTLine : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleTLine() diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index 873588c93..618e23892 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -108,7 +108,7 @@ class ModuleUninvite : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleUninvite() diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index c60b2d18d..a28c12444 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -72,7 +72,7 @@ class ModuleUserIP : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); Implementation eventlist[] = { I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index f3bbc1cfc..31c504af8 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -73,7 +73,7 @@ class ModuleVHost : public Module void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleVHost() diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 28ae05286..ec38edc31 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -385,9 +385,9 @@ class Modulewatch : public Module void init() { OnRehash(NULL); - ServerInstance->AddCommand(&cmdw); - ServerInstance->AddCommand(&sw); - ServerInstance->Extensions.Register(&cmdw.ext); + ServerInstance->Modules->AddService(cmdw); + ServerInstance->Modules->AddService(sw); + ServerInstance->Modules->AddService(cmdw.ext); Implementation eventlist[] = { I_OnRehash, I_OnGarbageCollect, I_OnUserQuit, I_OnPostConnect, I_OnUserPostNick, I_On005Numeric, I_OnSetAway }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } -- cgit v1.2.3