diff options
| author | Sadie Powell <sadie@witchery.services> | 2025-03-02 14:51:02 +0000 |
|---|---|---|
| committer | Sadie Powell <sadie@witchery.services> | 2025-03-02 15:27:47 +0000 |
| commit | f9911dde529adf3dc03f4f14bbd70756ac2f665c (patch) | |
| tree | 7c720e4f82fdb30b7d8a22fc0809f50bc862fae3 /modules/hostserv | |
| parent | a5e5eb5eb084e8343260ce7bc26ea86798f64fe1 (diff) | |
Return references instead of pointers from the config system.
We used to return NULL from these methods but now we return an empty
block so this can never actually be null now.
Diffstat (limited to 'modules/hostserv')
| -rw-r--r-- | modules/hostserv/hostserv.cpp | 10 | ||||
| -rw-r--r-- | modules/hostserv/hs_group.cpp | 8 | ||||
| -rw-r--r-- | modules/hostserv/hs_list.cpp | 2 | ||||
| -rw-r--r-- | modules/hostserv/hs_request.cpp | 16 |
4 files changed, 18 insertions, 18 deletions
diff --git a/modules/hostserv/hostserv.cpp b/modules/hostserv/hostserv.cpp index 9c8266d02..1a38a7666 100644 --- a/modules/hostserv/hostserv.cpp +++ b/modules/hostserv/hostserv.cpp @@ -22,9 +22,9 @@ public: throw ModuleException("Your IRCd does not support vhosts"); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - const Anope::string &hsnick = conf->GetModule(this)->Get<const Anope::string>("client"); + const Anope::string &hsnick = conf.GetModule(this).Get<const Anope::string>("client"); if (hsnick.empty()) throw ConfigException(Module::name + ": <client> must be defined"); @@ -81,7 +81,7 @@ public: void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) override { - if (mname == "OPER" && Config->GetModule(this)->Get<bool>("activate_on_deoper", "yes")) + if (mname == "OPER" && Config->GetModule(this).Get<bool>("activate_on_deoper", "yes")) this->OnUserLogin(u); } @@ -95,7 +95,7 @@ public: void OnSetVHost(NickAlias *na) override { - if (Config->GetModule(this)->Get<bool>("activate_on_set", "yes")) + if (Config->GetModule(this).Get<bool>("activate_on_set", "yes")) { User *u = User::Find(na->nick); @@ -120,7 +120,7 @@ public: void OnDeleteVHost(NickAlias *na) override { - if (Config->GetModule(this)->Get<bool>("activate_on_set", "yes")) + if (Config->GetModule(this).Get<bool>("activate_on_set", "yes")) { User *u = User::Find(na->nick); diff --git a/modules/hostserv/hs_group.cpp b/modules/hostserv/hs_group.cpp index 06c29290e..bf7b5ddca 100644 --- a/modules/hostserv/hs_group.cpp +++ b/modules/hostserv/hs_group.cpp @@ -105,11 +105,11 @@ public: commandhsgroup.Sync(na); } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = conf->GetModule(this); - syncongroup = block->Get<bool>("syncongroup"); - synconset = block->Get<bool>("synconset"); + Configuration::Block &block = conf.GetModule(this); + syncongroup = block.Get<bool>("syncongroup"); + synconset = block.Get<bool>("synconset"); } }; diff --git a/modules/hostserv/hs_list.cpp b/modules/hostserv/hs_list.cpp index 345d62852..174f4baf1 100644 --- a/modules/hostserv/hs_list.cpp +++ b/modules/hostserv/hs_list.cpp @@ -51,7 +51,7 @@ public: } } - unsigned display_counter = 0, listmax = Config->GetModule(this->owner)->Get<unsigned>("listmax", "50"); + unsigned display_counter = 0, listmax = Config->GetModule(this->owner).Get<unsigned>("listmax", "50"); ListFormatter list(source.GetAccount()); list.AddColumn(_("Number")).AddColumn(_("Nick")).AddColumn(_("VHost")).AddColumn(_("Creator")).AddColumn(_("Created")); diff --git a/modules/hostserv/hs_request.cpp b/modules/hostserv/hs_request.cpp index 649462aac..a54184bd3 100644 --- a/modules/hostserv/hs_request.cpp +++ b/modules/hostserv/hs_request.cpp @@ -154,8 +154,8 @@ public: return; } - time_t send_delay = Config->GetModule("memoserv")->Get<time_t>("senddelay"); - if (Config->GetModule(this->owner)->Get<bool>("memooper") && send_delay > 0 && u && u->lastmemosend + send_delay > Anope::CurTime) + time_t send_delay = Config->GetModule("memoserv").Get<time_t>("senddelay"); + if (Config->GetModule(this->owner).Get<bool>("memooper") && send_delay > 0 && u && u->lastmemosend + send_delay > Anope::CurTime) { auto waitperiod = (u->lastmemosend + send_delay) - Anope::CurTime; source.Reply(_("Please wait %s before requesting a new vhost."), Anope::Duration(waitperiod, source.GetAccount()).c_str()); @@ -213,7 +213,7 @@ public: na->SetVHost(req->ident, req->host, source.GetNick(), req->time); FOREACH_MOD(OnSetVHost, (na)); - if (Config->GetModule(this->owner)->Get<bool>("memouser") && memoserv) + if (Config->GetModule(this->owner).Get<bool>("memouser") && memoserv) memoserv->Send(source.service->nick, na->nick, _("[auto memo] Your requested vhost has been approved."), true); source.Reply(_("VHost for %s has been activated."), na->nick.c_str()); @@ -229,7 +229,7 @@ public: this->SendSyntax(source); source.Reply(" "); source.Reply(_("Activate the requested vhost for the given nick.")); - if (Config->GetModule(this->owner)->Get<bool>("memouser")) + if (Config->GetModule(this->owner).Get<bool>("memouser")) source.Reply(_("A memo informing the user will also be sent.")); return true; @@ -263,7 +263,7 @@ public: { na->Shrink<HostRequestImpl>("hostrequest"); - if (Config->GetModule(this->owner)->Get<bool>("memouser") && memoserv) + if (Config->GetModule(this->owner).Get<bool>("memouser") && memoserv) { Anope::string message; if (!reason.empty()) @@ -286,7 +286,7 @@ public: this->SendSyntax(source); source.Reply(" "); source.Reply(_("Reject the requested vhost for the given nick.")); - if (Config->GetModule(this->owner)->Get<bool>("memouser")) + if (Config->GetModule(this->owner).Get<bool>("memouser")) source.Reply(_("A memo informing the user will also be sent, which includes the reason for the rejection if supplied.")); return true; @@ -305,7 +305,7 @@ public: void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { unsigned counter = 0; - unsigned display_counter = 0, listmax = Config->GetModule(this->owner)->Get<unsigned>("listmax"); + unsigned display_counter = 0, listmax = Config->GetModule(this->owner).Get<unsigned>("listmax"); ListFormatter list(source.GetAccount()); list.AddColumn(_("Number")).AddColumn(_("Nick")).AddColumn(_("VHost")).AddColumn(_("Created")); @@ -380,7 +380,7 @@ static void req_send_memos(Module *me, CommandSource &source, const Anope::strin else host = vhost; - if (Config->GetModule(me)->Get<bool>("memooper") && memoserv) + if (Config->GetModule(me).Get<bool>("memooper") && memoserv) { for (auto *o : Oper::opers) { |
