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/dnsbl.cpp | |
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/dnsbl.cpp')
-rw-r--r-- | modules/dnsbl.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/modules/dnsbl.cpp b/modules/dnsbl.cpp index deedd85e2..6db41ba84 100644 --- a/modules/dnsbl.cpp +++ b/modules/dnsbl.cpp @@ -77,7 +77,7 @@ public: reason = reason.replace_all_cs("%h", user->host); reason = reason.replace_all_cs("%i", addr); reason = reason.replace_all_cs("%r", reply ? reply->reason : ""); - reason = reason.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname")); + reason = reason.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname")); BotInfo *OperServ = Config->GetClient("OperServ"); Log(creator, "dnsbl", OperServ) << user->GetMask() << " (" << addr << ") appears in " << this->blacklist.name; @@ -110,33 +110,33 @@ public: } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *block = conf->GetModule(this); - this->check_on_connect = block->Get<bool>("check_on_connect"); - this->check_on_netburst = block->Get<bool>("check_on_netburst"); - this->add_to_akill = block->Get<bool>("add_to_akill", "yes"); + Configuration::Block &block = conf.GetModule(this); + this->check_on_connect = block.Get<bool>("check_on_connect"); + this->check_on_netburst = block.Get<bool>("check_on_netburst"); + this->add_to_akill = block.Get<bool>("add_to_akill", "yes"); this->blacklists.clear(); - for (int i = 0; i < block->CountBlock("blacklist"); ++i) + for (int i = 0; i < block.CountBlock("blacklist"); ++i) { - Configuration::Block *bl = block->GetBlock("blacklist", i); + Configuration::Block &bl = block.GetBlock("blacklist", i); Blacklist blacklist; - blacklist.name = bl->Get<Anope::string>("name"); + blacklist.name = bl.Get<Anope::string>("name"); if (blacklist.name.empty()) continue; - blacklist.bantime = bl->Get<time_t>("time", "4h"); - blacklist.reason = bl->Get<Anope::string>("reason"); + blacklist.bantime = bl.Get<time_t>("time", "4h"); + blacklist.reason = bl.Get<Anope::string>("reason"); - for (int j = 0; j < bl->CountBlock("reply"); ++j) + for (int j = 0; j < bl.CountBlock("reply"); ++j) { - Configuration::Block *reply = bl->GetBlock("reply", j); + Configuration::Block &reply = bl.GetBlock("reply", j); Blacklist::Reply r; - r.code = reply->Get<int>("code"); - r.reason = reply->Get<Anope::string>("reason"); - r.allow_account = reply->Get<bool>("allow_account"); + r.code = reply.Get<int>("code"); + r.reason = reply.Get<Anope::string>("reason"); + r.allow_account = reply.Get<bool>("allow_account"); blacklist.replies.push_back(r); } @@ -145,10 +145,10 @@ public: } this->exempts.clear(); - for (int i = 0; i < block->CountBlock("exempt"); ++i) + for (int i = 0; i < block.CountBlock("exempt"); ++i) { - Configuration::Block *bl = block->GetBlock("exempt", i); - this->exempts.insert(bl->Get<Anope::string>("ip")); + Configuration::Block &bl = block.GetBlock("exempt", i); + this->exempts.insert(bl.Get<Anope::string>("ip")); } } |