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/memoserv | |
| 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/memoserv')
| -rw-r--r-- | modules/memoserv/memoserv.cpp | 18 | ||||
| -rw-r--r-- | modules/memoserv/ms_ignore.cpp | 2 | ||||
| -rw-r--r-- | modules/memoserv/ms_rsend.cpp | 4 | ||||
| -rw-r--r-- | modules/memoserv/ms_send.cpp | 2 | ||||
| -rw-r--r-- | modules/memoserv/ms_set.cpp | 4 |
5 files changed, 15 insertions, 15 deletions
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<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 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<unsigned>("max", "50")) + if (mi->ignores.size() >= Config->GetModule(this->owner).Get<unsigned>("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<bool>("operonly") && !source.IsServicesOper()) + if (Config->GetModule(this->owner).Get<bool>("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<unsigned long>("senddelay")) - Anope::CurTime; + auto waitperiod = (lastmemosend + Config->GetModule("memoserv").Get<unsigned long>("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<unsigned long>("senddelay")) - Anope::CurTime; + auto waitperiod = (lastmemosend + Config->GetModule("memoserv").Get<unsigned long>("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<int>("maxmemos"); + int max_memos = Config->GetModule("memoserv").Get<int>("maxmemos"); limit = Anope::Convert<int16_t>(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<int>("maxmemos"); + int max_memos = Config->GetModule("memoserv").Get<int>("maxmemos"); if (source.IsServicesOper()) source.Reply(_("Syntax: \002LIMIT [\037user\037 | \037channel\037] {\037limit\037 | NONE} [HARD]\002\n" " \n" |
