From f9911dde529adf3dc03f4f14bbd70756ac2f665c Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 2 Mar 2025 14:51:02 +0000 Subject: 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. --- modules/memoserv/memoserv.cpp | 18 +++++++++--------- modules/memoserv/ms_ignore.cpp | 2 +- modules/memoserv/ms_rsend.cpp | 4 ++-- modules/memoserv/ms_send.cpp | 2 +- modules/memoserv/ms_set.cpp | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'modules/memoserv') diff --git a/modules/memoserv/memoserv.cpp b/modules/memoserv/memoserv.cpp index a1399e8f6..a7baa4daf 100644 --- a/modules/memoserv/memoserv.cpp +++ b/modules/memoserv/memoserv.cpp @@ -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("memo_subject").c_str()), - message = Language::Translate(nc, Config->GetBlock("mail")->Get("memo_message").c_str()); + Anope::string subject = Language::Translate(nc, Config->GetBlock("mail").Get("memo_subject").c_str()), + message = Language::Translate(nc, Config->GetBlock("mail").Get("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("networkname")); + subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo").Get("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("networkname")); + message = message.replace_all_cs("%N", Config->GetBlock("networkinfo").Get("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("senddelay"); + time_t send_delay = Config->GetModule("memoserv").Get("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("client"); + const Anope::string &msnick = conf.GetModule(this).Get("client"); if (msnick.empty()) throw ConfigException(Module::name + ": must be defined"); @@ -165,12 +165,12 @@ public: void OnNickCoreCreate(NickCore *nc) override { - nc->memos.memomax = Config->GetModule(this)->Get("maxmemos"); + nc->memos.memomax = Config->GetModule(this).Get("maxmemos"); } void OnCreateChan(ChannelInfo *ci) override { - ci->memos.memomax = Config->GetModule(this)->Get("maxmemos"); + ci->memos.memomax = Config->GetModule(this).Get("maxmemos"); } void OnBotDelete(BotInfo *bi) override diff --git a/modules/memoserv/ms_ignore.cpp b/modules/memoserv/ms_ignore.cpp index 52ec79944..434a2b4cf 100644 --- a/modules/memoserv/ms_ignore.cpp +++ b/modules/memoserv/ms_ignore.cpp @@ -51,7 +51,7 @@ public: source.Reply(ACCESS_DENIED); else if (command.equals_ci("ADD") && !param.empty()) { - if (mi->ignores.size() >= Config->GetModule(this->owner)->Get("max", "50")) + if (mi->ignores.size() >= Config->GetModule(this->owner).Get("max", "50")) { source.Reply(_("Sorry, the memo ignore list for \002%s\002 is full."), channel.c_str()); return; diff --git a/modules/memoserv/ms_rsend.cpp b/modules/memoserv/ms_rsend.cpp index 8bcb7b3d9..6543e2451 100644 --- a/modules/memoserv/ms_rsend.cpp +++ b/modules/memoserv/ms_rsend.cpp @@ -48,7 +48,7 @@ public: return; } - if (Config->GetModule(this->owner)->Get("operonly") && !source.IsServicesOper()) + if (Config->GetModule(this->owner).Get("operonly") && !source.IsServicesOper()) source.Reply(ACCESS_DENIED); else { @@ -58,7 +58,7 @@ public: else if (result == MemoServService::MEMO_TOO_FAST) { auto lastmemosend = source.GetUser() ? source.GetUser()->lastmemosend : 0; - auto waitperiod = (lastmemosend + Config->GetModule("memoserv")->Get("senddelay")) - Anope::CurTime; + auto waitperiod = (lastmemosend + Config->GetModule("memoserv").Get("senddelay")) - Anope::CurTime; source.Reply(_("Please wait %s before using the %s command again."), Anope::Duration(waitperiod, source.GetAccount()).c_str(), source.command.c_str()); } else if (result == MemoServService::MEMO_TARGET_FULL) diff --git a/modules/memoserv/ms_send.cpp b/modules/memoserv/ms_send.cpp index e1ab3169d..ba025a5ca 100644 --- a/modules/memoserv/ms_send.cpp +++ b/modules/memoserv/ms_send.cpp @@ -57,7 +57,7 @@ public: else if (result == MemoServService::MEMO_TOO_FAST) { auto lastmemosend = source.GetUser() ? source.GetUser()->lastmemosend : 0; - auto waitperiod = (lastmemosend + Config->GetModule("memoserv")->Get("senddelay")) - Anope::CurTime; + auto waitperiod = (lastmemosend + Config->GetModule("memoserv").Get("senddelay")) - Anope::CurTime; source.Reply(_("Please wait %s before using the %s command again."), Anope::Duration(waitperiod, source.GetAccount()).c_str(), source.command.c_str()); } else if (result == MemoServService::MEMO_TARGET_FULL) diff --git a/modules/memoserv/ms_set.cpp b/modules/memoserv/ms_set.cpp index cce30581b..672aeec3b 100644 --- a/modules/memoserv/ms_set.cpp +++ b/modules/memoserv/ms_set.cpp @@ -155,7 +155,7 @@ private: source.Reply(_("You are not permitted to change your memo limit.")); return; } - int max_memos = Config->GetModule("memoserv")->Get("maxmemos"); + int max_memos = Config->GetModule("memoserv").Get("maxmemos"); limit = Anope::Convert(p1, -1); /* The first character is a digit, but we could still go negative @@ -255,7 +255,7 @@ public: "\002ON\002 is essentially \002LOGON\002 and \002NEW\002 combined.")); else if (subcommand.equals_ci("LIMIT")) { - int max_memos = Config->GetModule("memoserv")->Get("maxmemos"); + int max_memos = Config->GetModule("memoserv").Get("maxmemos"); if (source.IsServicesOper()) source.Reply(_("Syntax: \002LIMIT [\037user\037 | \037channel\037] {\037limit\037 | NONE} [HARD]\002\n" " \n" -- cgit