1
0
mirror of https://github.com/anope/anope.git synced 2026-07-03 02:13:12 +02:00

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.
This commit is contained in:
Sadie Powell
2025-03-02 14:51:02 +00:00
parent a5e5eb5eb0
commit f9911dde52
124 changed files with 811 additions and 809 deletions
+4 -4
View File
@@ -250,7 +250,7 @@ public:
Anope::string GetAgent() override
{
Anope::string agent = Config->GetModule(Service::owner)->Get<Anope::string>("agent", "NickServ");
Anope::string agent = Config->GetModule(Service::owner).Get<Anope::string>("agent", "NickServ");
BotInfo *bi = Config->GetClient(agent);
if (bi)
agent = bi->GetUID();
@@ -326,7 +326,7 @@ public:
return;
}
const auto badpasslimit = Config->GetBlock("options")->Get<int>("badpasslimit");
const auto badpasslimit = Config->GetBlock("options").Get<int>("badpasslimit");
if (!badpasslimit)
return;
@@ -335,7 +335,7 @@ public:
it = badpasswords.emplace(session->uid, std::make_pair(0, 0)).first;
auto &[invalid_pw_time, invalid_pw_count] = it->second;
const auto badpasstimeout = Config->GetBlock("options")->Get<time_t>("badpasstimeout");
const auto badpasstimeout = Config->GetBlock("options").Get<time_t>("badpasstimeout");
if (badpasstimeout > 0 && invalid_pw_time > 0 && invalid_pw_time < Anope::CurTime - badpasstimeout)
invalid_pw_count = 0;
@@ -360,7 +360,7 @@ public:
void Tick() override
{
const auto badpasstimeout = Config->GetBlock("options")->Get<time_t>("badpasstimeout");
const auto badpasstimeout = Config->GetBlock("options").Get<time_t>("badpasstimeout");
for (auto it = badpasswords.begin(); it != badpasswords.end(); )
{
if (it->second.first + badpasstimeout < Anope::CurTime)