1
0
mirror of https://github.com/anope/anope.git synced 2026-07-09 22:23: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
+9 -9
View File
@@ -19,20 +19,20 @@ class MemoServCore final
static bool SendMemoMail(NickCore *nc, MemoInfo *mi, Memo *m)
{
Anope::string subject = Language::Translate(nc, Config->GetBlock("mail")->Get<const Anope::string>("memo_subject").c_str()),
message = Language::Translate(nc, Config->GetBlock("mail")->Get<const Anope::string>("memo_message").c_str());
Anope::string subject = Language::Translate(nc, Config->GetBlock("mail").Get<const Anope::string>("memo_subject").c_str()),
message = Language::Translate(nc, Config->GetBlock("mail").Get<const Anope::string>("memo_message").c_str());
subject = subject.replace_all_cs("%n", nc->display);
subject = subject.replace_all_cs("%s", m->sender);
subject = subject.replace_all_cs("%d", Anope::ToString(mi->GetIndex(m) + 1));
subject = subject.replace_all_cs("%t", m->text);
subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname"));
message = message.replace_all_cs("%n", nc->display);
message = message.replace_all_cs("%s", m->sender);
message = message.replace_all_cs("%d", Anope::ToString(mi->GetIndex(m) + 1));
message = message.replace_all_cs("%t", m->text);
message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
message = message.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname"));
return Mail::Send(nc, subject, message);
}
@@ -58,7 +58,7 @@ public:
{
if (!sender->HasPriv("memoserv/no-limit") && !force)
{
time_t send_delay = Config->GetModule("memoserv")->Get<time_t>("senddelay");
time_t send_delay = Config->GetModule("memoserv").Get<time_t>("senddelay");
if (send_delay > 0 && sender->lastmemosend + send_delay > Anope::CurTime)
return MEMO_TOO_FAST;
else if (!mi->memomax)
@@ -149,9 +149,9 @@ public:
}
}
void OnReload(Configuration::Conf *conf) override
void OnReload(Configuration::Conf &conf) override
{
const Anope::string &msnick = conf->GetModule(this)->Get<const Anope::string>("client");
const Anope::string &msnick = conf.GetModule(this).Get<const Anope::string>("client");
if (msnick.empty())
throw ConfigException(Module::name + ": <client> must be defined");
@@ -165,12 +165,12 @@ public:
void OnNickCoreCreate(NickCore *nc) override
{
nc->memos.memomax = Config->GetModule(this)->Get<int>("maxmemos");
nc->memos.memomax = Config->GetModule(this).Get<int>("maxmemos");
}
void OnCreateChan(ChannelInfo *ci) override
{
ci->memos.memomax = Config->GetModule(this)->Get<int>("maxmemos");
ci->memos.memomax = Config->GetModule(this).Get<int>("maxmemos");
}
void OnBotDelete(BotInfo *bi) override