summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2025-03-02 14:51:02 +0000
committerSadie Powell <sadie@witchery.services>2025-03-02 15:27:47 +0000
commitf9911dde529adf3dc03f4f14bbd70756ac2f665c (patch)
tree7c720e4f82fdb30b7d8a22fc0809f50bc862fae3
parenta5e5eb5eb084e8343260ce7bc26ea86798f64fe1 (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.
-rw-r--r--include/config.h8
-rw-r--r--include/modules.h2
-rw-r--r--include/modules/sasl.h2
-rw-r--r--modules/botserv/botserv.cpp30
-rw-r--r--modules/botserv/bs_autoassign.cpp2
-rw-r--r--modules/botserv/bs_badwords.cpp4
-rw-r--r--modules/botserv/bs_kick.cpp10
-rw-r--r--modules/botserv/bs_set.cpp4
-rw-r--r--modules/chanserv/chanserv.cpp32
-rw-r--r--modules/chanserv/cs_access.cpp20
-rw-r--r--modules/chanserv/cs_akick.cpp8
-rw-r--r--modules/chanserv/cs_ban.cpp12
-rw-r--r--modules/chanserv/cs_clone.cpp2
-rw-r--r--modules/chanserv/cs_entrymsg.cpp2
-rw-r--r--modules/chanserv/cs_fantasy_stats.cpp6
-rw-r--r--modules/chanserv/cs_fantasy_top.cpp6
-rw-r--r--modules/chanserv/cs_flags.cpp16
-rw-r--r--modules/chanserv/cs_kick.cpp4
-rw-r--r--modules/chanserv/cs_list.cpp6
-rw-r--r--modules/chanserv/cs_log.cpp14
-rw-r--r--modules/chanserv/cs_mode.cpp18
-rw-r--r--modules/chanserv/cs_register.cpp2
-rw-r--r--modules/chanserv/cs_seen.cpp6
-rw-r--r--modules/chanserv/cs_set.cpp18
-rw-r--r--modules/chanserv/cs_set_misc.cpp14
-rw-r--r--modules/chanserv/cs_suspend.cpp6
-rw-r--r--modules/chanserv/cs_xop.cpp24
-rw-r--r--modules/chanstats.cpp20
-rw-r--r--modules/database/db_atheme.cpp18
-rw-r--r--modules/database/db_flatfile.cpp18
-rw-r--r--modules/database/db_old.cpp2
-rw-r--r--modules/database/db_redis.cpp6
-rw-r--r--modules/database/db_sql.cpp10
-rw-r--r--modules/database/db_sql_live.cpp10
-rw-r--r--modules/dns.cpp26
-rw-r--r--modules/dnsbl.cpp38
-rw-r--r--modules/encryption/enc_bcrypt.cpp6
-rw-r--r--modules/encryption/enc_sha2.cpp4
-rw-r--r--modules/extra/enc_argon2.cpp16
-rw-r--r--modules/extra/ldap.cpp22
-rw-r--r--modules/extra/mysql.cpp28
-rw-r--r--modules/extra/sqlite.cpp16
-rw-r--r--modules/extra/ssl_gnutls.cpp14
-rw-r--r--modules/extra/ssl_openssl.cpp18
-rw-r--r--modules/extra/xmlrpc.cpp4
-rw-r--r--modules/fantasy.cpp4
-rw-r--r--modules/global/gl_queue.cpp2
-rw-r--r--modules/global/global.cpp12
-rw-r--r--modules/help.cpp4
-rw-r--r--modules/helpchan.cpp2
-rw-r--r--modules/hostserv/hostserv.cpp10
-rw-r--r--modules/hostserv/hs_group.cpp8
-rw-r--r--modules/hostserv/hs_list.cpp2
-rw-r--r--modules/hostserv/hs_request.cpp16
-rw-r--r--modules/httpd.cpp22
-rw-r--r--modules/irc2sql/irc2sql.cpp16
-rw-r--r--modules/irc2sql/irc2sql.h2
-rw-r--r--modules/ldap_authentication.cpp22
-rw-r--r--modules/ldap_oper.cpp14
-rw-r--r--modules/memoserv/memoserv.cpp18
-rw-r--r--modules/memoserv/ms_ignore.cpp2
-rw-r--r--modules/memoserv/ms_rsend.cpp4
-rw-r--r--modules/memoserv/ms_send.cpp2
-rw-r--r--modules/memoserv/ms_set.cpp4
-rw-r--r--modules/nickserv/nickserv.cpp56
-rw-r--r--modules/nickserv/ns_ajoin.cpp4
-rw-r--r--modules/nickserv/ns_cert.cpp10
-rw-r--r--modules/nickserv/ns_drop.cpp4
-rw-r--r--modules/nickserv/ns_group.cpp14
-rw-r--r--modules/nickserv/ns_identify.cpp2
-rw-r--r--modules/nickserv/ns_list.cpp4
-rw-r--r--modules/nickserv/ns_maxemail.cpp6
-rw-r--r--modules/nickserv/ns_recover.cpp8
-rw-r--r--modules/nickserv/ns_register.cpp48
-rw-r--r--modules/nickserv/ns_resetpass.cpp10
-rw-r--r--modules/nickserv/ns_set.cpp32
-rw-r--r--modules/nickserv/ns_set_keepmodes.cpp2
-rw-r--r--modules/nickserv/ns_set_kill.cpp4
-rw-r--r--modules/nickserv/ns_set_misc.cpp12
-rw-r--r--modules/nickserv/ns_suspend.cpp8
-rw-r--r--modules/operserv/operserv.cpp6
-rw-r--r--modules/operserv/os_akill.cpp14
-rw-r--r--modules/operserv/os_chankill.cpp4
-rw-r--r--modules/operserv/os_config.cpp14
-rw-r--r--modules/operserv/os_defcon.cpp47
-rw-r--r--modules/operserv/os_dns.cpp18
-rw-r--r--modules/operserv/os_forbid.cpp8
-rw-r--r--modules/operserv/os_ignore.cpp2
-rw-r--r--modules/operserv/os_info.cpp2
-rw-r--r--modules/operserv/os_kill.cpp2
-rw-r--r--modules/operserv/os_list.cpp4
-rw-r--r--modules/operserv/os_logsearch.cpp2
-rw-r--r--modules/operserv/os_news.cpp16
-rw-r--r--modules/operserv/os_session.cpp22
-rw-r--r--modules/operserv/os_set.cpp2
-rw-r--r--modules/operserv/os_shutdown.cpp18
-rw-r--r--modules/operserv/os_stats.cpp6
-rw-r--r--modules/operserv/os_sxline.cpp26
-rw-r--r--modules/protocol/hybrid.cpp2
-rw-r--r--modules/protocol/inspircd.cpp6
-rw-r--r--modules/proxyscan.cpp34
-rw-r--r--modules/redis.cpp16
-rw-r--r--modules/regex_stdlib.cpp6
-rw-r--r--modules/rewrite.cpp16
-rw-r--r--modules/rpc/jsonrpc.cpp4
-rw-r--r--modules/sasl.cpp8
-rw-r--r--modules/sql_authentication.cpp12
-rw-r--r--modules/sql_log.cpp6
-rw-r--r--modules/sql_oper.cpp8
-rw-r--r--modules/webcpanel/pages/register.cpp2
-rw-r--r--modules/webcpanel/webcpanel.cpp8
-rw-r--r--src/command.cpp2
-rw-r--r--src/config.cpp227
-rw-r--r--src/init.cpp36
-rw-r--r--src/language.cpp2
-rw-r--r--src/mail.cpp26
-rw-r--r--src/main.cpp4
-rw-r--r--src/messages.cpp6
-rw-r--r--src/misc.cpp2
-rw-r--r--src/modulemanager.cpp2
-rw-r--r--src/protocol.cpp18
-rw-r--r--src/uplink.cpp6
-rw-r--r--src/users.cpp6
-rw-r--r--src/xline.cpp4
124 files changed, 814 insertions, 812 deletions
diff --git a/include/config.h b/include/config.h
index 2f4f1b953..d705fd422 100644
--- a/include/config.h
+++ b/include/config.h
@@ -41,7 +41,7 @@ namespace Configuration
Block(const Anope::string &);
const Anope::string &GetName() const;
int CountBlock(const Anope::string &name) const;
- const Block *GetBlock(const Anope::string &name, int num = 0) const;
+ const Block &GetBlock(const Anope::string &name, int num = 0) const;
Block *GetMutableBlock(const Anope::string &name, int num = 0);
template<typename T> T Get(const Anope::string &tag, const Anope::string &def = "") const
@@ -126,12 +126,12 @@ namespace Configuration
void LoadConf(File &file);
void Post(Conf *old);
- Block *GetModule(const Module *);
- Block *GetModule(const Anope::string &name);
+ Block &GetModule(const Module *);
+ Block &GetModule(const Anope::string &name);
BotInfo *GetClient(const Anope::string &name);
- const Block *GetCommand(CommandSource &);
+ const Block &GetCommand(CommandSource &);
};
struct Uplink final
diff --git a/include/modules.h b/include/modules.h
index 12637b1b4..8a7702ac7 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -305,7 +305,7 @@ public:
* @param conf The config that is being built now and will replace the global Config object
* @throws A ConfigException to abort the config (re)loading process.
*/
- virtual void OnReload(Configuration::Conf *conf) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
+ virtual void OnReload(Configuration::Conf &conf) { throw NotImplementedException(); }
/** Called before a bot is assigned to a channel.
* @param sender The user assigning the bot
diff --git a/include/modules/sasl.h b/include/modules/sasl.h
index d051e2e61..5f8d0e9c3 100644
--- a/include/modules/sasl.h
+++ b/include/modules/sasl.h
@@ -121,7 +121,7 @@ namespace SASL
if (!na || na->nc->HasExt("NS_SUSPENDED") || na->nc->HasExt("UNCONFIRMED"))
return OnFail();
- unsigned int maxlogins = Config->GetModule("ns_identify")->Get<unsigned int>("maxlogins");
+ unsigned int maxlogins = Config->GetModule("ns_identify").Get<unsigned int>("maxlogins");
if (maxlogins && na->nc->users.size() >= maxlogins)
return OnFail();
diff --git a/modules/botserv/botserv.cpp b/modules/botserv/botserv.cpp
index 0646668be..e77ffe46c 100644
--- a/modules/botserv/botserv.cpp
+++ b/modules/botserv/botserv.cpp
@@ -23,9 +23,9 @@ public:
{
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- const Anope::string &bsnick = conf->GetModule(this)->Get<const Anope::string>("client");
+ const Anope::string &bsnick = conf.GetModule(this).Get<const Anope::string>("client");
BotServ = BotInfo::Find(bsnick, true);
}
@@ -34,7 +34,7 @@ public:
/* Do not allow removing bot modes on our service bots */
if (chan->ci && chan->ci->bi == user)
{
- const Anope::string &botmodes = Config->GetModule(this)->Get<const Anope::string>("botmodes");
+ const Anope::string &botmodes = Config->GetModule(this).Get<const Anope::string>("botmodes");
for (auto botmode : botmodes)
chan->SetMode(chan->ci->bi, ModeManager::FindChannelModeByChar(botmode), chan->ci->bi->GetUID());
}
@@ -42,9 +42,9 @@ public:
void OnBotAssign(User *sender, ChannelInfo *ci, BotInfo *bi) override
{
- if (ci->c && ci->c->users.size() >= Config->GetModule(this)->Get<unsigned>("minusers"))
+ if (ci->c && ci->c->users.size() >= Config->GetModule(this).Get<unsigned>("minusers"))
{
- ChannelStatus status(Config->GetModule(this)->Get<const Anope::string>("botmodes"));
+ ChannelStatus status(Config->GetModule(this).Get<const Anope::string>("botmodes"));
bi->Join(ci->c, &status);
}
}
@@ -55,7 +55,7 @@ public:
return;
BotInfo *bi = user->server == Me ? dynamic_cast<BotInfo *>(user) : NULL;
- if (bi && Config->GetModule(this)->Get<bool>("smartjoin"))
+ if (bi && Config->GetModule(this).Get<bool>("smartjoin"))
{
if (IRCD->CanClearBans)
{
@@ -99,9 +99,9 @@ public:
* legit users - Rob
**/
/* This is before the user has joined the channel, so check usercount + 1 */
- if (c->users.size() + 1 >= Config->GetModule(this)->Get<unsigned>("minusers") && !c->FindUser(c->ci->bi))
+ if (c->users.size() + 1 >= Config->GetModule(this).Get<unsigned>("minusers") && !c->FindUser(c->ci->bi))
{
- ChannelStatus status(Config->GetModule(this)->Get<const Anope::string>("botmodes"));
+ ChannelStatus status(Config->GetModule(this).Get<const Anope::string>("botmodes"));
c->ci->bi->Join(c, &status);
}
}
@@ -124,7 +124,7 @@ public:
return;
/* This is called prior to removing the user from the channel, so c->users.size() - 1 should be safe */
- if (c->ci && c->ci->bi && u != *c->ci->bi && c->users.size() - 1 <= Config->GetModule(this)->Get<unsigned>("minusers") && c->FindUser(c->ci->bi))
+ if (c->ci && c->ci->bi && u != *c->ci->bi && c->users.size() - 1 <= Config->GetModule(this).Get<unsigned>("minusers") && c->FindUser(c->ci->bi))
c->ci->bi->Part(c->ci->c);
}
@@ -140,7 +140,7 @@ public:
"channel, and provide a more convenient way to execute commands. Commands that\n"
"require a channel as a parameter will automatically have that parameter\n"
"given.\n"), source.service->nick.c_str());
- const Anope::string &fantasycharacters = Config->GetModule("fantasy")->Get<const Anope::string>("fantasycharacter", "!");
+ const Anope::string &fantasycharacters = Config->GetModule("fantasy").Get<const Anope::string>("fantasycharacter", "!");
if (!fantasycharacters.empty())
source.Reply(_(" \n"
"Fantasy commands may be prefixed with one of the following characters: %s\n"), fantasycharacters.c_str());
@@ -170,8 +170,8 @@ public:
source.Reply(_(" \n"
"Bot will join a channel whenever there is at least\n"
- "\002%d\002 user(s) on it."), Config->GetModule(this)->Get<unsigned>("minusers"));
- const Anope::string &fantasycharacters = Config->GetModule("fantasy")->Get<const Anope::string>("fantasycharacter", "!");
+ "\002%d\002 user(s) on it."), Config->GetModule(this).Get<unsigned>("minusers"));
+ const Anope::string &fantasycharacters = Config->GetModule("fantasy").Get<const Anope::string>("fantasycharacter", "!");
if (!fantasycharacters.empty())
source.Reply(_("Additionally, if fantasy is enabled fantasy commands\n"
"can be executed by prefixing the command name with\n"
@@ -180,7 +180,7 @@ public:
EventReturn OnChannelModeSet(Channel *c, MessageSource &source, ChannelMode *mode, const Anope::string &param) override
{
- if (source.GetUser() && !source.GetBot() && Config->GetModule(this)->Get<bool>("smartjoin") && mode->name == "BAN" && c->ci && c->ci->bi && c->FindUser(c->ci->bi))
+ if (source.GetUser() && !source.GetBot() && Config->GetModule(this).Get<bool>("smartjoin") && mode->name == "BAN" && c->ci && c->ci->bi && c->FindUser(c->ci->bi))
{
BotInfo *bi = c->ci->bi;
@@ -195,7 +195,7 @@ public:
void OnCreateChan(ChannelInfo *ci) override
{
/* Set default bot flags */
- spacesepstream sep(Config->GetModule(this)->Get<const Anope::string>("defaults", "greet fantasy"));
+ spacesepstream sep(Config->GetModule(this).Get<const Anope::string>("defaults", "greet fantasy"));
for (Anope::string token; sep.GetToken(token);)
ci->Extend<bool>("BS_" + token.upper());
}
@@ -211,7 +211,7 @@ public:
void OnCreateBot(BotInfo *bi) override
{
if (bi->botmodes.empty())
- bi->botmodes = Config->GetModule(this)->Get<const Anope::string>("botumodes");
+ bi->botmodes = Config->GetModule(this).Get<const Anope::string>("botumodes");
}
};
diff --git a/modules/botserv/bs_autoassign.cpp b/modules/botserv/bs_autoassign.cpp
index e988540fe..5292f8642 100644
--- a/modules/botserv/bs_autoassign.cpp
+++ b/modules/botserv/bs_autoassign.cpp
@@ -19,7 +19,7 @@ public:
void OnChanRegistered(ChannelInfo *ci) override
{
- const Anope::string &bot = Config->GetModule(this)->Get<const Anope::string>("bot");
+ const Anope::string &bot = Config->GetModule(this).Get<const Anope::string>("bot");
if (bot.empty())
return;
diff --git a/modules/botserv/bs_badwords.cpp b/modules/botserv/bs_badwords.cpp
index 5301fd042..95f749488 100644
--- a/modules/botserv/bs_badwords.cpp
+++ b/modules/botserv/bs_badwords.cpp
@@ -286,14 +286,14 @@ private:
realword = word.substr(0, pos);
}
- unsigned badwordsmax = Config->GetModule(this->module)->Get<unsigned>("badwordsmax");
+ unsigned badwordsmax = Config->GetModule(this->module).Get<unsigned>("badwordsmax");
if (badwords->GetBadWordCount() >= badwordsmax)
{
source.Reply(_("Sorry, you can only have %d bad words entries on a channel."), badwordsmax);
return;
}
- bool casesensitive = Config->GetModule(this->module)->Get<bool>("casesensitive");
+ bool casesensitive = Config->GetModule(this->module).Get<bool>("casesensitive");
for (unsigned i = 0, end = badwords->GetBadWordCount(); i < end; ++i)
{
diff --git a/modules/botserv/bs_kick.cpp b/modules/botserv/bs_kick.cpp
index caaa51b01..eba2868a6 100644
--- a/modules/botserv/bs_kick.cpp
+++ b/modules/botserv/bs_kick.cpp
@@ -515,8 +515,8 @@ public:
if (kd->floodsecs < 1)
kd->floodsecs = 10;
- if (kd->floodsecs > Config->GetModule(me)->Get<time_t>("keepdata"))
- kd->floodsecs = Config->GetModule(me)->Get<time_t>("keepdata");
+ if (kd->floodsecs > Config->GetModule(me).Get<time_t>("keepdata"))
+ kd->floodsecs = Config->GetModule(me).Get<time_t>("keepdata");
kd->flood = true;
if (kd->ttb[TTB_FLOOD])
@@ -913,7 +913,7 @@ public:
void purge()
{
- time_t keepdata = Config->GetModule(me)->Get<time_t>("keepdata");
+ time_t keepdata = Config->GetModule(me).Get<time_t>("keepdata");
for (data_type::iterator it = data_map.begin(), it_end = data_map.end(); it != it_end;)
{
const Anope::string &user = it->first;
@@ -1299,7 +1299,7 @@ public:
/* Normalize the buffer */
Anope::string nbuf = Anope::NormalizeBuffer(realbuf);
- bool casesensitive = Config->GetModule("botserv")->Get<bool>("casesensitive");
+ bool casesensitive = Config->GetModule("botserv").Get<bool>("casesensitive");
/* Normalize can return an empty string if this only contains control codes etc */
if (badwords && !nbuf.empty())
@@ -1368,7 +1368,7 @@ public:
if (mustkick)
{
check_ban(ci, u, kd, TTB_BADWORDS);
- if (Config->GetModule(me)->Get<bool>("gentlebadwordreason"))
+ if (Config->GetModule(me).Get<bool>("gentlebadwordreason"))
bot_kick(ci, u, _("Watch your language!"));
else
bot_kick(ci, u, _("Don't use the word \"%s\" on this channel!"), bw->word.c_str());
diff --git a/modules/botserv/bs_set.cpp b/modules/botserv/bs_set.cpp
index 1ab00205d..9b536e19a 100644
--- a/modules/botserv/bs_set.cpp
+++ b/modules/botserv/bs_set.cpp
@@ -33,8 +33,8 @@ public:
source.Reply(_("Configures bot options.\n"
" \n"
"Available options:"));
- bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"),
- hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands");
+ bool hide_privileged_commands = Config->GetBlock("options").Get<bool>("hideprivilegedcommands"),
+ hide_registered_commands = Config->GetBlock("options").Get<bool>("hideregisteredcommands");
Anope::string this_name = source.command;
for (const auto &[c_name, info] : source.service->commands)
{
diff --git a/modules/chanserv/chanserv.cpp b/modules/chanserv/chanserv.cpp
index f4ba4c007..cca234812 100644
--- a/modules/chanserv/chanserv.cpp
+++ b/modules/chanserv/chanserv.cpp
@@ -14,8 +14,8 @@
inline static Anope::string BotModes()
{
- return Config->GetModule("botserv")->Get<Anope::string>("botmodes",
- Config->GetModule("chanserv")->Get<Anope::string>("botmodes", "o")
+ return Config->GetModule("botserv").Get<Anope::string>("botmodes",
+ Config->GetModule("chanserv").Get<Anope::string>("botmodes", "o")
);
}
@@ -52,7 +52,7 @@ public:
* @param chan The channel
*/
ChanServTimer(Reference<BotInfo> &cs, ExtensibleItem<bool> &i, Module *m, Channel *chan)
- : Timer(m, Config->GetModule(m)->Get<time_t>("inhabit", "1m"))
+ : Timer(m, Config->GetModule(m).Get<time_t>("inhabit", "1m"))
, ChanServ(cs)
, inhabit(i)
, c(chan)
@@ -103,9 +103,9 @@ public:
new ChanServTimer(ChanServ, inhabit, this->owner, c);
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- const Anope::string &channick = conf->GetModule(this)->Get<const Anope::string>("client");
+ const Anope::string &channick = conf.GetModule(this).Get<const Anope::string>("client");
if (channick.empty())
throw ConfigException(Module::name + ": <client> must be defined");
@@ -116,7 +116,7 @@ public:
ChanServ = bi;
- spacesepstream(conf->GetModule(this)->Get<const Anope::string>("defaults", "keeptopic peace securefounder signkick")).GetTokens(defaults);
+ spacesepstream(conf.GetModule(this).Get<const Anope::string>("defaults", "keeptopic peace securefounder signkick")).GetTokens(defaults);
if (defaults.empty())
{
defaults.emplace_back("KEEPTOPIC");
@@ -127,7 +127,7 @@ public:
else if (defaults[0].equals_ci("none"))
defaults.clear();
- always_lower = conf->GetModule(this)->Get<bool>("always_lower_ts");
+ always_lower = conf.GetModule(this).Get<bool>("always_lower_ts");
}
void OnBotDelete(BotInfo *bi) override
@@ -138,7 +138,7 @@ public:
EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) override
{
- if (bi == ChanServ && Config->GetModule(this)->Get<bool>("opersonly") && !u->HasMode("OPER"))
+ if (bi == ChanServ && Config->GetModule(this).Get<bool>("opersonly") && !u->HasMode("OPER"))
{
u->SendMessage(bi, ACCESS_DENIED);
return EVENT_STOP;
@@ -151,7 +151,7 @@ public:
{
std::deque<ChannelInfo *> chans;
nc->GetChannelReferences(chans);
- int max_reg = Config->GetModule(this)->Get<int>("maxregistered");
+ int max_reg = Config->GetModule(this).Get<int>("maxregistered");
for (auto *ci : chans)
{
@@ -247,7 +247,7 @@ public:
{
ci->c->RemoveMode(ci->WhoSends(), "REGISTERED", "", false);
- const Anope::string &require = Config->GetModule(this)->Get<const Anope::string>("require");
+ const Anope::string &require = Config->GetModule(this).Get<const Anope::string>("require");
if (!require.empty())
ci->c->SetModes(ci->WhoSends(), false, "-%s", require.c_str());
}
@@ -272,7 +272,7 @@ public:
{
if (!params.empty() || source.c || source.service != *ChanServ)
return;
- time_t chanserv_expire = Config->GetModule(this)->Get<time_t>("expire", "30d");
+ time_t chanserv_expire = Config->GetModule(this).Get<time_t>("expire", "30d");
if (chanserv_expire >= 86400)
source.Reply(_(" \n"
"Note that any channel which is not used for %lu days\n"
@@ -295,7 +295,7 @@ public:
else
c->RemoveMode(c->WhoSends(), "REGISTERED", "", false);
- const Anope::string &require = Config->GetModule(this)->Get<const Anope::string>("require");
+ const Anope::string &require = Config->GetModule(this).Get<const Anope::string>("require");
if (!require.empty())
{
if (c->ci)
@@ -314,8 +314,8 @@ public:
EventReturn OnCanSet(User *u, const ChannelMode *cm) override
{
- if (Config->GetModule(this)->Get<const Anope::string>("nomlock").find(cm->mchar) != Anope::string::npos
- || Config->GetModule(this)->Get<const Anope::string>("require").find(cm->mchar) != Anope::string::npos)
+ if (Config->GetModule(this).Get<const Anope::string>("nomlock").find(cm->mchar) != Anope::string::npos
+ || Config->GetModule(this).Get<const Anope::string>("require").find(cm->mchar) != Anope::string::npos)
return EVENT_STOP;
return EVENT_CONTINUE;
}
@@ -337,7 +337,7 @@ public:
void OnExpireTick() override
{
- time_t chanserv_expire = Config->GetModule(this)->Get<time_t>("expire", "30d");
+ time_t chanserv_expire = Config->GetModule(this).Get<time_t>("expire", "30d");
if (!chanserv_expire || Anope::NoExpire || Anope::ReadOnly)
return;
@@ -467,7 +467,7 @@ public:
if (!show_all)
return;
- time_t chanserv_expire = Config->GetModule(this)->Get<time_t>("expire", "30d");
+ time_t chanserv_expire = Config->GetModule(this).Get<time_t>("expire", "30d");
if (!ci->HasExt("CS_NO_EXPIRE") && chanserv_expire && !Anope::NoExpire && ci->last_used != Anope::CurTime)
info[_("Expires")] = Anope::strftime(ci->last_used + chanserv_expire, source.GetAccount());
}
diff --git a/modules/chanserv/cs_access.cpp b/modules/chanserv/cs_access.cpp
index dcae83ae7..5f13f56df 100644
--- a/modules/chanserv/cs_access.cpp
+++ b/modules/chanserv/cs_access.cpp
@@ -134,7 +134,7 @@ class CommandCSAccess final
if (IRCD->IsChannelValid(mask))
{
- if (Config->GetModule("chanserv")->Get<bool>("disallow_channel_access"))
+ if (Config->GetModule("chanserv").Get<bool>("disallow_channel_access"))
{
source.Reply(_("Channels may not be on access lists."));
return;
@@ -158,7 +158,7 @@ class CommandCSAccess final
{
na = NickAlias::Find(mask);
- if (!na && Config->GetModule("chanserv")->Get<bool>("disallow_hostmask_access"))
+ if (!na && Config->GetModule("chanserv").Get<bool>("disallow_hostmask_access"))
{
source.Reply(_("Masks and unregistered users may not be on access lists."));
return;
@@ -205,7 +205,7 @@ class CommandCSAccess final
}
}
- unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1000");
+ unsigned access_max = Config->GetModule("chanserv").Get<unsigned>("accessmax", "1000");
if (access_max && ci->GetDeepAccessCount() >= access_max)
{
source.Reply(_("Sorry, you can only have %d access entries on a channel, including access entries from other channels."), access_max);
@@ -601,7 +601,7 @@ public:
"may be a numerical level or the name of a privilege (eg AUTOOP).\n"
"When a user joins the channel the access they receive is from the\n"
"highest level entry in the access list."));
- if (!Config->GetModule("chanserv")->Get<bool>("disallow_channel_access"))
+ if (!Config->GetModule("chanserv").Get<bool>("disallow_channel_access"))
source.Reply(_("The given mask may also be a channel, which will use the\n"
"access list from the other channel up to the given \037level\037."));
source.Reply(" ");
@@ -878,21 +878,21 @@ public:
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
defaultLevels.clear();
- for (int i = 0; i < conf->CountBlock("privilege"); ++i)
+ for (int i = 0; i < conf.CountBlock("privilege"); ++i)
{
- Configuration::Block *priv = conf->GetBlock("privilege", i);
+ Configuration::Block &priv = conf.GetBlock("privilege", i);
- const Anope::string &pname = priv->Get<const Anope::string>("name");
+ const Anope::string &pname = priv.Get<const Anope::string>("name");
Privilege *p = PrivilegeManager::FindPrivilege(pname);
if (p == NULL)
continue;
- const Anope::string &value = priv->Get<const Anope::string>("level");
+ const Anope::string &value = priv.Get<const Anope::string>("level");
if (value.empty())
continue;
else if (value.equals_ci("founder"))
@@ -900,7 +900,7 @@ public:
else if (value.equals_ci("disabled"))
defaultLevels[p->name] = ACCESS_INVALID;
else
- defaultLevels[p->name] = priv->Get<int16_t>("level");
+ defaultLevels[p->name] = priv.Get<int16_t>("level");
}
}
diff --git a/modules/chanserv/cs_akick.cpp b/modules/chanserv/cs_akick.cpp
index 489b18772..ad58a814b 100644
--- a/modules/chanserv/cs_akick.cpp
+++ b/modules/chanserv/cs_akick.cpp
@@ -46,7 +46,7 @@ class CommandCSAKick final
const NickAlias *na = NickAlias::Find(mask);
NickCore *nc = NULL;
const AutoKick *akick;
- unsigned reasonmax = Config->GetModule("chanserv")->Get<unsigned>("reasonmax", "200");
+ unsigned reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200");
if (reason.length() > reasonmax)
reason = reason.substr(0, reasonmax);
@@ -170,9 +170,9 @@ class CommandCSAKick final
}
}
- if (ci->GetAkickCount() >= Config->GetModule(this->owner)->Get<unsigned>("autokickmax"))
+ if (ci->GetAkickCount() >= Config->GetModule(this->owner).Get<unsigned>("autokickmax"))
{
- source.Reply(_("Sorry, you can only have %d autokick masks on a channel."), Config->GetModule(this->owner)->Get<unsigned>("autokickmax"));
+ source.Reply(_("Sorry, you can only have %d autokick masks on a channel."), Config->GetModule(this->owner).Get<unsigned>("autokickmax"));
return;
}
@@ -568,7 +568,7 @@ public:
reason = autokick->reason;
if (reason.empty())
{
- reason = Language::Translate(u, Config->GetModule(this)->Get<const Anope::string>("autokickreason").c_str());
+ reason = Language::Translate(u, Config->GetModule(this).Get<const Anope::string>("autokickreason").c_str());
reason = reason.replace_all_cs("%n", u->nick)
.replace_all_cs("%c", c->name);
}
diff --git a/modules/chanserv/cs_ban.cpp b/modules/chanserv/cs_ban.cpp
index 9f2b691ef..74dc129f4 100644
--- a/modules/chanserv/cs_ban.cpp
+++ b/modules/chanserv/cs_ban.cpp
@@ -50,8 +50,8 @@ public:
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- Configuration::Block *block = Config->GetCommand(source);
- const Anope::string &mode = block->Get<Anope::string>("mode", "BAN");
+ Configuration::Block &block = Config->GetCommand(source);
+ const Anope::string &mode = block.Get<Anope::string>("mode", "BAN");
ChannelMode *cm = ModeManager::FindChannelModeByName(mode);
if (cm == NULL)
return;
@@ -107,11 +107,11 @@ public:
reason += " " + params[3];
}
- unsigned reasonmax = Config->GetModule("chanserv")->Get<unsigned>("reasonmax", "200");
+ unsigned reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200");
if (reason.length() > reasonmax)
reason = reason.substr(0, reasonmax);
- Anope::string signkickformat = Config->GetModule("chanserv")->Get<Anope::string>("signkickformat", "%m (%n)");
+ Anope::string signkickformat = Config->GetModule("chanserv").Get<Anope::string>("signkickformat", "%m (%n)");
signkickformat = signkickformat.replace_all_cs("%n", source.GetNick());
User *u = source.GetUser();
@@ -156,7 +156,7 @@ public:
if (!c->FindUser(u2))
return;
- if (block->Get<bool>("kick", "yes"))
+ if (block.Get<bool>("kick", "yes"))
{
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK")))
{
@@ -209,7 +209,7 @@ public:
else if (uc->user->IsProtected())
continue;
- if (block->Get<bool>("kick", "yes"))
+ if (block.Get<bool>("kick", "yes"))
{
++kicked;
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK")))
diff --git a/modules/chanserv/cs_clone.cpp b/modules/chanserv/cs_clone.cpp
index 6f29a235c..5e4130532 100644
--- a/modules/chanserv/cs_clone.cpp
+++ b/modules/chanserv/cs_clone.cpp
@@ -24,7 +24,7 @@ class CommandCSClone final
static void CopyAccess(CommandSource &source, ChannelInfo *ci, ChannelInfo *target_ci)
{
std::set<Anope::string> masks;
- unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1000");
+ unsigned access_max = Config->GetModule("chanserv").Get<unsigned>("accessmax", "1000");
unsigned count = 0;
for (unsigned i = 0; i < target_ci->GetAccessCount(); ++i)
diff --git a/modules/chanserv/cs_entrymsg.cpp b/modules/chanserv/cs_entrymsg.cpp
index b1546428d..9f76c9d50 100644
--- a/modules/chanserv/cs_entrymsg.cpp
+++ b/modules/chanserv/cs_entrymsg.cpp
@@ -142,7 +142,7 @@ private:
{
EntryMessageList *messages = ci->Require<EntryMessageList>("entrymsg");
- if ((*messages)->size() >= Config->GetModule(this->owner)->Get<unsigned>("maxentries"))
+ if ((*messages)->size() >= Config->GetModule(this->owner).Get<unsigned>("maxentries"))
source.Reply(_("The entry message list for \002%s\002 is full."), ci->name.c_str());
else
{
diff --git a/modules/chanserv/cs_fantasy_stats.cpp b/modules/chanserv/cs_fantasy_stats.cpp
index eae70f116..096bb6a31 100644
--- a/modules/chanserv/cs_fantasy_stats.cpp
+++ b/modules/chanserv/cs_fantasy_stats.cpp
@@ -77,10 +77,10 @@ public:
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- prefix = conf->GetModule("chanstats")->Get<const Anope::string>("prefix", "anope_");
- this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf->GetModule("chanstats")->Get<const Anope::string>("engine"));
+ prefix = conf.GetModule("chanstats").Get<const Anope::string>("prefix", "anope_");
+ this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf.GetModule("chanstats").Get<const Anope::string>("engine"));
}
SQL::Result RunQuery(const SQL::Query &query)
diff --git a/modules/chanserv/cs_fantasy_top.cpp b/modules/chanserv/cs_fantasy_top.cpp
index 83cd6bee5..d2ebf277b 100644
--- a/modules/chanserv/cs_fantasy_top.cpp
+++ b/modules/chanserv/cs_fantasy_top.cpp
@@ -104,10 +104,10 @@ public:
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- prefix = conf->GetModule("chanstats")->Get<const Anope::string>("prefix", "anope_");
- this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf->GetModule("chanstats")->Get<const Anope::string>("engine"));
+ prefix = conf.GetModule("chanstats").Get<const Anope::string>("prefix", "anope_");
+ this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf.GetModule("chanstats").Get<const Anope::string>("engine"));
}
SQL::Result RunQuery(const SQL::Query &query)
diff --git a/modules/chanserv/cs_flags.cpp b/modules/chanserv/cs_flags.cpp
index 691319634..876eb67e4 100644
--- a/modules/chanserv/cs_flags.cpp
+++ b/modules/chanserv/cs_flags.cpp
@@ -93,7 +93,7 @@ class CommandCSFlags final
if (IRCD->IsChannelValid(mask))
{
- if (Config->GetModule("chanserv")->Get<bool>("disallow_channel_access"))
+ if (Config->GetModule("chanserv").Get<bool>("disallow_channel_access"))
{
source.Reply(_("Channels may not be on access lists."));
return;
@@ -116,7 +116,7 @@ class CommandCSFlags final
else
{
na = NickAlias::Find(mask);
- if (!na && Config->GetModule("chanserv")->Get<bool>("disallow_hostmask_access"))
+ if (!na && Config->GetModule("chanserv").Get<bool>("disallow_hostmask_access"))
{
source.Reply(_("Masks and unregistered users may not be on access lists."));
return;
@@ -179,7 +179,7 @@ class CommandCSFlags final
}
}
- unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1000");
+ unsigned access_max = Config->GetModule("chanserv").Get<unsigned>("accessmax", "1000");
if (access_max && ci->GetDeepAccessCount() >= access_max)
{
source.Reply(_("Sorry, you can only have %d access entries on a channel, including access entries from other channels."), access_max);
@@ -494,21 +494,21 @@ public:
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
defaultFlags.clear();
- for (int i = 0; i < conf->CountBlock("privilege"); ++i)
+ for (int i = 0; i < conf.CountBlock("privilege"); ++i)
{
- Configuration::Block *priv = conf->GetBlock("privilege", i);
+ Configuration::Block &priv = conf.GetBlock("privilege", i);
- const Anope::string &pname = priv->Get<const Anope::string>("name");
+ const Anope::string &pname = priv.Get<const Anope::string>("name");
Privilege *p = PrivilegeManager::FindPrivilege(pname);
if (p == NULL)
continue;
- const Anope::string &value = priv->Get<const Anope::string>("flag");
+ const Anope::string &value = priv.Get<const Anope::string>("flag");
if (value.empty())
continue;
diff --git a/modules/chanserv/cs_kick.cpp b/modules/chanserv/cs_kick.cpp
index dfcd2995c..210a5168c 100644
--- a/modules/chanserv/cs_kick.cpp
+++ b/modules/chanserv/cs_kick.cpp
@@ -44,11 +44,11 @@ public:
return;
}
- unsigned reasonmax = Config->GetModule("chanserv")->Get<unsigned>("reasonmax", "200");
+ unsigned reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200");
if (reason.length() > reasonmax)
reason = reason.substr(0, reasonmax);
- Anope::string signkickformat = Config->GetModule("chanserv")->Get<Anope::string>("signkickformat", "%m (%n)");
+ Anope::string signkickformat = Config->GetModule("chanserv").Get<Anope::string>("signkickformat", "%m (%n)");
signkickformat = signkickformat.replace_all_cs("%n", source.GetNick());
AccessGroup u_access = source.AccessFor(ci);
diff --git a/modules/chanserv/cs_list.cpp b/modules/chanserv/cs_list.cpp
index 429b87d4d..e8feabed4 100644
--- a/modules/chanserv/cs_list.cpp
+++ b/modules/chanserv/cs_list.cpp
@@ -68,7 +68,7 @@ public:
}
Anope::string spattern = "#" + pattern;
- unsigned listmax = Config->GetModule(this->owner)->Get<unsigned>("listmax", "50");
+ unsigned listmax = Config->GetModule(this->owner).Get<unsigned>("listmax", "50");
source.Reply(_("List of entries matching \002%s\002:"), pattern.c_str());
@@ -160,11 +160,11 @@ public:
" \002LIST #51-100\002\n"
" Lists all registered channels within the given range (51-100)."));
- if (!Config->GetBlock("options")->Get<const Anope::string>("regexengine").empty())
+ if (!Config->GetBlock("options").Get<const Anope::string>("regexengine").empty())
{
source.Reply(" ");
source.Reply(_("Regex matches are also supported using the %s engine.\n"
- "Enclose your pattern in // if this is desired."), Config->GetBlock("options")->Get<const Anope::string>("regexengine").c_str());
+ "Enclose your pattern in // if this is desired."), Config->GetBlock("options").Get<const Anope::string>("regexengine").c_str());
}
return true;
diff --git a/modules/chanserv/cs_log.cpp b/modules/chanserv/cs_log.cpp
index f3a32daed..e91a3f731 100644
--- a/modules/chanserv/cs_log.cpp
+++ b/modules/chanserv/cs_log.cpp
@@ -308,20 +308,20 @@ public:
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *block = conf->GetModule(this);
+ Configuration::Block &block = conf.GetModule(this);
defaults.clear();
- for (int i = 0; i < block->CountBlock("default"); ++i)
+ for (int i = 0; i < block.CountBlock("default"); ++i)
{
- Configuration::Block *def = block->GetBlock("default", i);
+ Configuration::Block &def = block.GetBlock("default", i);
LogDefault ld;
- ld.service = def->Get<const Anope::string>("service");
- ld.command = def->Get<const Anope::string>("command");
- ld.method = def->Get<const Anope::string>("method");
+ ld.service = def.Get<const Anope::string>("service");
+ ld.command = def.Get<const Anope::string>("command");
+ ld.method = def.Get<const Anope::string>("method");
defaults.push_back(ld);
}
diff --git a/modules/chanserv/cs_mode.cpp b/modules/chanserv/cs_mode.cpp
index 47e2b84ad..cc7a526cd 100644
--- a/modules/chanserv/cs_mode.cpp
+++ b/modules/chanserv/cs_mode.cpp
@@ -336,7 +336,7 @@ class CommandCSMode final
continue;
}
- if (modelocks->GetMLock().size() >= Config->GetModule(this->owner)->Get<unsigned>("max", "50"))
+ if (modelocks->GetMLock().size() >= Config->GetModule(this->owner).Get<unsigned>("max", "50"))
{
source.Reply(_("The mode lock list of \002%s\002 is full."), ci->name.c_str());
continue;
@@ -946,22 +946,22 @@ public:
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
modes.clear();
- for (int i = 0; i < conf->CountBlock("command"); ++i)
+ for (int i = 0; i < conf.CountBlock("command"); ++i)
{
- Configuration::Block *block = conf->GetBlock("command", i);
+ Configuration::Block &block = conf.GetBlock("command", i);
- const Anope::string &cname = block->Get<const Anope::string>("name"),
- &cmd = block->Get<const Anope::string>("command");
+ const Anope::string &cname = block.Get<const Anope::string>("name"),
+ &cmd = block.Get<const Anope::string>("command");
if (cname.empty() || cmd != "chanserv/modes")
continue;
- const Anope::string &set = block->Get<const Anope::string>("set"),
- &unset = block->Get<const Anope::string>("unset");
+ const Anope::string &set = block.Get<const Anope::string>("set"),
+ &unset = block.Get<const Anope::string>("unset");
if (set.empty() && unset.empty())
continue;
@@ -1024,7 +1024,7 @@ public:
{
ModeLocks *ml = modelocks.Require(ci);
Anope::string mlock;
- spacesepstream sep(Config->GetModule(this)->Get<const Anope::string>("mlock", "+nt"));
+ spacesepstream sep(Config->GetModule(this).Get<const Anope::string>("mlock", "+nt"));
if (sep.GetToken(mlock))
{
bool add = true;
diff --git a/modules/chanserv/cs_register.cpp b/modules/chanserv/cs_register.cpp
index e4e9ad951..97bddf5cd 100644
--- a/modules/chanserv/cs_register.cpp
+++ b/modules/chanserv/cs_register.cpp
@@ -25,7 +25,7 @@ public:
{
const Anope::string &chan = params[0];
const Anope::string &chdesc = params.size() > 1 ? params[1] : "";
- unsigned maxregistered = Config->GetModule("chanserv")->Get<unsigned>("maxregistered");
+ unsigned maxregistered = Config->GetModule("chanserv").Get<unsigned>("maxregistered");
User *u = source.GetUser();
NickCore *nc = source.nc;
diff --git a/modules/chanserv/cs_seen.cpp b/modules/chanserv/cs_seen.cpp
index 6197975f5..d8e4e118b 100644
--- a/modules/chanserv/cs_seen.cpp
+++ b/modules/chanserv/cs_seen.cpp
@@ -382,15 +382,15 @@ public:
{
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- simple = conf->GetModule(this)->Get<bool>("simple");
+ simple = conf.GetModule(this).Get<bool>("simple");
}
void OnExpireTick() override
{
size_t previous_size = database.size();
- time_t purgetime = Config->GetModule(this)->Get<time_t>("purgetime");
+ time_t purgetime = Config->GetModule(this).Get<time_t>("purgetime");
if (!purgetime)
purgetime = Anope::DoTime("30d");
for (database_map::iterator it = database.begin(), it_end = database.end(); it != it_end;)
diff --git a/modules/chanserv/cs_set.cpp b/modules/chanserv/cs_set.cpp
index 7f9e49dd3..7b214a531 100644
--- a/modules/chanserv/cs_set.cpp
+++ b/modules/chanserv/cs_set.cpp
@@ -36,8 +36,8 @@ public:
" \n"
"Available options:"));
Anope::string this_name = source.command;
- bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"),
- hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands");
+ bool hide_privileged_commands = Config->GetBlock("options").Get<bool>("hideprivilegedcommands"),
+ hide_registered_commands = Config->GetBlock("options").Get<bool>("hideregisteredcommands");
for (const auto &[c_name, info] : source.service->commands)
{
if (c_name.find_ci(this_name + " ") == 0)
@@ -301,7 +301,7 @@ public:
}
NickCore *nc = na->nc;
- unsigned max_reg = Config->GetModule("chanserv")->Get<unsigned>("maxregistered");
+ unsigned max_reg = Config->GetModule("chanserv").Get<unsigned>("maxregistered");
if (max_reg && nc->channelcount >= max_reg && !source.HasPriv("chanserv/no-register-limit"))
{
source.Reply(_("\002%s\002 has too many channels registered."), na->nick.c_str());
@@ -461,8 +461,8 @@ public:
inline static Anope::string BotModes()
{
- return Config->GetModule("botserv")->Get<Anope::string>("botmodes",
- Config->GetModule("chanserv")->Get<Anope::string>("botmodes", "o")
+ return Config->GetModule("botserv").Get<Anope::string>("botmodes",
+ Config->GetModule("chanserv").Get<Anope::string>("botmodes", "o")
);
}
@@ -969,7 +969,7 @@ public:
"access list (with the highest access, if applicable) will\n"
"become the new founder, but if the access list is empty, the\n"
"channel will be dropped."));
- unsigned max_reg = Config->GetModule("chanserv")->Get<unsigned>("maxregistered");
+ unsigned max_reg = Config->GetModule("chanserv").Get<unsigned>("maxregistered");
if (max_reg)
{
source.Reply(" ");
@@ -1133,14 +1133,14 @@ public:
{
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- persist_lower_ts = conf->GetModule(this)->Get<bool>("persist_lower_ts");
+ persist_lower_ts = conf.GetModule(this).Get<bool>("persist_lower_ts");
}
void OnCreateChan(ChannelInfo *ci) override
{
- ci->bantype = Config->GetModule(this)->Get<int>("defbantype", "2");
+ ci->bantype = Config->GetModule(this).Get<int>("defbantype", "2");
}
void OnChannelSync(Channel *c) override
diff --git a/modules/chanserv/cs_set_misc.cpp b/modules/chanserv/cs_set_misc.cpp
index 7fef1e022..01a5b90b7 100644
--- a/modules/chanserv/cs_set_misc.cpp
+++ b/modules/chanserv/cs_set_misc.cpp
@@ -187,27 +187,27 @@ public:
delete item;
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
descriptions.clear();
numerics.clear();
- for (int i = 0; i < conf->CountBlock("command"); ++i)
+ for (int i = 0; i < conf.CountBlock("command"); ++i)
{
- Configuration::Block *block = conf->GetBlock("command", i);
+ Configuration::Block &block = conf.GetBlock("command", i);
- if (block->Get<const Anope::string>("command") != "chanserv/set/misc")
+ if (block.Get<const Anope::string>("command") != "chanserv/set/misc")
continue;
- Anope::string cname = block->Get<const Anope::string>("name");
- Anope::string desc = block->Get<const Anope::string>("misc_description");
+ Anope::string cname = block.Get<const Anope::string>("name");
+ Anope::string desc = block.Get<const Anope::string>("misc_description");
if (cname.empty() || desc.empty())
continue;
descriptions[cname] = desc;
- auto numeric = block->Get<unsigned>("misc_numeric");
+ auto numeric = block.Get<unsigned>("misc_numeric");
if (numeric >= 1 && numeric <= 999)
numerics["cs_set_misc:" + GetAttribute(cname)] = numeric;
}
diff --git a/modules/chanserv/cs_suspend.cpp b/modules/chanserv/cs_suspend.cpp
index 2633bc094..b06fa195a 100644
--- a/modules/chanserv/cs_suspend.cpp
+++ b/modules/chanserv/cs_suspend.cpp
@@ -67,7 +67,7 @@ public:
const Anope::string &chan = params[0];
Anope::string expiry = params[1];
Anope::string reason = params.size() > 2 ? params[2] : "";
- time_t expiry_secs = Config->GetModule(this->owner)->Get<time_t>("suspendexpire");
+ time_t expiry_secs = Config->GetModule(this->owner).Get<time_t>("suspendexpire");
if (!expiry.empty() && expiry[0] != '+')
{
@@ -233,9 +233,9 @@ public:
{
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Anope::string s = conf->GetModule(this)->Get<Anope::string>("show");
+ Anope::string s = conf.GetModule(this).Get<Anope::string>("show");
commasepstream(s).GetTokens(show);
std::transform(show.begin(), show.end(), show.begin(), trim());
}
diff --git a/modules/chanserv/cs_xop.cpp b/modules/chanserv/cs_xop.cpp
index 55f8eb4bc..3ba3096ae 100644
--- a/modules/chanserv/cs_xop.cpp
+++ b/modules/chanserv/cs_xop.cpp
@@ -141,7 +141,7 @@ private:
if (IRCD->IsChannelValid(mask))
{
- if (Config->GetModule("chanserv")->Get<bool>("disallow_channel_access"))
+ if (Config->GetModule("chanserv").Get<bool>("disallow_channel_access"))
{
source.Reply(_("Channels may not be on access lists."));
return;
@@ -164,7 +164,7 @@ private:
else
{
na = NickAlias::Find(mask);
- if (!na && Config->GetModule("chanserv")->Get<bool>("disallow_hostmask_access"))
+ if (!na && Config->GetModule("chanserv").Get<bool>("disallow_hostmask_access"))
{
source.Reply(_("Masks and unregistered users may not be on access lists."));
return;
@@ -212,7 +212,7 @@ private:
}
}
- unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1000");
+ unsigned access_max = Config->GetModule("chanserv").Get<unsigned>("accessmax", "1000");
if (access_max && ci->GetDeepAccessCount() >= access_max)
{
source.Reply(_("Sorry, you can only have %d access entries on a channel, including access entries from other channels."), access_max);
@@ -618,32 +618,32 @@ public:
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
order.clear();
permissions.clear();
- for (int i = 0; i < conf->CountBlock("privilege"); ++i)
+ for (int i = 0; i < conf.CountBlock("privilege"); ++i)
{
- Configuration::Block *block = conf->GetBlock("privilege", i);
- const Anope::string &pname = block->Get<const Anope::string>("name");
+ Configuration::Block &block = conf.GetBlock("privilege", i);
+ const Anope::string &pname = block.Get<const Anope::string>("name");
Privilege *p = PrivilegeManager::FindPrivilege(pname);
if (p == NULL)
continue;
- const Anope::string &xop = block->Get<const Anope::string>("xop");
+ const Anope::string &xop = block.Get<const Anope::string>("xop");
if (pname.empty() || xop.empty())
continue;
permissions[xop].push_back(pname);
}
- for (int i = 0; i < conf->CountBlock("command"); ++i)
+ for (int i = 0; i < conf.CountBlock("command"); ++i)
{
- Configuration::Block *block = conf->GetBlock("command", i);
- const Anope::string &cname = block->Get<const Anope::string>("name"),
- &cserv = block->Get<const Anope::string>("command");
+ Configuration::Block &block = conf.GetBlock("command", i);
+ const Anope::string &cname = block.Get<const Anope::string>("name"),
+ &cserv = block.Get<const Anope::string>("command");
if (cname.empty() || cserv != "chanserv/xop")
continue;
diff --git a/modules/chanstats.cpp b/modules/chanstats.cpp
index 05c745ff2..65678dcab 100644
--- a/modules/chanstats.cpp
+++ b/modules/chanstats.cpp
@@ -497,16 +497,16 @@ public:
{
}
- void OnReload(Configuration::Conf *conf) override
- {
- Configuration::Block *block = conf->GetModule(this);
- prefix = block->Get<const Anope::string>("prefix", "anope_");
- SmileysHappy = block->Get<const Anope::string>("SmileysHappy");
- SmileysSad = block->Get<const Anope::string>("SmileysSad");
- SmileysOther = block->Get<const Anope::string>("SmileysOther");
- NSDefChanstats = block->Get<bool>("ns_def_chanstats");
- CSDefChanstats = block->Get<bool>("cs_def_chanstats");
- Anope::string engine = block->Get<const Anope::string>("engine");
+ void OnReload(Configuration::Conf &conf) override
+ {
+ Configuration::Block &block = conf.GetModule(this);
+ prefix = block.Get<const Anope::string>("prefix", "anope_");
+ SmileysHappy = block.Get<const Anope::string>("SmileysHappy");
+ SmileysSad = block.Get<const Anope::string>("SmileysSad");
+ SmileysOther = block.Get<const Anope::string>("SmileysOther");
+ NSDefChanstats = block.Get<bool>("ns_def_chanstats");
+ CSDefChanstats = block.Get<bool>("cs_def_chanstats");
+ Anope::string engine = block.Get<const Anope::string>("engine");
this->sql = ServiceReference<SQL::Provider>("SQL::Provider", engine);
if (sql)
this->CheckTables();
diff --git a/modules/database/db_atheme.cpp b/modules/database/db_atheme.cpp
index 2e25b694e..4599a7469 100644
--- a/modules/database/db_atheme.cpp
+++ b/modules/database/db_atheme.cpp
@@ -500,7 +500,7 @@ private:
else
{
// Generate a new password as we can't use the old one.
- auto maxpasslen = Config->GetModule("nickserv")->Get<unsigned>("maxpasslen", "50");
+ auto maxpasslen = Config->GetModule("nickserv").Get<unsigned>("maxpasslen", "50");
Anope::Encrypt(Anope::Random(maxpasslen), nc->pass);
Log(this) << "Unable to convert the password for " << nc->display << " as Anope does not support the format!";
}
@@ -1076,8 +1076,8 @@ private:
if (!data->kill)
return true; // Don't apply this.
- auto kill = Config->GetModule("nickserv")->Get<time_t>("kill", "60s");
- auto killquick = Config->GetModule("nickserv")->Get<time_t>("killquick", "20s");
+ auto kill = Config->GetModule("nickserv").Get<time_t>("kill", "60s");
+ auto killquick = Config->GetModule("nickserv").Get<time_t>("killquick", "20s");
auto secs = Anope::Convert<time_t>(value, kill);
if (secs >= kill)
nc->Extend<bool>("KILLPROTECT");
@@ -1295,7 +1295,7 @@ private:
// If an Atheme account was awaiting confirmation but Anope is not
// configured to use confirmation then autoconfirm it.
- const auto &nsregister = Config->GetModule("ns_register")->Get<const Anope::string>("registration");
+ const auto &nsregister = Config->GetModule("ns_register").Get<const Anope::string>("registration");
if (nsregister.equals_ci("none"))
nc->Shrink<bool>("UNCONFIRMED");
@@ -1453,14 +1453,14 @@ public:
{
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
flags.clear();
for (int i = 0; i < Config->CountBlock("privilege"); ++i)
{
- Configuration::Block *priv = Config->GetBlock("privilege", i);
- const Anope::string &name = priv->Get<const Anope::string>("name");
- const Anope::string &value = priv->Get<const Anope::string>("flag");
+ Configuration::Block &priv = Config->GetBlock("privilege", i);
+ const Anope::string &name = priv.Get<const Anope::string>("name");
+ const Anope::string &value = priv.Get<const Anope::string>("flag");
if (!name.empty() && !value.empty())
flags[name] = value[0];
}
@@ -1468,7 +1468,7 @@ public:
EventReturn OnLoadDatabase() override
{
- const auto dbname = Anope::ExpandData(Config->GetModule(this)->Get<const Anope::string>("database", "atheme.db"));
+ const auto dbname = Anope::ExpandData(Config->GetModule(this).Get<const Anope::string>("database", "atheme.db"));
std::ifstream fd(dbname.str());
if (!fd.is_open())
{
diff --git a/modules/database/db_flatfile.cpp b/modules/database/db_flatfile.cpp
index 9f2559c9e..4a1e8830d 100644
--- a/modules/database/db_flatfile.cpp
+++ b/modules/database/db_flatfile.cpp
@@ -109,7 +109,7 @@ class DBFlatFile final
last_day = tm->tm_mday;
std::set<Anope::string> dbs;
- dbs.insert(Config->GetModule(this)->Get<const Anope::string>("database", "anope.db"));
+ dbs.insert(Config->GetModule(this).Get<const Anope::string>("database", "anope.db"));
for (const auto &type_order : Serialize::Type::GetTypeOrder())
{
@@ -135,7 +135,7 @@ class DBFlatFile final
Anope::string err = Anope::LastError();
Log(this) << "Unable to back up database " << db << " (" << err << ")!";
- if (!Config->GetModule(this)->Get<bool>("nobackupokay"))
+ if (!Config->GetModule(this).Get<bool>("nobackupokay"))
{
Anope::Quitting = true;
Anope::QuitReason = "Unable to back up database " + db + " (" + err + ")";
@@ -146,7 +146,7 @@ class DBFlatFile final
backups[db].push_back(newname);
- unsigned keepbackups = Config->GetModule(this)->Get<unsigned>("keepbackups");
+ unsigned keepbackups = Config->GetModule(this).Get<unsigned>("keepbackups");
if (keepbackups > 0 && backups[db].size() > keepbackups)
{
unlink(backups[db].front().c_str());
@@ -200,7 +200,7 @@ public:
Log(this) << "Error saving databases: " << buf;
- if (!Config->GetModule(this)->Get<bool>("nobackupokay"))
+ if (!Config->GetModule(this).Get<bool>("nobackupokay"))
Anope::Quitting = true;
}
@@ -208,7 +208,7 @@ public:
{
std::set<Anope::string> tried_dbs;
- const auto db_name = Anope::ExpandData(Config->GetModule(this)->Get<const Anope::string>("database", "anope.db"));
+ const auto db_name = Anope::ExpandData(Config->GetModule(this).Get<const Anope::string>("database", "anope.db"));
std::fstream fd(db_name.c_str(), std::ios_base::in | std::ios_base::binary);
if (!fd.is_open())
@@ -263,7 +263,7 @@ public:
int i = -1;
#ifndef _WIN32
- if (!Anope::Quitting && Config->GetModule(this)->Get<bool>("fork"))
+ if (!Anope::Quitting && Config->GetModule(this).Get<bool>("fork"))
{
i = fork();
if (i > 0)
@@ -290,7 +290,7 @@ public:
if (s_type->GetOwner())
db_name = Anope::ExpandData("module_" + s_type->GetOwner()->name + ".db");
else
- db_name = Anope::ExpandData(Config->GetModule(this)->Get<const Anope::string>("database", "anope.db"));
+ db_name = Anope::ExpandData(Config->GetModule(this).Get<const Anope::string>("database", "anope.db"));
std::fstream *fs = databases[s_type->GetOwner()] = new std::fstream((db_name + ".tmp").c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);
@@ -319,7 +319,7 @@ public:
for (auto &[mod, f] : databases)
{
- const auto db_name = Anope::ExpandData((mod ? (mod->name + ".db") : Config->GetModule(this)->Get<const Anope::string>("database", "anope.db")));
+ const auto db_name = Anope::ExpandData((mod ? (mod->name + ".db") : Config->GetModule(this).Get<const Anope::string>("database", "anope.db")));
if (!f->is_open() || !f->good())
{
@@ -363,7 +363,7 @@ public:
if (stype->GetOwner())
db_name = Anope::ExpandData("module_" + stype->GetOwner()->name + ".db");
else
- db_name = Anope::ExpandData(Config->GetModule(this)->Get<const Anope::string>("database", "anope.db"));
+ db_name = Anope::ExpandData(Config->GetModule(this).Get<const Anope::string>("database", "anope.db"));
std::fstream fd(db_name.c_str(), std::ios_base::in | std::ios_base::binary);
if (!fd.is_open())
diff --git a/modules/database/db_old.cpp b/modules/database/db_old.cpp
index 814740a23..611da4406 100644
--- a/modules/database/db_old.cpp
+++ b/modules/database/db_old.cpp
@@ -1296,7 +1296,7 @@ public:
{
- hashm = Config->GetModule(this)->Get<const Anope::string>("hash");
+ hashm = Config->GetModule(this).Get<const Anope::string>("hash");
if (hashm != "md5" && hashm != "oldmd5" && hashm != "sha1" && hashm != "plain" && hashm != "sha256")
throw ModuleException("Invalid hash method");
diff --git a/modules/database/db_redis.cpp b/modules/database/db_redis.cpp
index a4826349b..832e22590 100644
--- a/modules/database/db_redis.cpp
+++ b/modules/database/db_redis.cpp
@@ -171,10 +171,10 @@ public:
this->updated_items.clear();
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *block = conf->GetModule(this);
- this->redis = ServiceReference<Provider>("Redis::Provider", block->Get<const Anope::string>("engine", "redis/main"));
+ Configuration::Block &block = conf.GetModule(this);
+ this->redis = ServiceReference<Provider>("Redis::Provider", block.Get<const Anope::string>("engine", "redis/main"));
}
EventReturn OnLoadDatabase() override
diff --git a/modules/database/db_sql.cpp b/modules/database/db_sql.cpp
index bfcd59a3d..4b120f3b0 100644
--- a/modules/database/db_sql.cpp
+++ b/modules/database/db_sql.cpp
@@ -158,12 +158,12 @@ public:
this->imported = true;
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *block = conf->GetModule(this);
- this->sql = ServiceReference<Provider>("SQL::Provider", block->Get<const Anope::string>("engine"));
- this->prefix = block->Get<const Anope::string>("prefix", "anope_db_");
- this->import = block->Get<bool>("import");
+ Configuration::Block &block = conf.GetModule(this);
+ this->sql = ServiceReference<Provider>("SQL::Provider", block.Get<const Anope::string>("engine"));
+ this->prefix = block.Get<const Anope::string>("prefix", "anope_db_");
+ this->import = block.Get<bool>("import");
}
void OnPostInit() override
diff --git a/modules/database/db_sql_live.cpp b/modules/database/db_sql_live.cpp
index e0f3adb08..afd884913 100644
--- a/modules/database/db_sql_live.cpp
+++ b/modules/database/db_sql_live.cpp
@@ -37,7 +37,7 @@ private:
}
else
{
- if (Anope::CurTime - Config->GetBlock("options")->Get<time_t>("updatetimeout", "2m") > lastwarn)
+ if (Anope::CurTime - Config->GetBlock("options").Get<time_t>("updatetimeout", "2m") > lastwarn)
{
Log() << "Unable to locate SQL reference, going to readonly...";
Anope::ReadOnly = this->ro = true;
@@ -138,11 +138,11 @@ public:
init = false;
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *block = conf->GetModule(this);
- this->SQL = ServiceReference<Provider>("SQL::Provider", block->Get<const Anope::string>("engine"));
- this->prefix = block->Get<const Anope::string>("prefix", "anope_db_");
+ Configuration::Block &block = conf.GetModule(this);
+ this->SQL = ServiceReference<Provider>("SQL::Provider", block.Get<const Anope::string>("engine"));
+ this->prefix = block.Get<const Anope::string>("prefix", "anope_db_");
}
void OnSerializableConstruct(Serializable *obj) override
diff --git a/modules/dns.cpp b/modules/dns.cpp
index f94854058..372c22d1e 100644
--- a/modules/dns.cpp
+++ b/modules/dns.cpp
@@ -1045,23 +1045,23 @@ public:
}
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *block = conf->GetModule(this);
+ Configuration::Block &block = conf.GetModule(this);
- nameserver = block->Get<const Anope::string>("nameserver", "127.0.0.1");
- timeout = block->Get<time_t>("timeout", "5");
- ip = block->Get<const Anope::string>("ip", "0.0.0.0");
- port = block->Get<int>("port", "53");
- admin = block->Get<const Anope::string>("admin", "admin@example.com");
- nameservers = block->Get<const Anope::string>("nameservers", "ns1.example.com");
- refresh = block->Get<int>("refresh", "3600");
+ nameserver = block.Get<const Anope::string>("nameserver", "127.0.0.1");
+ timeout = block.Get<time_t>("timeout", "5");
+ ip = block.Get<const Anope::string>("ip", "0.0.0.0");
+ port = block.Get<int>("port", "53");
+ admin = block.Get<const Anope::string>("admin", "admin@example.com");
+ nameservers = block.Get<const Anope::string>("nameservers", "ns1.example.com");
+ refresh = block.Get<int>("refresh", "3600");
- for (int i = 0; i < block->CountBlock("notify"); ++i)
+ for (int i = 0; i < block.CountBlock("notify"); ++i)
{
- Configuration::Block *n = block->GetBlock("notify", i);
- Anope::string nip = n->Get<Anope::string>("ip");
- short nport = n->Get<short>("port");
+ Configuration::Block &n = block.GetBlock("notify", i);
+ Anope::string nip = n.Get<Anope::string>("ip");
+ short nport = n.Get<short>("port");
notify.emplace_back(nip, nport);
}
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"));
}
}
diff --git a/modules/encryption/enc_bcrypt.cpp b/modules/encryption/enc_bcrypt.cpp
index 648f95834..1ac37e1fe 100644
--- a/modules/encryption/enc_bcrypt.cpp
+++ b/modules/encryption/enc_bcrypt.cpp
@@ -165,11 +165,11 @@ public:
}
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- auto *block = conf->GetModule(this);
+ auto &block = conf.GetModule(this);
- auto rounds = block->Get<unsigned long>("rounds", "10");
+ auto rounds = block.Get<unsigned long>("rounds", "10");
if (rounds < 10 || rounds > 32)
{
Log(this) << "Bcrypt rounds MUST be between 10 and 32 inclusive; using 10 instead of " << rounds << '.';
diff --git a/modules/encryption/enc_sha2.cpp b/modules/encryption/enc_sha2.cpp
index 11c0e76f6..4e60d330d 100644
--- a/modules/encryption/enc_sha2.cpp
+++ b/modules/encryption/enc_sha2.cpp
@@ -126,9 +126,9 @@ public:
});
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- this->defaultprovider = GetAlgorithm(Config->GetModule(this)->Get<const Anope::string>("algorithm", "sha256"));
+ this->defaultprovider = GetAlgorithm(Config->GetModule(this).Get<const Anope::string>("algorithm", "sha256"));
}
EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override
diff --git a/modules/extra/enc_argon2.cpp b/modules/extra/enc_argon2.cpp
index 8d6f27d9b..81d052c0c 100644
--- a/modules/extra/enc_argon2.cpp
+++ b/modules/extra/enc_argon2.cpp
@@ -154,15 +154,15 @@ public:
});
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- const auto *block = Config->GetModule(this);
- this->defaultprovider = GetAlgorithm(block->Get<const Anope::string>("algorithm", "argon2id"));
- Argon2Context::memory_cost = block->Get<uint32_t>("memory_cost", "131072");
- Argon2Context::time_cost = block->Get<uint32_t>("time_cost", "3");
- Argon2Context::parallelism = block->Get<uint32_t>("parallelism", "1");
- Argon2Context::hash_length = block->Get<uint32_t>("hash_length", "32");
- Argon2Context::salt_length = block->Get<uint32_t>("salt_length", "32");
+ const auto &block = Config->GetModule(this);
+ this->defaultprovider = GetAlgorithm(block.Get<const Anope::string>("algorithm", "argon2id"));
+ Argon2Context::memory_cost = block.Get<uint32_t>("memory_cost", "131072");
+ Argon2Context::time_cost = block.Get<uint32_t>("time_cost", "3");
+ Argon2Context::parallelism = block.Get<uint32_t>("parallelism", "1");
+ Argon2Context::hash_length = block.Get<uint32_t>("hash_length", "32");
+ Argon2Context::salt_length = block.Get<uint32_t>("salt_length", "32");
}
EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override
diff --git a/modules/extra/ldap.cpp b/modules/extra/ldap.cpp
index ecc48767a..f8ef205a5 100644
--- a/modules/extra/ldap.cpp
+++ b/modules/extra/ldap.cpp
@@ -544,9 +544,9 @@ public:
LDAPServices.clear();
}
- void OnReload(Configuration::Conf *config) override
+ void OnReload(Configuration::Conf &config) override
{
- Configuration::Block *conf = config->GetModule(this);
+ Configuration::Block &conf = config.GetModule(this);
for (std::map<Anope::string, LDAPService *>::iterator it = this->LDAPServices.begin(); it != this->LDAPServices.end();)
{
@@ -556,11 +556,11 @@ public:
++it;
- for (i = 0; i < conf->CountBlock("ldap"); ++i)
- if (conf->GetBlock("ldap", i)->Get<const Anope::string>("name", "ldap/main") == cname)
+ for (i = 0; i < conf.CountBlock("ldap"); ++i)
+ if (conf.GetBlock("ldap", i).Get<const Anope::string>("name", "ldap/main") == cname)
break;
- if (i == conf->CountBlock("ldap"))
+ if (i == conf.CountBlock("ldap"))
{
Log(LOG_NORMAL, "ldap") << "LDAP: Removing server connection " << cname;
@@ -572,17 +572,17 @@ public:
}
}
- for (int i = 0; i < conf->CountBlock("ldap"); ++i)
+ for (int i = 0; i < conf.CountBlock("ldap"); ++i)
{
- Configuration::Block *ldap = conf->GetBlock("ldap", i);
+ Configuration::Block &ldap = conf.GetBlock("ldap", i);
- const Anope::string &connname = ldap->Get<const Anope::string>("name", "ldap/main");
+ const Anope::string &connname = ldap.Get<const Anope::string>("name", "ldap/main");
if (this->LDAPServices.find(connname) == this->LDAPServices.end())
{
- const Anope::string &server = ldap->Get<const Anope::string>("server", "127.0.0.1");
- const Anope::string &admin_binddn = ldap->Get<const Anope::string>("admin_binddn");
- const Anope::string &admin_password = ldap->Get<const Anope::string>("admin_password");
+ const Anope::string &server = ldap.Get<const Anope::string>("server", "127.0.0.1");
+ const Anope::string &admin_binddn = ldap.Get<const Anope::string>("admin_binddn");
+ const Anope::string &admin_password = ldap.Get<const Anope::string>("admin_password");
try
{
diff --git a/modules/extra/mysql.cpp b/modules/extra/mysql.cpp
index 65fe6d5c4..0d39c87a4 100644
--- a/modules/extra/mysql.cpp
+++ b/modules/extra/mysql.cpp
@@ -260,9 +260,9 @@ public:
delete DThread;
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *config = conf->GetModule(this);
+ Configuration::Block &config = conf.GetModule(this);
for (std::map<Anope::string, MySQLService *>::iterator it = this->MySQLServices.begin(); it != this->MySQLServices.end();)
{
@@ -272,11 +272,11 @@ public:
++it;
- for (i = 0; i < config->CountBlock("mysql"); ++i)
- if (config->GetBlock("mysql", i)->Get<const Anope::string>("name", "mysql/main") == cname)
+ for (i = 0; i < Config->CountBlock("mysql"); ++i)
+ if (config.GetBlock("mysql", i).Get<const Anope::string>("name", "mysql/main") == cname)
break;
- if (i == config->CountBlock("mysql"))
+ if (i == Config->CountBlock("mysql"))
{
Log(LOG_NORMAL, "mysql") << "MySQL: Removing server connection " << cname;
@@ -285,19 +285,19 @@ public:
}
}
- for (int i = 0; i < config->CountBlock("mysql"); ++i)
+ for (int i = 0; i < Config->CountBlock("mysql"); ++i)
{
- Configuration::Block *block = config->GetBlock("mysql", i);
- const Anope::string &connname = block->Get<const Anope::string>("name", "mysql/main");
+ Configuration::Block &block = config.GetBlock("mysql", i);
+ const Anope::string &connname = block.Get<const Anope::string>("name", "mysql/main");
if (this->MySQLServices.find(connname) == this->MySQLServices.end())
{
- const Anope::string &database = block->Get<const Anope::string>("database", "anope");
- const Anope::string &server = block->Get<const Anope::string>("server", "127.0.0.1");
- const Anope::string &user = block->Get<const Anope::string>("username", "anope");
- const Anope::string &password = block->Get<const Anope::string>("password");
- unsigned int port = block->Get<unsigned int>("port", "3306");
- const Anope::string &socket = block->Get<const Anope::string>("socket");
+ const Anope::string &database = block.Get<const Anope::string>("database", "anope");
+ const Anope::string &server = block.Get<const Anope::string>("server", "127.0.0.1");
+ const Anope::string &user = block.Get<const Anope::string>("username", "anope");
+ const Anope::string &password = block.Get<const Anope::string>("password");
+ unsigned int port = block.Get<unsigned int>("port", "3306");
+ const Anope::string &socket = block.Get<const Anope::string>("socket");
try
{
diff --git a/modules/extra/sqlite.cpp b/modules/extra/sqlite.cpp
index d234066a0..36bafae4c 100644
--- a/modules/extra/sqlite.cpp
+++ b/modules/extra/sqlite.cpp
@@ -113,9 +113,9 @@ public:
SQLiteServices.clear();
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *config = conf->GetModule(this);
+ Configuration::Block &config = conf.GetModule(this);
for (std::map<Anope::string, SQLiteService *>::iterator it = this->SQLiteServices.begin(); it != this->SQLiteServices.end();)
{
@@ -124,8 +124,8 @@ public:
int i, num;
++it;
- for (i = 0, num = config->CountBlock("sqlite"); i < num; ++i)
- if (config->GetBlock("sqlite", i)->Get<const Anope::string>("name", "sqlite/main") == cname)
+ for (i = 0, num = Config->CountBlock("sqlite"); i < num; ++i)
+ if (config.GetBlock("sqlite", i).Get<const Anope::string>("name", "sqlite/main") == cname)
break;
if (i == num)
@@ -137,14 +137,14 @@ public:
}
}
- for (int i = 0; i < config->CountBlock("sqlite"); ++i)
+ for (int i = 0; i < Config->CountBlock("sqlite"); ++i)
{
- Configuration::Block *block = config->GetBlock("sqlite", i);
- Anope::string connname = block->Get<const Anope::string>("name", "sqlite/main");
+ Configuration::Block &block = config.GetBlock("sqlite", i);
+ Anope::string connname = block.Get<const Anope::string>("name", "sqlite/main");
if (this->SQLiteServices.find(connname) == this->SQLiteServices.end())
{
- auto database = Anope::ExpandData(block->Get<const Anope::string>("database", "anope"));
+ auto database = Anope::ExpandData(block.Get<const Anope::string>("database", "anope"));
try
{
auto *ss = new SQLiteService(this, connname, database);
diff --git a/modules/extra/ssl_gnutls.cpp b/modules/extra/ssl_gnutls.cpp
index f8ef18f16..5e9147d5c 100644
--- a/modules/extra/ssl_gnutls.cpp
+++ b/modules/extra/ssl_gnutls.cpp
@@ -327,13 +327,13 @@ public:
}
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *config = conf->GetModule(this);
+ Configuration::Block &config = conf.GetModule(this);
- const Anope::string certfile = Anope::ExpandConfig(config->Get<const Anope::string>("cert", "fullchain.pem"));
- const Anope::string keyfile = Anope::ExpandConfig(config->Get<const Anope::string>("key", "privkey.pem"));
- const Anope::string dhfile = Anope::ExpandConfig(config->Get<const Anope::string>("dh", "dhparams.pem"));
+ const Anope::string certfile = Anope::ExpandConfig(config.Get<const Anope::string>("cert", "fullchain.pem"));
+ const Anope::string keyfile = Anope::ExpandConfig(config.Get<const Anope::string>("key", "privkey.pem"));
+ const Anope::string dhfile = Anope::ExpandConfig(config.Get<const Anope::string>("dh", "dhparams.pem"));
CheckFile(certfile);
CheckFile(keyfile);
@@ -365,9 +365,9 @@ public:
void OnPreServerConnect() override
{
- Configuration::Block *config = Config->GetBlock("uplink", Anope::CurrentUplink);
+ Configuration::Block &config = Config->GetBlock("uplink", Anope::CurrentUplink);
- if (config->Get<bool>("ssl"))
+ if (config.Get<bool>("ssl"))
{
this->service.Init(UplinkSock);
}
diff --git a/modules/extra/ssl_openssl.cpp b/modules/extra/ssl_openssl.cpp
index 28e734e44..50ac75466 100644
--- a/modules/extra/ssl_openssl.cpp
+++ b/modules/extra/ssl_openssl.cpp
@@ -144,12 +144,12 @@ public:
SSL_CTX_free(server_ctx);
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *config = conf->GetModule(this);
+ Configuration::Block &config = conf.GetModule(this);
- this->certfile = Anope::ExpandConfig(config->Get<const Anope::string>("cert", "fullchain.pem"));
- this->keyfile = Anope::ExpandConfig(config->Get<const Anope::string>("key", "privkey.pem"));
+ this->certfile = Anope::ExpandConfig(config.Get<const Anope::string>("cert", "fullchain.pem"));
+ this->keyfile = Anope::ExpandConfig(config.Get<const Anope::string>("key", "privkey.pem"));
if (Anope::IsFile(this->certfile))
{
@@ -177,7 +177,7 @@ public:
}
// Allow disabling old versions of TLS
- if (config->Get<bool>("tlsv10", "false"))
+ if (config.Get<bool>("tlsv10", "false"))
{
SSL_CTX_clear_options(client_ctx, SSL_OP_NO_TLSv1);
SSL_CTX_clear_options(server_ctx, SSL_OP_NO_TLSv1);
@@ -188,7 +188,7 @@ public:
SSL_CTX_set_options(server_ctx, SSL_OP_NO_TLSv1);
}
- if (config->Get<bool>("tlsv11", "true"))
+ if (config.Get<bool>("tlsv11", "true"))
{
SSL_CTX_clear_options(client_ctx, SSL_OP_NO_TLSv1_1);
SSL_CTX_clear_options(server_ctx, SSL_OP_NO_TLSv1_1);
@@ -199,7 +199,7 @@ public:
SSL_CTX_set_options(server_ctx, SSL_OP_NO_TLSv1_1);
}
- if (config->Get<bool>("tlsv12", "true"))
+ if (config.Get<bool>("tlsv12", "true"))
{
SSL_CTX_clear_options(client_ctx, SSL_OP_NO_TLSv1_2);
SSL_CTX_clear_options(server_ctx, SSL_OP_NO_TLSv1_2);
@@ -213,9 +213,9 @@ public:
void OnPreServerConnect() override
{
- Configuration::Block *config = Config->GetBlock("uplink", Anope::CurrentUplink);
+ Configuration::Block &config = Config->GetBlock("uplink", Anope::CurrentUplink);
- if (config->Get<bool>("ssl"))
+ if (config.Get<bool>("ssl"))
{
this->service.Init(UplinkSock);
}
diff --git a/modules/extra/xmlrpc.cpp b/modules/extra/xmlrpc.cpp
index 00b7d92ac..7652fc4d3 100644
--- a/modules/extra/xmlrpc.cpp
+++ b/modules/extra/xmlrpc.cpp
@@ -279,12 +279,12 @@ public:
xmlrpc_term();
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
if (httpref)
httpref->UnregisterPage(&xmlrpcinterface);
- this->httpref = ServiceReference<HTTPProvider>("HTTPProvider", conf->GetModule(this)->Get<const Anope::string>("server", "httpd/main"));
+ this->httpref = ServiceReference<HTTPProvider>("HTTPProvider", conf.GetModule(this).Get<const Anope::string>("server", "httpd/main"));
if (!httpref)
throw ConfigException("Unable to find http reference, is httpd loaded?");
diff --git a/modules/fantasy.cpp b/modules/fantasy.cpp
index 82584c41e..dc4fab4e9 100644
--- a/modules/fantasy.cpp
+++ b/modules/fantasy.cpp
@@ -76,7 +76,7 @@ public:
"Note that users wanting to use fantasy commands\n"
"MUST have enough access for both the FANTASY\n"
"privilege and the command they are executing."),
- Config->GetModule(this->owner)->Get<const Anope::string>("fantasycharacter", "!").c_str());
+ Config->GetModule(this->owner).Get<const Anope::string>("fantasycharacter", "!").c_str());
return true;
}
};
@@ -109,7 +109,7 @@ public:
return;
Anope::string normalized_param0 = Anope::NormalizeBuffer(params[0]);
- Anope::string fantasy_chars = Config->GetModule(this)->Get<Anope::string>("fantasycharacter", "!");
+ Anope::string fantasy_chars = Config->GetModule(this).Get<Anope::string>("fantasycharacter", "!");
if (!normalized_param0.find(c->ci->bi->nick))
{
diff --git a/modules/global/gl_queue.cpp b/modules/global/gl_queue.cpp
index 583a46f6a..8a0f5c9f5 100644
--- a/modules/global/gl_queue.cpp
+++ b/modules/global/gl_queue.cpp
@@ -69,7 +69,7 @@ private:
return;
}
- auto maxqueue = Config->GetModule(this->module)->Get<size_t>("maxqueue", "10");
+ auto maxqueue = Config->GetModule(this->module).Get<size_t>("maxqueue", "10");
if (global->CountQueue(source.nc) >= maxqueue)
{
source.Reply(_("You can not queue any more messages."));
diff --git a/modules/global/global.cpp b/modules/global/global.cpp
index 44b17326a..784088b97 100644
--- a/modules/global/global.cpp
+++ b/modules/global/global.cpp
@@ -61,9 +61,9 @@ public:
return q->size();
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- const auto glnick = conf->GetModule(this)->Get<const Anope::string>("client");
+ const auto glnick = conf.GetModule(this).Get<const Anope::string>("client");
if (glnick.empty())
throw ConfigException(Module::name + ": <client> must be defined");
@@ -76,21 +76,21 @@ public:
void OnRestart() override
{
- const auto msg = Config->GetModule(this)->Get<const Anope::string>("globaloncycledown");
+ const auto msg = Config->GetModule(this).Get<const Anope::string>("globaloncycledown");
if (!msg.empty())
this->SendSingle(msg, nullptr, nullptr, nullptr);
}
void OnShutdown() override
{
- const auto msg = Config->GetModule(this)->Get<const Anope::string>("globaloncycledown");
+ const auto msg = Config->GetModule(this).Get<const Anope::string>("globaloncycledown");
if (!msg.empty())
this->SendSingle(msg, nullptr, nullptr, nullptr);
}
void OnNewServer(Server *s) override
{
- const auto msg = Config->GetModule(this)->Get<const Anope::string>("globaloncycleup");
+ const auto msg = Config->GetModule(this).Get<const Anope::string>("globaloncycleup");
if (!msg.empty() && !Me->IsSynced())
s->Notice(global, msg);
}
@@ -138,7 +138,7 @@ public:
return false;
Anope::string line;
- if (source && !Config->GetModule(this)->Get<bool>("anonymousglobal"))
+ if (source && !Config->GetModule(this).Get<bool>("anonymousglobal"))
{
// A source is available and they're not anonymous.
line = Anope::printf("[%s] %s", source->GetNick().c_str(), message.c_str());
diff --git a/modules/help.cpp b/modules/help.cpp
index 117293373..ba559ca7f 100644
--- a/modules/help.cpp
+++ b/modules/help.cpp
@@ -44,8 +44,8 @@ public:
Anope::string source_command = source.command;
const BotInfo *bi = source.service;
const CommandInfo::map &map = source.c ? Config->Fantasy : bi->commands;
- bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"),
- hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands");
+ bool hide_privileged_commands = Config->GetBlock("options").Get<bool>("hideprivilegedcommands"),
+ hide_registered_commands = Config->GetBlock("options").Get<bool>("hideregisteredcommands");
if (params.empty() || params[0].equals_ci("ALL"))
{
diff --git a/modules/helpchan.cpp b/modules/helpchan.cpp
index 0ea427ec2..1854b78c7 100644
--- a/modules/helpchan.cpp
+++ b/modules/helpchan.cpp
@@ -18,7 +18,7 @@ public:
EventReturn OnChannelModeSet(Channel *c, MessageSource &, ChannelMode *mode, const Anope::string &param) override
{
- if (mode->name == "OP" && c && c->ci && c->name.equals_ci(Config->GetModule(this)->Get<const Anope::string>("helpchannel")))
+ if (mode->name == "OP" && c && c->ci && c->name.equals_ci(Config->GetModule(this).Get<const Anope::string>("helpchannel")))
{
User *u = User::Find(param);
diff --git a/modules/hostserv/hostserv.cpp b/modules/hostserv/hostserv.cpp
index 9c8266d02..1a38a7666 100644
--- a/modules/hostserv/hostserv.cpp
+++ b/modules/hostserv/hostserv.cpp
@@ -22,9 +22,9 @@ public:
throw ModuleException("Your IRCd does not support vhosts");
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- const Anope::string &hsnick = conf->GetModule(this)->Get<const Anope::string>("client");
+ const Anope::string &hsnick = conf.GetModule(this).Get<const Anope::string>("client");
if (hsnick.empty())
throw ConfigException(Module::name + ": <client> must be defined");
@@ -81,7 +81,7 @@ public:
void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) override
{
- if (mname == "OPER" && Config->GetModule(this)->Get<bool>("activate_on_deoper", "yes"))
+ if (mname == "OPER" && Config->GetModule(this).Get<bool>("activate_on_deoper", "yes"))
this->OnUserLogin(u);
}
@@ -95,7 +95,7 @@ public:
void OnSetVHost(NickAlias *na) override
{
- if (Config->GetModule(this)->Get<bool>("activate_on_set", "yes"))
+ if (Config->GetModule(this).Get<bool>("activate_on_set", "yes"))
{
User *u = User::Find(na->nick);
@@ -120,7 +120,7 @@ public:
void OnDeleteVHost(NickAlias *na) override
{
- if (Config->GetModule(this)->Get<bool>("activate_on_set", "yes"))
+ if (Config->GetModule(this).Get<bool>("activate_on_set", "yes"))
{
User *u = User::Find(na->nick);
diff --git a/modules/hostserv/hs_group.cpp b/modules/hostserv/hs_group.cpp
index 06c29290e..bf7b5ddca 100644
--- a/modules/hostserv/hs_group.cpp
+++ b/modules/hostserv/hs_group.cpp
@@ -105,11 +105,11 @@ public:
commandhsgroup.Sync(na);
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *block = conf->GetModule(this);
- syncongroup = block->Get<bool>("syncongroup");
- synconset = block->Get<bool>("synconset");
+ Configuration::Block &block = conf.GetModule(this);
+ syncongroup = block.Get<bool>("syncongroup");
+ synconset = block.Get<bool>("synconset");
}
};
diff --git a/modules/hostserv/hs_list.cpp b/modules/hostserv/hs_list.cpp
index 345d62852..174f4baf1 100644
--- a/modules/hostserv/hs_list.cpp
+++ b/modules/hostserv/hs_list.cpp
@@ -51,7 +51,7 @@ public:
}
}
- unsigned display_counter = 0, listmax = Config->GetModule(this->owner)->Get<unsigned>("listmax", "50");
+ unsigned display_counter = 0, listmax = Config->GetModule(this->owner).Get<unsigned>("listmax", "50");
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Nick")).AddColumn(_("VHost")).AddColumn(_("Creator")).AddColumn(_("Created"));
diff --git a/modules/hostserv/hs_request.cpp b/modules/hostserv/hs_request.cpp
index 649462aac..a54184bd3 100644
--- a/modules/hostserv/hs_request.cpp
+++ b/modules/hostserv/hs_request.cpp
@@ -154,8 +154,8 @@ public:
return;
}
- time_t send_delay = Config->GetModule("memoserv")->Get<time_t>("senddelay");
- if (Config->GetModule(this->owner)->Get<bool>("memooper") && send_delay > 0 && u && u->lastmemosend + send_delay > Anope::CurTime)
+ time_t send_delay = Config->GetModule("memoserv").Get<time_t>("senddelay");
+ if (Config->GetModule(this->owner).Get<bool>("memooper") && send_delay > 0 && u && u->lastmemosend + send_delay > Anope::CurTime)
{
auto waitperiod = (u->lastmemosend + send_delay) - Anope::CurTime;
source.Reply(_("Please wait %s before requesting a new vhost."), Anope::Duration(waitperiod, source.GetAccount()).c_str());
@@ -213,7 +213,7 @@ public:
na->SetVHost(req->ident, req->host, source.GetNick(), req->time);
FOREACH_MOD(OnSetVHost, (na));
- if (Config->GetModule(this->owner)->Get<bool>("memouser") && memoserv)
+ if (Config->GetModule(this->owner).Get<bool>("memouser") && memoserv)
memoserv->Send(source.service->nick, na->nick, _("[auto memo] Your requested vhost has been approved."), true);
source.Reply(_("VHost for %s has been activated."), na->nick.c_str());
@@ -229,7 +229,7 @@ public:
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Activate the requested vhost for the given nick."));
- if (Config->GetModule(this->owner)->Get<bool>("memouser"))
+ if (Config->GetModule(this->owner).Get<bool>("memouser"))
source.Reply(_("A memo informing the user will also be sent."));
return true;
@@ -263,7 +263,7 @@ public:
{
na->Shrink<HostRequestImpl>("hostrequest");
- if (Config->GetModule(this->owner)->Get<bool>("memouser") && memoserv)
+ if (Config->GetModule(this->owner).Get<bool>("memouser") && memoserv)
{
Anope::string message;
if (!reason.empty())
@@ -286,7 +286,7 @@ public:
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Reject the requested vhost for the given nick."));
- if (Config->GetModule(this->owner)->Get<bool>("memouser"))
+ if (Config->GetModule(this->owner).Get<bool>("memouser"))
source.Reply(_("A memo informing the user will also be sent, which includes the reason for the rejection if supplied."));
return true;
@@ -305,7 +305,7 @@ public:
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
unsigned counter = 0;
- unsigned display_counter = 0, listmax = Config->GetModule(this->owner)->Get<unsigned>("listmax");
+ unsigned display_counter = 0, listmax = Config->GetModule(this->owner).Get<unsigned>("listmax");
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Nick")).AddColumn(_("VHost")).AddColumn(_("Created"));
@@ -380,7 +380,7 @@ static void req_send_memos(Module *me, CommandSource &source, const Anope::strin
else
host = vhost;
- if (Config->GetModule(me)->Get<bool>("memooper") && memoserv)
+ if (Config->GetModule(me).Get<bool>("memooper") && memoserv)
{
for (auto *o : Oper::opers)
{
diff --git a/modules/httpd.cpp b/modules/httpd.cpp
index d25742aa2..92382436f 100644
--- a/modules/httpd.cpp
+++ b/modules/httpd.cpp
@@ -360,25 +360,25 @@ public:
this->providers.clear();
}
- void OnReload(Configuration::Conf *config) override
+ void OnReload(Configuration::Conf &config) override
{
- Configuration::Block *conf = config->GetModule(this);
+ Configuration::Block &conf = config.GetModule(this);
std::set<Anope::string> existing;
- for (int i = 0; i < conf->CountBlock("httpd"); ++i)
+ for (int i = 0; i < conf.CountBlock("httpd"); ++i)
{
- Configuration::Block *block = conf->GetBlock("httpd", i);
+ Configuration::Block &block = conf.GetBlock("httpd", i);
- const Anope::string &hname = block->Get<const Anope::string>("name", "httpd/main");
+ const Anope::string &hname = block.Get<const Anope::string>("name", "httpd/main");
existing.insert(hname);
- Anope::string ip = block->Get<const Anope::string>("ip");
- int port = block->Get<int>("port", "8080");
- int timeout = block->Get<int>("timeout", "30");
- bool ssl = block->Get<bool>("ssl", "no");
- Anope::string ext_ip = block->Get<const Anope::string>("extforward_ip");
- Anope::string ext_header = block->Get<const Anope::string>("extforward_header");
+ Anope::string ip = block.Get<const Anope::string>("ip");
+ int port = block.Get<int>("port", "8080");
+ int timeout = block.Get<int>("timeout", "30");
+ bool ssl = block.Get<bool>("ssl", "no");
+ Anope::string ext_ip = block.Get<const Anope::string>("extforward_ip");
+ Anope::string ext_header = block.Get<const Anope::string>("extforward_header");
if (ip.empty())
{
diff --git a/modules/irc2sql/irc2sql.cpp b/modules/irc2sql/irc2sql.cpp
index c288a2366..3c6ab9199 100644
--- a/modules/irc2sql/irc2sql.cpp
+++ b/modules/irc2sql/irc2sql.cpp
@@ -17,21 +17,21 @@ void IRC2SQL::OnShutdown()
quitting = true;
}
-void IRC2SQL::OnReload(Configuration::Conf *conf)
+void IRC2SQL::OnReload(Configuration::Conf &conf)
{
- Configuration::Block *block = Config->GetModule(this);
- prefix = block->Get<const Anope::string>("prefix", "anope_");
- GeoIPDB = block->Get<const Anope::string>("geoip_database");
- ctcpuser = block->Get<bool>("ctcpuser", "no");
- ctcpeob = block->Get<bool>("ctcpeob", "yes");
- Anope::string engine = block->Get<const Anope::string>("engine");
+ Configuration::Block &block = Config->GetModule(this);
+ prefix = block.Get<const Anope::string>("prefix", "anope_");
+ GeoIPDB = block.Get<const Anope::string>("geoip_database");
+ ctcpuser = block.Get<bool>("ctcpuser", "no");
+ ctcpeob = block.Get<bool>("ctcpeob", "yes");
+ Anope::string engine = block.Get<const Anope::string>("engine");
this->sql = ServiceReference<SQL::Provider>("SQL::Provider", engine);
if (sql)
this->CheckTables();
else
Log() << "IRC2SQL: no database connection to " << engine;
- const Anope::string &snick = block->Get<const Anope::string>("client");
+ const Anope::string &snick = block.Get<const Anope::string>("client");
if (snick.empty())
throw ConfigException(Module::name + ": <client> must be defined");
StatServ = BotInfo::Find(snick, true);
diff --git a/modules/irc2sql/irc2sql.h b/modules/irc2sql/irc2sql.h
index 27e1dee13..52a15e7f6 100644
--- a/modules/irc2sql/irc2sql.h
+++ b/modules/irc2sql/irc2sql.h
@@ -61,7 +61,7 @@ public:
}
void OnShutdown() override;
- void OnReload(Configuration::Conf *config) override;
+ void OnReload(Configuration::Conf &config) override;
void OnNewServer(Server *server) override;
void OnServerQuit(Server *server) override;
void OnUserConnect(User *u, bool &exempt) override;
diff --git a/modules/ldap_authentication.cpp b/modules/ldap_authentication.cpp
index 5860055e5..f4e3ddd0a 100644
--- a/modules/ldap_authentication.cpp
+++ b/modules/ldap_authentication.cpp
@@ -215,23 +215,23 @@ public:
ModuleManager::SetPriority(this, PRIORITY_FIRST);
}
- void OnReload(Configuration::Conf *config) override
+ void OnReload(Configuration::Conf &config) override
{
- Configuration::Block *conf = Config->GetModule(this);
+ Configuration::Block &conf = Config->GetModule(this);
- basedn = conf->Get<const Anope::string>("basedn");
- search_filter = conf->Get<const Anope::string>("search_filter");
- object_class = conf->Get<const Anope::string>("object_class");
- username_attribute = conf->Get<const Anope::string>("username_attribute");
- this->password_attribute = conf->Get<const Anope::string>("password_attribute");
- email_attribute = conf->Get<const Anope::string>("email_attribute");
- this->disable_register_reason = conf->Get<const Anope::string>("disable_register_reason");
- this->disable_email_reason = conf->Get<const Anope::string>("disable_email_reason");
+ basedn = conf.Get<const Anope::string>("basedn");
+ search_filter = conf.Get<const Anope::string>("search_filter");
+ object_class = conf.Get<const Anope::string>("object_class");
+ username_attribute = conf.Get<const Anope::string>("username_attribute");
+ this->password_attribute = conf.Get<const Anope::string>("password_attribute");
+ email_attribute = conf.Get<const Anope::string>("email_attribute");
+ this->disable_register_reason = conf.Get<const Anope::string>("disable_register_reason");
+ this->disable_email_reason = conf.Get<const Anope::string>("disable_email_reason");
if (!email_attribute.empty())
{
/* Don't complain to users about how they need to update their email, we will do it for them */
- config->GetModule("nickserv")->Set("forceemail", "no");
+ config.GetModule("nickserv").Set("forceemail", "no");
}
}
diff --git a/modules/ldap_oper.cpp b/modules/ldap_oper.cpp
index 3f34eb7ca..fa57f7aa9 100644
--- a/modules/ldap_oper.cpp
+++ b/modules/ldap_oper.cpp
@@ -92,15 +92,15 @@ public:
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *config = Config->GetModule(this);
+ Configuration::Block &config = Config->GetModule(this);
- this->binddn = config->Get<const Anope::string>("binddn");
- this->password = config->Get<const Anope::string>("password");
- this->basedn = config->Get<const Anope::string>("basedn");
- this->filter = config->Get<const Anope::string>("filter");
- opertype_attribute = config->Get<const Anope::string>("opertype_attribute");
+ this->binddn = config.Get<const Anope::string>("binddn");
+ this->password = config.Get<const Anope::string>("password");
+ this->basedn = config.Get<const Anope::string>("basedn");
+ this->filter = config.Get<const Anope::string>("filter");
+ opertype_attribute = config.Get<const Anope::string>("opertype_attribute");
for (const auto *oper : my_opers)
delete oper;
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"
diff --git a/modules/nickserv/nickserv.cpp b/modules/nickserv/nickserv.cpp
index 25d9a364e..7d34061c7 100644
--- a/modules/nickserv/nickserv.cpp
+++ b/modules/nickserv/nickserv.cpp
@@ -98,7 +98,7 @@ class NickServRelease final
public:
NickServRelease(Module *me, NickAlias *na, time_t delay)
- : User(na->nick, Config->GetModule(me)->Get<const Anope::string>("enforceruser", "user"), Config->GetModule(me)->Get<const Anope::string>("enforcerhost", Me->GetName()), "", "", Me, "Services Enforcer", Anope::CurTime, "", {}, IRCD->UID_Retrieve(), NULL)
+ : User(na->nick, Config->GetModule(me).Get<const Anope::string>("enforceruser", "user"), Config->GetModule(me).Get<const Anope::string>("enforcerhost", Me->GetName()), "", "", Me, "Services Enforcer", Anope::CurTime, "", {}, IRCD->UID_Retrieve(), NULL)
, Timer(me, delay)
, nick(na->nick)
{
@@ -140,12 +140,12 @@ class NickServCore final
{
collided.Unset(na);
- new NickServHeld(this, na, Config->GetModule(this)->Get<time_t>("releasetimeout", "1m"));
+ new NickServHeld(this, na, Config->GetModule(this).Get<time_t>("releasetimeout", "1m"));
if (IRCD->CanSVSHold)
- IRCD->SendSVSHold(na->nick, Config->GetModule(this)->Get<time_t>("releasetimeout", "1m"));
+ IRCD->SendSVSHold(na->nick, Config->GetModule(this).Get<time_t>("releasetimeout", "1m"));
else
- new NickServRelease(this, na, Config->GetModule(this)->Get<time_t>("releasetimeout", "1m"));
+ new NickServRelease(this, na, Config->GetModule(this).Get<time_t>("releasetimeout", "1m"));
}
}
@@ -176,7 +176,7 @@ public:
bool IsGuestNick(const Anope::string &nick) const override
{
- const auto guestnick = Config->GetModule(this)->Get<Anope::string>("guestnick", "Guest####");
+ const auto guestnick = Config->GetModule(this).Get<Anope::string>("guestnick", "Guest####");
if (guestnick.empty())
return false; // No guest nick.
@@ -208,7 +208,7 @@ public:
else if (MOD_RESULT == EVENT_ALLOW)
return;
- if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
+ if (Config->GetModule("nickserv").Get<bool>("nonicknameownership"))
return;
if (!na->nc->HasExt("KILL_IMMED"))
@@ -224,13 +224,13 @@ public:
}
else if (na->nc->HasExt("KILL_QUICK"))
{
- time_t killquick = Config->GetModule("nickserv")->Get<time_t>("killquick", "20s");
+ time_t killquick = Config->GetModule("nickserv").Get<time_t>("killquick", "20s");
u->SendMessage(NickServ, _("If you do not change within %s, I will change your nick."), Anope::Duration(killquick, u->Account()).c_str());
new NickServCollide(this, this, u, na, killquick);
}
else
{
- time_t kill = Config->GetModule("nickserv")->Get<time_t>("kill", "60s");
+ time_t kill = Config->GetModule("nickserv").Get<time_t>("kill", "60s");
u->SendMessage(NickServ, _("If you do not change within %s, I will change your nick."), Anope::Duration(kill, u->Account()).c_str());
new NickServCollide(this, this, u, na, kill);
}
@@ -241,10 +241,10 @@ public:
void OnUserLogin(User *u) override
{
NickAlias *na = NickAlias::Find(u->nick);
- if (na && *na->nc == u->Account() && !Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && !na->nc->HasExt("UNCONFIRMED"))
+ if (na && *na->nc == u->Account() && !Config->GetModule("nickserv").Get<bool>("nonicknameownership") && !na->nc->HasExt("UNCONFIRMED"))
u->SetMode(NickServ, "REGISTERED");
- const Anope::string &modesonid = Config->GetModule(this)->Get<Anope::string>("modesonid");
+ const Anope::string &modesonid = Config->GetModule(this).Get<Anope::string>("modesonid");
if (!modesonid.empty())
u->SetModes(NickServ, modesonid);
}
@@ -261,7 +261,7 @@ public:
for (auto i = 0; i < 10; ++i)
{
guestnick.clear();
- for (auto guestnickchr : Config->GetModule(this)->Get<Anope::string>("guestnick", "Guest####").substr(0, IRCD->MaxNick))
+ for (auto guestnickchr : Config->GetModule(this).Get<Anope::string>("guestnick", "Guest####").substr(0, IRCD->MaxNick))
{
if (guestnickchr == '#')
guestnick.append(Anope::ToString(abs(Anope::RandomNumber()) % 10));
@@ -319,9 +319,9 @@ public:
collided.Unset(na); /* clear pending collide */
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- const Anope::string &nsnick = conf->GetModule(this)->Get<const Anope::string>("client");
+ const Anope::string &nsnick = conf.GetModule(this).Get<const Anope::string>("client");
if (nsnick.empty())
throw ConfigException(Module::name + ": <client> must be defined");
@@ -332,7 +332,7 @@ public:
NickServ = bi;
- spacesepstream(conf->GetModule(this)->Get<const Anope::string>("defaults", "memo_signon memo_receive")).GetTokens(defaults);
+ spacesepstream(conf.GetModule(this).Get<const Anope::string>("defaults", "memo_signon memo_receive")).GetTokens(defaults);
if (defaults.empty())
{
defaults.emplace_back("MEMO_SIGNON");
@@ -376,9 +376,9 @@ public:
void OnNickIdentify(User *u) override
{
- Configuration::Block *block = Config->GetModule(this);
+ Configuration::Block &block = Config->GetModule(this);
- if (block->Get<bool>("modeonid", "yes"))
+ if (block.Get<bool>("modeonid", "yes"))
{
for (const auto &[_, cc] : u->chans)
{
@@ -388,11 +388,11 @@ public:
}
}
- const Anope::string &modesonid = block->Get<const Anope::string>("modesonid");
+ const Anope::string &modesonid = block.Get<const Anope::string>("modesonid");
if (!modesonid.empty())
u->SetModes(NickServ, modesonid);
- if (block->Get<bool>("forceemail", "yes") && u->Account()->email.empty())
+ if (block.Get<bool>("forceemail", "yes") && u->Account()->email.empty())
{
u->SendMessage(NickServ, _("You must now supply an email for your nick.\n"
"This email will allow you to retrieve your password in\n"
@@ -434,8 +434,8 @@ public:
const NickAlias *na = NickAlias::Find(u->nick);
- const Anope::string &unregistered_notice = Config->GetModule(this)->Get<const Anope::string>("unregistered_notice");
- if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && !unregistered_notice.empty() && !na && !u->IsIdentified())
+ const Anope::string &unregistered_notice = Config->GetModule(this).Get<const Anope::string>("unregistered_notice");
+ if (!Config->GetModule("nickserv").Get<bool>("nonicknameownership") && !unregistered_notice.empty() && !na && !u->IsIdentified())
u->SendMessage(NickServ, unregistered_notice.replace_all_cs("%n", u->nick));
else if (na && !u->IsIdentified(true))
this->Validate(u);
@@ -477,7 +477,7 @@ public:
{
/* Reset +r and re-send account (even though it really should be set at this point) */
IRCD->SendLogin(u, na);
- if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && na->nc == u->Account() && !na->nc->HasExt("UNCONFIRMED"))
+ if (!Config->GetModule("nickserv").Get<bool>("nonicknameownership") && na->nc == u->Account() && !na->nc->HasExt("UNCONFIRMED"))
u->SetMode(NickServ, "REGISTERED");
Log(u, "", NickServ) << u->GetMask() << " automatically identified for group " << u->Account()->display;
}
@@ -496,7 +496,7 @@ public:
{
if (!params.empty() || source.c || source.service != *NickServ)
return EVENT_CONTINUE;
- if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
+ if (!Config->GetModule("nickserv").Get<bool>("nonicknameownership"))
source.Reply(_("\002%s\002 allows you to register a nickname and\n"
"prevent others from using it. The following\n"
"commands allow for registration and maintenance of\n"
@@ -521,7 +521,7 @@ public:
"Services Operators can also drop any nickname without needing\n"
"to identify for the nick, and may view the access list for\n"
"any nickname."));
- time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "1y");
+ time_t nickserv_expire = Config->GetModule(this).Get<time_t>("expire", "1y");
if (nickserv_expire >= 86400)
source.Reply(_(" \n"
"Accounts that are not used anymore are subject to\n"
@@ -538,7 +538,7 @@ public:
void OnUserQuit(User *u, const Anope::string &msg) override
{
- if (u->server && !u->server->GetQuitReason().empty() && Config->GetModule(this)->Get<bool>("hidenetsplitquit"))
+ if (u->server && !u->server->GetQuitReason().empty() && Config->GetModule(this).Get<bool>("hidenetsplitquit"))
return;
/* Update last quit and last seen for the user */
@@ -555,7 +555,7 @@ public:
if (Anope::NoExpire || Anope::ReadOnly)
return;
- time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "90d");
+ time_t nickserv_expire = Config->GetModule(this).Get<time_t>("expire", "90d");
for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; )
{
@@ -571,7 +571,7 @@ public:
if (nickserv_expire && Anope::CurTime - na->last_seen >= nickserv_expire)
expire = true;
- if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv")->Get<bool>("preservedisplay"))
+ if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv").Get<bool>("preservedisplay"))
expire = false;
FOREACH_MOD(OnPreNickExpire, (na, expire));
@@ -589,13 +589,13 @@ public:
{
if (!na->nc->HasExt("UNCONFIRMED"))
{
- time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "1y");
+ time_t nickserv_expire = Config->GetModule(this).Get<time_t>("expire", "1y");
if (!na->HasExt("NS_NO_EXPIRE") && nickserv_expire && !Anope::NoExpire && (source.HasPriv("nickserv/auspex") || na->last_seen != Anope::CurTime))
info[_("Expires")] = Anope::strftime(na->last_seen + nickserv_expire, source.GetAccount());
}
else
{
- time_t unconfirmed_expire = Config->GetModule("ns_register")->Get<time_t>("unconfirmedexpire", "1d");
+ time_t unconfirmed_expire = Config->GetModule("ns_register").Get<time_t>("unconfirmedexpire", "1d");
info[_("Expires")] = Anope::strftime(na->time_registered + unconfirmed_expire, source.GetAccount());
}
}
diff --git a/modules/nickserv/ns_ajoin.cpp b/modules/nickserv/ns_ajoin.cpp
index 8643a2c1b..a169022b1 100644
--- a/modules/nickserv/ns_ajoin.cpp
+++ b/modules/nickserv/ns_ajoin.cpp
@@ -139,9 +139,9 @@ class CommandNSAJoin final
if ((*channels)->at(i)->channel.equals_ci(chan))
break;
- if ((*channels)->size() >= Config->GetModule(this->owner)->Get<unsigned>("ajoinmax"))
+ if ((*channels)->size() >= Config->GetModule(this->owner).Get<unsigned>("ajoinmax"))
{
- source.Reply(_("Sorry, the maximum of %d auto join entries has been reached."), Config->GetModule(this->owner)->Get<unsigned>("ajoinmax"));
+ source.Reply(_("Sorry, the maximum of %d auto join entries has been reached."), Config->GetModule(this->owner).Get<unsigned>("ajoinmax"));
return;
}
else if (i != (*channels)->size())
diff --git a/modules/nickserv/ns_cert.cpp b/modules/nickserv/ns_cert.cpp
index 9a697df17..15f6dbab8 100644
--- a/modules/nickserv/ns_cert.cpp
+++ b/modules/nickserv/ns_cert.cpp
@@ -204,7 +204,7 @@ private:
void DoAdd(CommandSource &source, NickCore *nc, Anope::string certfp)
{
NSCertList *cl = nc->Require<NSCertList>("certificates");
- unsigned max = Config->GetModule(this->owner)->Get<unsigned>("max", "5");
+ unsigned max = Config->GetModule(this->owner).Get<unsigned>("max", "5");
if (cl->GetCertCount() >= max)
{
@@ -325,7 +325,7 @@ public:
source.Reply(ACCESS_DENIED);
return;
}
- else if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.GetAccount() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST"))
+ else if (Config->GetModule("nickserv").Get<bool>("secureadmins", "yes") && source.GetAccount() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST"))
{
source.Reply(_("You may view but not modify the certificate list of other Services Operators."));
return;
@@ -401,7 +401,7 @@ public:
if (!nc || nc->HasExt("NS_SUSPENDED"))
return;
- unsigned int maxlogins = Config->GetModule("ns_identify")->Get<unsigned int>("maxlogins");
+ unsigned int maxlogins = Config->GetModule("ns_identify").Get<unsigned int>("maxlogins");
if (maxlogins && nc->users.size() >= maxlogins)
{
u->SendMessage(NickServ, _("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), nc->display.c_str(), maxlogins);
@@ -420,7 +420,7 @@ public:
void OnNickRegister(User *u, NickAlias *na, const Anope::string &pass) override
{
- if (!Config->GetModule(this)->Get<bool>("automatic", "yes") || !u || u->fingerprint.empty())
+ if (!Config->GetModule(this).Get<bool>("automatic", "yes") || !u || u->fingerprint.empty())
return;
auto *cl = certs.Require(na->nc);
@@ -437,7 +437,7 @@ public:
{
BotInfo *NickServ = Config->GetClient("NickServ");
- unsigned int maxlogins = Config->GetModule("ns_identify")->Get<unsigned int>("maxlogins");
+ unsigned int maxlogins = Config->GetModule("ns_identify").Get<unsigned int>("maxlogins");
if (maxlogins && na->nc->users.size() >= maxlogins)
{
u->SendMessage(NickServ, _("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), na->nc->display.c_str(), maxlogins);
diff --git a/modules/nickserv/ns_drop.cpp b/modules/nickserv/ns_drop.cpp
index 791db0bfb..f2e152ce8 100644
--- a/modules/nickserv/ns_drop.cpp
+++ b/modules/nickserv/ns_drop.cpp
@@ -51,13 +51,13 @@ public:
return;
}
- if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && !is_mine && na->nc->IsServicesOper())
+ if (Config->GetModule("nickserv").Get<bool>("secureadmins", "yes") && !is_mine && na->nc->IsServicesOper())
{
source.Reply(_("You may not drop other Services Operators' nicknames."));
return;
}
- if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv")->Get<bool>("preservedisplay") && !source.HasPriv("nickserv/drop/display"))
+ if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv").Get<bool>("preservedisplay") && !source.HasPriv("nickserv/drop/display"))
{
source.Reply(_("You may not drop \002%s\002 as it is the display nick for the account."), na->nick.c_str());
return;
diff --git a/modules/nickserv/ns_group.cpp b/modules/nickserv/ns_group.cpp
index 47d8066e0..69df8d16e 100644
--- a/modules/nickserv/ns_group.cpp
+++ b/modules/nickserv/ns_group.cpp
@@ -138,7 +138,7 @@ public:
return;
}
- if (Config->GetModule("nickserv")->Get<bool>("restrictopernicks"))
+ if (Config->GetModule("nickserv").Get<bool>("restrictopernicks"))
{
for (auto *o : Oper::opers)
{
@@ -151,8 +151,8 @@ public:
}
NickAlias *target, *na = NickAlias::Find(source.GetNick());
- time_t reg_delay = Config->GetModule("nickserv")->Get<time_t>("regdelay");
- unsigned maxaliases = Config->GetModule(this->owner)->Get<unsigned>("maxaliases");
+ time_t reg_delay = Config->GetModule("nickserv").Get<time_t>("regdelay");
+ unsigned maxaliases = Config->GetModule(this->owner).Get<unsigned>("maxaliases");
if (!(target = NickAlias::Find(nick)))
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
else if (user && Anope::CurTime < user->lastnickreg + reg_delay)
@@ -165,7 +165,7 @@ public:
Log(LOG_COMMAND, source, this) << "and tried to group to SUSPENDED nick " << target->nick;
source.Reply(NICK_X_SUSPENDED, target->nick.c_str());
}
- else if (na && Config->GetModule(this->owner)->Get<bool>("nogroupchange"))
+ else if (na && Config->GetModule(this->owner).Get<bool>("nogroupchange"))
source.Reply(_("Your nick is already registered."));
else if (na && *target->nc == *na->nc)
source.Reply(_("You are already a member of the group of \002%s\002."), target->nick.c_str());
@@ -336,8 +336,8 @@ public:
ListFormatter list(source.GetAccount());
list.AddColumn(_("Nick")).AddColumn(_("Expires"));
- time_t nickserv_expire = Config->GetModule("nickserv")->Get<time_t>("expire", "90d"),
- unconfirmed_expire = Config->GetModule("ns_register")->Get<time_t>("unconfirmedexpire", "1d");
+ time_t nickserv_expire = Config->GetModule("nickserv").Get<time_t>("expire", "90d"),
+ unconfirmed_expire = Config->GetModule("ns_register").Get<time_t>("unconfirmedexpire", "1d");
for (auto *na2 : *nc->aliases)
{
Anope::string expires;
@@ -398,7 +398,7 @@ public:
NSGroup(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
commandnsgroup(this), commandnsungroup(this), commandnsglist(this)
{
- if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
+ if (Config->GetModule("nickserv").Get<bool>("nonicknameownership"))
throw ModuleException(modname + " can not be used with options:nonicknameownership enabled");
}
};
diff --git a/modules/nickserv/ns_identify.cpp b/modules/nickserv/ns_identify.cpp
index c1f077ee5..44e6bb840 100644
--- a/modules/nickserv/ns_identify.cpp
+++ b/modules/nickserv/ns_identify.cpp
@@ -95,7 +95,7 @@ public:
return;
}
- unsigned int maxlogins = Config->GetModule(this->owner)->Get<unsigned int>("maxlogins");
+ unsigned int maxlogins = Config->GetModule(this->owner).Get<unsigned int>("maxlogins");
if (na && maxlogins && na->nc->users.size() >= maxlogins)
{
source.Reply(_("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), na->nc->display.c_str(), maxlogins);
diff --git a/modules/nickserv/ns_list.cpp b/modules/nickserv/ns_list.cpp
index c322d259b..5a5beacbd 100644
--- a/modules/nickserv/ns_list.cpp
+++ b/modules/nickserv/ns_list.cpp
@@ -30,7 +30,7 @@ public:
bool is_servadmin = source.HasCommand("nickserv/list");
int count = 0, from = 0, to = 0;
bool suspended, nsnoexpire, unconfirmed;
- unsigned listmax = Config->GetModule(this->owner)->Get<unsigned>("listmax", "50");
+ unsigned listmax = Config->GetModule(this->owner).Get<unsigned>("listmax", "50");
suspended = nsnoexpire = unconfirmed = false;
@@ -164,7 +164,7 @@ public:
" \002LIST #51-100\002\n"
" Lists all registered nicks within the given range (51-100)."));
- const Anope::string &regexengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
+ const Anope::string &regexengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
if (!regexengine.empty())
{
source.Reply(" ");
diff --git a/modules/nickserv/ns_maxemail.cpp b/modules/nickserv/ns_maxemail.cpp
index 45409188d..ab18e4b54 100644
--- a/modules/nickserv/ns_maxemail.cpp
+++ b/modules/nickserv/ns_maxemail.cpp
@@ -38,7 +38,7 @@ class NSMaxEmail final
bool CheckLimitReached(CommandSource &source, const Anope::string &email)
{
- int NSEmailMax = Config->GetModule(this)->Get<int>("maxemails");
+ int NSEmailMax = Config->GetModule(this).Get<int>("maxemails");
if (NSEmailMax < 1 || email.empty())
return false;
@@ -79,9 +79,9 @@ public:
{
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- clean = conf->GetModule(this)->Get<bool>("remove_aliases", "true");
+ clean = conf.GetModule(this).Get<bool>("remove_aliases", "true");
}
EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> &params) override
diff --git a/modules/nickserv/ns_recover.cpp b/modules/nickserv/ns_recover.cpp
index 8de4a9e40..062eb1dfc 100644
--- a/modules/nickserv/ns_recover.cpp
+++ b/modules/nickserv/ns_recover.cpp
@@ -71,7 +71,7 @@ public:
Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << u->Account()->display;
}
- if (Config->GetModule("ns_recover")->Get<bool>("restoreonrecover"))
+ if (Config->GetModule("ns_recover").Get<bool>("restoreonrecover"))
{
if (!u->chans.empty())
{
@@ -239,14 +239,14 @@ public:
commandnsrecover(this), recover(this, "recover"), svsnick(this, "svsnick")
{
- if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
+ if (Config->GetModule("nickserv").Get<bool>("nonicknameownership"))
throw ModuleException(modname + " can not be used with options:nonicknameownership enabled");
}
void OnUserNickChange(User *u, const Anope::string &oldnick) override
{
- if (Config->GetModule(this)->Get<bool>("restoreonrecover"))
+ if (Config->GetModule(this).Get<bool>("restoreonrecover"))
{
NSRecoverInfo *ei = recover.Get(u);
BotInfo *NickServ = Config->GetClient("NickServ");
@@ -281,7 +281,7 @@ public:
void OnJoinChannel(User *u, Channel *c) override
{
- if (Config->GetModule(this)->Get<bool>("restoreonrecover"))
+ if (Config->GetModule(this).Get<bool>("restoreonrecover"))
{
NSRecoverInfo *ei = recover.Get(u);
diff --git a/modules/nickserv/ns_register.cpp b/modules/nickserv/ns_register.cpp
index 38fa55ca5..8222f7ad3 100644
--- a/modules/nickserv/ns_register.cpp
+++ b/modules/nickserv/ns_register.cpp
@@ -56,7 +56,7 @@ public:
NickAlias *u_na = NickAlias::Find(u->nick);
/* Set +r if they're on a nick in the group */
- if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && u_na && *u_na->nc == *na->nc)
+ if (!Config->GetModule("nickserv").Get<bool>("nonicknameownership") && u_na && *u_na->nc == *na->nc)
u->SetMode(source.service, "REGISTERED");
}
}
@@ -79,7 +79,7 @@ public:
if (na)
{
IRCD->SendLogin(source.GetUser(), na);
- if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && na->nc == source.GetAccount() && !na->nc->HasExt("UNCONFIRMED"))
+ if (!Config->GetModule("nickserv").Get<bool>("nonicknameownership") && na->nc == source.GetAccount() && !na->nc->HasExt("UNCONFIRMED"))
source.GetUser()->SetMode(source.service, "REGISTERED");
}
}
@@ -124,7 +124,7 @@ public:
CommandNSRegister(Module *creator) : Command(creator, "nickserv/register", 1, 2)
{
this->SetDesc(_("Register a nickname"));
- if (Config->GetModule("nickserv")->Get<bool>("forceemail", "yes"))
+ if (Config->GetModule("nickserv").Get<bool>("forceemail", "yes"))
this->SetSyntax(_("\037password\037 \037email\037"));
else
this->SetSyntax(_("\037password\037 \037[email]\037"));
@@ -137,7 +137,7 @@ public:
Anope::string u_nick = source.GetNick();
Anope::string pass = params[0];
Anope::string email = params.size() > 1 ? params[1] : "";
- const Anope::string &nsregister = Config->GetModule(this->owner)->Get<const Anope::string>("registration");
+ const Anope::string &nsregister = Config->GetModule(this->owner).Get<const Anope::string>("registration");
if (Anope::ReadOnly)
{
@@ -151,8 +151,8 @@ public:
return;
}
- time_t nickregdelay = Config->GetModule(this->owner)->Get<time_t>("nickregdelay");
- time_t reg_delay = Config->GetModule("nickserv")->Get<time_t>("regdelay");
+ time_t nickregdelay = Config->GetModule(this->owner).Get<time_t>("nickregdelay");
+ time_t reg_delay = Config->GetModule("nickserv").Get<time_t>("regdelay");
if (u && !u->HasMode("OPER") && nickregdelay && Anope::CurTime - u->timestamp < nickregdelay)
{
auto waitperiod = (u->timestamp + nickregdelay) - Anope::CurTime;
@@ -179,7 +179,7 @@ public:
return;
}
- if (Config->GetModule("nickserv")->Get<bool>("restrictopernicks"))
+ if (Config->GetModule("nickserv").Get<bool>("restrictopernicks"))
{
for (auto *o : Oper::opers)
{
@@ -191,10 +191,10 @@ public:
}
}
- unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "10");
- unsigned int maxpasslen = Config->GetModule("nickserv")->Get<unsigned>("maxpasslen", "50");
+ unsigned int minpasslen = Config->GetModule("nickserv").Get<unsigned>("minpasslen", "10");
+ unsigned int maxpasslen = Config->GetModule("nickserv").Get<unsigned>("maxpasslen", "50");
- if (Config->GetModule("nickserv")->Get<bool>("forceemail", "yes") && email.empty())
+ if (Config->GetModule("nickserv").Get<bool>("forceemail", "yes") && email.empty())
this->OnSyntaxError(source, "");
else if (u && Anope::CurTime < u->lastnickreg + reg_delay)
{
@@ -271,7 +271,7 @@ public:
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
{
- unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "10");
+ unsigned int minpasslen = Config->GetModule("nickserv").Get<unsigned>("minpasslen", "10");
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Registers your nickname in the %s database. Once\n"
@@ -294,7 +294,7 @@ public:
source.service->nick.c_str(), source.service->nick.c_str(),
minpasslen);
- if (!Config->GetModule("nickserv")->Get<bool>("forceemail", "yes"))
+ if (!Config->GetModule("nickserv").Get<bool>("forceemail", "yes"))
{
source.Reply(" ");
source.Reply(_("The \037email\037 parameter is optional and will set the email\n"
@@ -322,7 +322,7 @@ public:
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- if (!Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail"))
+ if (!Config->GetModule(this->owner).Get<const Anope::string>("registration").equals_ci("mail"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -336,7 +336,7 @@ public:
source.Reply(_("Your account is already confirmed."));
else
{
- if (Anope::CurTime < source.nc->lastmail + Config->GetModule(this->owner)->Get<time_t>("resenddelay"))
+ if (Anope::CurTime < source.nc->lastmail + Config->GetModule(this->owner).Get<time_t>("resenddelay"))
source.Reply(_("Cannot send mail now; please retry a little later."));
else if (SendRegmail(source.GetUser(), na, source.service))
{
@@ -353,7 +353,7 @@ public:
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
{
- if (!Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail"))
+ if (!Config->GetModule(this->owner).Get<const Anope::string>("registration").equals_ci("mail"))
return false;
this->SendSyntax(source);
@@ -364,7 +364,7 @@ public:
void OnServHelp(CommandSource &source) override
{
- if (Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail"))
+ if (Config->GetModule(this->owner).Get<const Anope::string>("registration").equals_ci("mail"))
Command::OnServHelp(source);
}
};
@@ -384,7 +384,7 @@ public:
commandnsregister(this), commandnsconfirm(this), commandnsrsend(this), unconfirmed(this, "UNCONFIRMED"),
passcode(this, "passcode")
{
- if (Config->GetModule(this)->Get<const Anope::string>("registration").equals_ci("disable"))
+ if (Config->GetModule(this).Get<const Anope::string>("registration").equals_ci("disable"))
throw ModuleException("Module " + this->name + " will not load with registration disabled.");
}
@@ -393,14 +393,14 @@ public:
BotInfo *NickServ;
if (unconfirmed.HasExt(u->Account()) && (NickServ = Config->GetClient("NickServ")))
{
- const Anope::string &nsregister = Config->GetModule(this)->Get<const Anope::string>("registration");
+ const Anope::string &nsregister = Config->GetModule(this).Get<const Anope::string>("registration");
if (nsregister.equals_ci("admin"))
u->SendMessage(NickServ, _("All new accounts must be validated by an administrator. Please wait for your registration to be confirmed."));
else
u->SendMessage(NickServ, _("Your email address is not confirmed. To confirm it, follow the instructions that were emailed to you."));
const NickAlias *this_na = u->AccountNick();
time_t time_registered = Anope::CurTime - this_na->time_registered;
- time_t unconfirmed_expire = Config->GetModule(this)->Get<time_t>("unconfirmedexpire", "1d");
+ time_t unconfirmed_expire = Config->GetModule(this).Get<time_t>("unconfirmedexpire", "1d");
if (unconfirmed_expire > time_registered)
u->SendMessage(NickServ, _("Your account will expire, if not confirmed, in %s."), Anope::Duration(unconfirmed_expire - time_registered, u->Account()).c_str());
}
@@ -410,7 +410,7 @@ public:
{
if (unconfirmed.HasExt(na->nc))
{
- time_t unconfirmed_expire = Config->GetModule(this)->Get<time_t>("unconfirmedexpire", "1d");
+ time_t unconfirmed_expire = Config->GetModule(this).Get<time_t>("unconfirmedexpire", "1d");
if (unconfirmed_expire && Anope::CurTime - na->time_registered >= unconfirmed_expire)
expire = true;
}
@@ -428,15 +428,15 @@ static bool SendRegmail(User *u, const NickAlias *na, BotInfo *bi)
*code = Anope::Random(15);
}
- Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const Anope::string>("registration_subject").c_str()),
- message = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const Anope::string>("registration_message").c_str());
+ Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail").Get<const Anope::string>("registration_subject").c_str()),
+ message = Language::Translate(na->nc, Config->GetBlock("mail").Get<const Anope::string>("registration_message").c_str());
subject = subject.replace_all_cs("%n", na->nick);
- 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"));
subject = subject.replace_all_cs("%c", *code);
message = message.replace_all_cs("%n", na->nick);
- 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"));
message = message.replace_all_cs("%c", *code);
return Mail::Send(u, nc, bi, subject, message);
diff --git a/modules/nickserv/ns_resetpass.cpp b/modules/nickserv/ns_resetpass.cpp
index fbb8d1540..52dd4e139 100644
--- a/modules/nickserv/ns_resetpass.cpp
+++ b/modules/nickserv/ns_resetpass.cpp
@@ -73,7 +73,7 @@ public:
NSResetPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
commandnsresetpass(this), reset(this, "reset")
{
- if (!Config->GetBlock("mail")->Get<bool>("usemail"))
+ if (!Config->GetBlock("mail").Get<bool>("usemail"))
throw ModuleException("Not using mail.");
}
@@ -132,16 +132,16 @@ public:
static bool SendResetEmail(User *u, const NickAlias *na, BotInfo *bi)
{
- Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const Anope::string>("reset_subject").c_str()),
- message = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const Anope::string>("reset_message").c_str()),
+ Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail").Get<const Anope::string>("reset_subject").c_str()),
+ message = Language::Translate(na->nc, Config->GetBlock("mail").Get<const Anope::string>("reset_message").c_str()),
passcode = Anope::Random(20);
subject = subject.replace_all_cs("%n", na->nick);
- 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"));
subject = subject.replace_all_cs("%c", passcode);
message = message.replace_all_cs("%n", na->nick);
- 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"));
message = message.replace_all_cs("%c", passcode);
ResetInfo *ri = na->nc->Extend<ResetInfo>("reset");
diff --git a/modules/nickserv/ns_set.cpp b/modules/nickserv/ns_set.cpp
index a1291fe26..b9d489ee3 100644
--- a/modules/nickserv/ns_set.cpp
+++ b/modules/nickserv/ns_set.cpp
@@ -34,8 +34,8 @@ public:
source.Reply(_("Sets various nickname options. \037option\037 can be one of:"));
Anope::string this_name = source.command;
- bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"),
- hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands");
+ bool hide_privileged_commands = Config->GetBlock("options").Get<bool>("hideprivilegedcommands"),
+ hide_registered_commands = Config->GetBlock("options").Get<bool>("hideregisteredcommands");
for (const auto &[c_name, info] : source.service->commands)
{
if (c_name.find_ci(this_name + " ") == 0)
@@ -134,14 +134,14 @@ public:
return;
}
- unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "10");
+ unsigned int minpasslen = Config->GetModule("nickserv").Get<unsigned>("minpasslen", "10");
if (len < minpasslen)
{
source.Reply(PASSWORD_TOO_SHORT, minpasslen);
return;
}
- unsigned int maxpasslen = Config->GetModule("nickserv")->Get<unsigned>("maxpasslen", "50");
+ unsigned int maxpasslen = Config->GetModule("nickserv").Get<unsigned>("maxpasslen", "50");
if (len > maxpasslen)
{
source.Reply(PASSWORD_TOO_LONG, maxpasslen);
@@ -196,7 +196,7 @@ public:
size_t len = params[1].length();
- if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper())
+ if (Config->GetModule("nickserv").Get<bool>("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper())
{
source.Reply(_("You may not change the password of other Services Operators."));
return;
@@ -208,14 +208,14 @@ public:
return;
}
- unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "10");
+ unsigned int minpasslen = Config->GetModule("nickserv").Get<unsigned>("minpasslen", "10");
if (len < minpasslen)
{
source.Reply(PASSWORD_TOO_SHORT, minpasslen);
return;
}
- unsigned int maxpasslen = Config->GetModule("nickserv")->Get<unsigned>("maxpasslen", "50");
+ unsigned int maxpasslen = Config->GetModule("nickserv").Get<unsigned>("maxpasslen", "50");
if (len > maxpasslen)
{
source.Reply(PASSWORD_TOO_LONG, maxpasslen);
@@ -440,7 +440,7 @@ public:
NickAlias *user_na = NickAlias::Find(user), *na = NickAlias::Find(param);
- if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
+ if (Config->GetModule("nickserv").Get<bool>("nonicknameownership"))
{
source.Reply(_("This command may not be used on this network because nickname ownership is disabled."));
return;
@@ -526,19 +526,19 @@ class CommandNSSetEmail
n->first = new_email;
n->second = code;
- Anope::string subject = Config->GetBlock("mail")->Get<const Anope::string>("emailchange_subject"),
- message = Config->GetBlock("mail")->Get<const Anope::string>("emailchange_message");
+ Anope::string subject = Config->GetBlock("mail").Get<const Anope::string>("emailchange_subject"),
+ message = Config->GetBlock("mail").Get<const Anope::string>("emailchange_message");
subject = subject.replace_all_cs("%e", nc->email);
subject = subject.replace_all_cs("%E", new_email);
subject = subject.replace_all_cs("%n", nc->display);
- 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"));
subject = subject.replace_all_cs("%c", code);
message = message.replace_all_cs("%e", nc->email);
message = message.replace_all_cs("%E", new_email);
message = message.replace_all_cs("%n", nc->display);
- 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"));
message = message.replace_all_cs("%c", code);
Anope::string old = nc->email;
@@ -577,12 +577,12 @@ public:
return;
}
- if (param.empty() && Config->GetModule("nickserv")->Get<bool>("forceemail", "yes"))
+ if (param.empty() && Config->GetModule("nickserv").Get<bool>("forceemail", "yes"))
{
source.Reply(_("You cannot unset the email on this network."));
return;
}
- else if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper())
+ else if (Config->GetModule("nickserv").Get<bool>("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper())
{
source.Reply(_("You may not change the email of other Services Operators."));
return;
@@ -598,8 +598,8 @@ public:
if (MOD_RESULT == EVENT_STOP)
return;
- const auto nsmailreg = Config->GetModule("ns_register")->Get<const Anope::string>("registration").equals_ci("mail");
- if (!param.empty() && Config->GetModule("nickserv")->Get<bool>("confirmemailchanges", nsmailreg ? "yes" : "no") && !source.IsServicesOper())
+ const auto nsmailreg = Config->GetModule("ns_register").Get<const Anope::string>("registration").equals_ci("mail");
+ if (!param.empty() && Config->GetModule("nickserv").Get<bool>("confirmemailchanges", nsmailreg ? "yes" : "no") && !source.IsServicesOper())
{
if (SendConfirmMail(source.GetUser(), source.GetAccount(), source.service, param))
{
diff --git a/modules/nickserv/ns_set_keepmodes.cpp b/modules/nickserv/ns_set_keepmodes.cpp
index e31b33dac..aa09d0555 100644
--- a/modules/nickserv/ns_set_keepmodes.cpp
+++ b/modules/nickserv/ns_set_keepmodes.cpp
@@ -191,7 +191,7 @@ public:
{
if (keep_modes.HasExt(u->Account()))
{
- const auto norestore = Config->GetModule(this)->Get<const Anope::string>("norestore");
+ const auto norestore = Config->GetModule(this).Get<const Anope::string>("norestore");
User::ModeList modes = u->Account()->last_modes;
for (const auto &[last_mode, last_value] : modes)
{
diff --git a/modules/nickserv/ns_set_kill.cpp b/modules/nickserv/ns_set_kill.cpp
index 8447bf74f..0338c4bb8 100644
--- a/modules/nickserv/ns_set_kill.cpp
+++ b/modules/nickserv/ns_set_kill.cpp
@@ -30,7 +30,7 @@ public:
return;
}
- if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
+ if (Config->GetModule("nickserv").Get<bool>("nonicknameownership"))
{
source.Reply(_("This command may not be used on this network because nickname ownership is disabled."));
return;
@@ -67,7 +67,7 @@ public:
}
else if (param.equals_ci("IMMED"))
{
- if (Config->GetModule(this->owner)->Get<bool>("allowkillimmed"))
+ if (Config->GetModule(this->owner).Get<bool>("allowkillimmed"))
{
nc->Extend<bool>("KILLPROTECT");
nc->Shrink<bool>("KILL_QUICK");
diff --git a/modules/nickserv/ns_set_misc.cpp b/modules/nickserv/ns_set_misc.cpp
index 173f1f2da..77dd62d92 100644
--- a/modules/nickserv/ns_set_misc.cpp
+++ b/modules/nickserv/ns_set_misc.cpp
@@ -200,21 +200,21 @@ public:
delete data;
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
descriptions.clear();
- for (int i = 0; i < conf->CountBlock("command"); ++i)
+ for (int i = 0; i < conf.CountBlock("command"); ++i)
{
- Configuration::Block *block = conf->GetBlock("command", i);
+ Configuration::Block &block = conf.GetBlock("command", i);
- const Anope::string &cmd = block->Get<const Anope::string>("command");
+ const Anope::string &cmd = block.Get<const Anope::string>("command");
if (cmd != "nickserv/set/misc" && cmd != "nickserv/saset/misc")
continue;
- Anope::string cname = block->Get<const Anope::string>("name");
- Anope::string desc = block->Get<const Anope::string>("misc_description");
+ Anope::string cname = block.Get<const Anope::string>("name");
+ Anope::string desc = block.Get<const Anope::string>("misc_description");
if (cname.empty() || desc.empty())
continue;
diff --git a/modules/nickserv/ns_suspend.cpp b/modules/nickserv/ns_suspend.cpp
index 6cdce688a..950528e50 100644
--- a/modules/nickserv/ns_suspend.cpp
+++ b/modules/nickserv/ns_suspend.cpp
@@ -70,7 +70,7 @@ public:
const Anope::string &nick = params[0];
Anope::string expiry = params[1];
Anope::string reason = params.size() > 2 ? params[2] : "";
- time_t expiry_secs = Config->GetModule(this->owner)->Get<time_t>("suspendexpire");
+ time_t expiry_secs = Config->GetModule(this->owner).Get<time_t>("suspendexpire");
if (Anope::ReadOnly)
source.Reply(READ_ONLY_MODE);
@@ -98,7 +98,7 @@ public:
return;
}
- if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && na->nc->IsServicesOper())
+ if (Config->GetModule("nickserv").Get<bool>("secureadmins", "yes") && na->nc->IsServicesOper())
{
source.Reply(_("You may not suspend other Services Operators' nicknames."));
return;
@@ -240,9 +240,9 @@ public:
{
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Anope::string s = conf->GetModule(this)->Get<Anope::string>("show");
+ Anope::string s = conf.GetModule(this).Get<Anope::string>("show");
commasepstream(s).GetTokens(show);
std::transform(show.begin(), show.end(), show.begin(), trim());
}
diff --git a/modules/operserv/operserv.cpp b/modules/operserv/operserv.cpp
index a05159179..836ee77c3 100644
--- a/modules/operserv/operserv.cpp
+++ b/modules/operserv/operserv.cpp
@@ -216,9 +216,9 @@ public:
XLineManager::UnregisterXLineManager(&snlines);
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- const Anope::string &osnick = conf->GetModule(this)->Get<const Anope::string>("client");
+ const Anope::string &osnick = conf.GetModule(this).Get<const Anope::string>("client");
if (osnick.empty())
throw ConfigException(this->name + ": <client> must be defined");
@@ -232,7 +232,7 @@ public:
EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) override
{
- if (bi == OperServ && !u->HasMode("OPER") && Config->GetModule(this)->Get<bool>("opersonly"))
+ if (bi == OperServ && !u->HasMode("OPER") && Config->GetModule(this).Get<bool>("opersonly"))
{
u->SendMessage(bi, ACCESS_DENIED);
Log(bi, "bados") << "Denied access to " << bi->nick << " from " << u->GetMask() << " (non-oper)";
diff --git a/modules/operserv/os_akill.cpp b/modules/operserv/os_akill.cpp
index e904713cf..e24b7fca6 100644
--- a/modules/operserv/os_akill.cpp
+++ b/modules/operserv/os_akill.cpp
@@ -79,7 +79,7 @@ private:
sep.GetToken(mask);
}
- time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv")->Get<time_t>("autokillexpiry", "30d");
+ time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get<time_t>("autokillexpiry", "30d");
/* If the expiry given does not contain a final letter, it's in days,
* said the doc. Ah well.
*/
@@ -124,7 +124,7 @@ private:
if (mask[0] == '/' && mask[mask.length() - 1] == '/')
{
- const Anope::string &regexengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
+ const Anope::string &regexengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
if (regexengine.empty())
{
@@ -155,7 +155,7 @@ private:
if (targ)
mask = "*@" + targ->host;
- if (Config->GetModule("operserv")->Get<bool>("addakiller", "yes") && !source.GetNick().empty())
+ if (Config->GetModule("operserv").Get<bool>("addakiller", "yes") && !source.GetNick().empty())
reason = "[" + source.GetNick() + "] " + reason;
if (mask.find_first_not_of("/~@.*?") == Anope::string::npos)
@@ -170,7 +170,7 @@ private:
}
auto *x = new XLine(mask, source.GetNick(), expires, reason);
- if (Config->GetModule("operserv")->Get<bool>("akillids"))
+ if (Config->GetModule("operserv").Get<bool>("akillids"))
x->id = XLineManager::GenerateUID();
unsigned int affected = 0;
@@ -202,7 +202,7 @@ private:
}
akills->AddXLine(x);
- if (Config->GetModule("operserv")->Get<bool>("akillonadd"))
+ if (Config->GetModule("operserv").Get<bool>("akillonadd"))
akills->Send(NULL, x);
source.Reply(_("\002%s\002 added to the AKILL list."), mask.c_str());
@@ -362,7 +362,7 @@ private:
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Mask")).AddColumn(_("Creator")).AddColumn(_("Created")).AddColumn(_("Expires"));
- if (Config->GetModule("operserv")->Get<bool>("akillids"))
+ if (Config->GetModule("operserv").Get<bool>("akillids"))
list.AddColumn(_("ID"));
list.AddColumn(_("Reason"));
@@ -443,7 +443,7 @@ public:
"be given, even if it is the same as the default. The\n"
"current AKILL default expiry time can be found with the\n"
"\002STATS AKILL\002 command."));
- const Anope::string &regexengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
+ const Anope::string &regexengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
if (!regexengine.empty())
{
source.Reply(" ");
diff --git a/modules/operserv/os_chankill.cpp b/modules/operserv/os_chankill.cpp
index 3ac583cb7..e66123a62 100644
--- a/modules/operserv/os_chankill.cpp
+++ b/modules/operserv/os_chankill.cpp
@@ -40,7 +40,7 @@ public:
last_param = 2;
}
- time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv")->Get<time_t>("autokillexpiry", "30d");
+ time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get<time_t>("autokillexpiry", "30d");
if (!expiry.empty() && isdigit(expiry[expiry.length() - 1]))
expires *= 86400;
if (expires && expires < 60)
@@ -63,7 +63,7 @@ public:
if (!reason.empty())
{
Anope::string realreason;
- if (Config->GetModule("operserv")->Get<bool>("addakiller") && !source.GetNick().empty())
+ if (Config->GetModule("operserv").Get<bool>("addakiller") && !source.GetNick().empty())
realreason = "[" + source.GetNick() + "] " + reason;
else
realreason = reason;
diff --git a/modules/operserv/os_config.cpp b/modules/operserv/os_config.cpp
index 22a46efa7..b10c59e4d 100644
--- a/modules/operserv/os_config.cpp
+++ b/modules/operserv/os_config.cpp
@@ -35,7 +35,7 @@ public:
Configuration::MutableBlock *block = Config->GetMutableBlock(params[1]);
if (!block)
- block = Config->GetModule(params[1]);
+ block = &Config->GetModule(params[1]);
if (!block)
{
@@ -57,8 +57,8 @@ public:
for (unsigned i = 0; !show_blocks[i].empty(); ++i)
{
- Configuration::Block *block = Config->GetBlock(show_blocks[i]);
- const Configuration::Block::item_map &items = block->GetItems();
+ Configuration::Block &block = Config->GetBlock(show_blocks[i]);
+ const Configuration::Block::item_map &items = block.GetItems();
ListFormatter lflist(source.GetAccount());
lflist.AddColumn(_("Name")).AddColumn(_("Value"));
@@ -74,7 +74,7 @@ public:
std::vector<Anope::string> replies;
lflist.Process(replies);
- source.Reply(_("%s settings:"), block->GetName().c_str());
+ source.Reply(_("%s settings:"), block.GetName().c_str());
for (const auto &reply : replies)
source.Reply(reply);
@@ -87,14 +87,14 @@ public:
for (int i = 0; i < Config->CountBlock("module"); ++i)
{
- Configuration::Block *block = Config->GetBlock("module", i);
- const Configuration::Block::item_map &items = block->GetItems();
+ Configuration::Block &block = Config->GetBlock("module", i);
+ const Configuration::Block::item_map &items = block.GetItems();
if (items.size() <= 1)
continue;
ListFormatter::ListEntry entry;
- entry["Module Name"] = block->Get<Anope::string>("name");
+ entry["Module Name"] = block.Get<Anope::string>("name");
for (const auto &[name, value] : items)
{
diff --git a/modules/operserv/os_defcon.cpp b/modules/operserv/os_defcon.cpp
index 65a6555a6..5fd2d59bb 100644
--- a/modules/operserv/os_defcon.cpp
+++ b/modules/operserv/os_defcon.cpp
@@ -331,31 +331,34 @@ public:
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *block = conf->GetModule(this);
DefconConfig dconfig;
- dconfig.defaultlevel = block->Get<int>("defaultlevel");
- dconfig.defcons[4] = block->Get<const Anope::string>("level4");
- dconfig.defcons[3] = block->Get<const Anope::string>("level3");
- dconfig.defcons[2] = block->Get<const Anope::string>("level2");
- dconfig.defcons[1] = block->Get<const Anope::string>("level1");
- dconfig.sessionlimit = block->Get<int>("sessionlimit");
- dconfig.akillreason = block->Get<const Anope::string>("akillreason");
- dconfig.akillexpire = block->Get<time_t>("akillexpire");
- dconfig.chanmodes = block->Get<const Anope::string>("chanmodes");
- dconfig.timeout = block->Get<time_t>("timeout");
- dconfig.globalondefcon = block->Get<bool>("globalondefcon");
- dconfig.message = block->Get<const Anope::string>("message");
- dconfig.offmessage = block->Get<const Anope::string>("offmessage");
-
- block = conf->GetModule("os_session");
-
- dconfig.max_session_kill = block->Get<int>("maxsessionkill");
- dconfig.session_autokill_expiry = block->Get<time_t>("sessionautokillexpiry");
- dconfig.sle_reason = block->Get<const Anope::string>("sessionlimitexceeded");
- dconfig.sle_detailsloc = block->Get<const Anope::string>("sessionlimitdetailsloc");
+ {
+ Configuration::Block &block = conf.GetModule(this);
+ dconfig.defaultlevel = block.Get<int>("defaultlevel");
+ dconfig.defcons[4] = block.Get<const Anope::string>("level4");
+ dconfig.defcons[3] = block.Get<const Anope::string>("level3");
+ dconfig.defcons[2] = block.Get<const Anope::string>("level2");
+ dconfig.defcons[1] = block.Get<const Anope::string>("level1");
+ dconfig.sessionlimit = block.Get<int>("sessionlimit");
+ dconfig.akillreason = block.Get<const Anope::string>("akillreason");
+ dconfig.akillexpire = block.Get<time_t>("akillexpire");
+ dconfig.chanmodes = block.Get<const Anope::string>("chanmodes");
+ dconfig.timeout = block.Get<time_t>("timeout");
+ dconfig.globalondefcon = block.Get<bool>("globalondefcon");
+ dconfig.message = block.Get<const Anope::string>("message");
+ dconfig.offmessage = block.Get<const Anope::string>("offmessage");
+ }
+
+ {
+ Configuration::Block &block = conf.GetModule("os_session");
+ dconfig.max_session_kill = block.Get<int>("maxsessionkill");
+ dconfig.session_autokill_expiry = block.Get<time_t>("sessionautokillexpiry");
+ dconfig.sle_reason = block.Get<const Anope::string>("sessionlimitexceeded");
+ dconfig.sle_detailsloc = block.Get<const Anope::string>("sessionlimitdetailsloc");
+ }
if (dconfig.defaultlevel < 1 || dconfig.defaultlevel > 5)
throw ConfigException("The value for <defcon:defaultlevel> must be between 1 and 5");
diff --git a/modules/operserv/os_dns.cpp b/modules/operserv/os_dns.cpp
index 195cd0f25..147e29eaa 100644
--- a/modules/operserv/os_dns.cpp
+++ b/modules/operserv/os_dns.cpp
@@ -752,15 +752,15 @@ public:
delete dns_servers->at(i - 1);
}
- void OnReload(Configuration::Conf *conf) override
- {
- Configuration::Block *block = conf->GetModule(this);
- this->ttl = block->Get<time_t>("ttl");
- this->user_drop_mark = block->Get<int>("user_drop_mark");
- this->user_drop_time = block->Get<time_t>("user_drop_time");
- this->user_drop_readd_time = block->Get<time_t>("user_drop_readd_time");
- this->remove_split_servers = block->Get<bool>("remove_split_servers");
- this->readd_connected_servers = block->Get<bool>("readd_connected_servers");
+ void OnReload(Configuration::Conf &conf) override
+ {
+ Configuration::Block &block = conf.GetModule(this);
+ this->ttl = block.Get<time_t>("ttl");
+ this->user_drop_mark = block.Get<int>("user_drop_mark");
+ this->user_drop_time = block.Get<time_t>("user_drop_time");
+ this->user_drop_readd_time = block.Get<time_t>("user_drop_readd_time");
+ this->remove_split_servers = block.Get<bool>("remove_split_servers");
+ this->readd_connected_servers = block.Get<bool>("readd_connected_servers");
}
void OnNewServer(Server *s) override
diff --git a/modules/operserv/os_forbid.cpp b/modules/operserv/os_forbid.cpp
index 733c433cc..892d58d0c 100644
--- a/modules/operserv/os_forbid.cpp
+++ b/modules/operserv/os_forbid.cpp
@@ -239,7 +239,7 @@ public:
}
NickAlias *target = NickAlias::Find(entry);
- if (target != NULL && Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && target->nc->IsServicesOper())
+ if (target != NULL && Config->GetModule("nickserv").Get<bool>("secureadmins", "yes") && target->nc->IsServicesOper())
{
source.Reply(ACCESS_DENIED);
return;
@@ -312,7 +312,7 @@ public:
BotInfo *OperServ = Config->GetClient("OperServ");
if (IRCD->CanSQLineChannel && OperServ)
{
- time_t inhabit = Config->GetModule("chanserv")->Get<time_t>("inhabit", "1m");
+ time_t inhabit = Config->GetModule("chanserv").Get<time_t>("inhabit", "1m");
XLine x(c->name, OperServ->nick, Anope::CurTime + inhabit, d->reason);
IRCD->SendSQLine(NULL, &x);
}
@@ -449,7 +449,7 @@ public:
source.Reply(_("Forbid allows you to forbid usage of certain nicknames, channels,\n"
"and email addresses. Wildcards are accepted for all entries."));
- const Anope::string &regexengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
+ const Anope::string &regexengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
if (!regexengine.empty())
{
source.Reply(" ");
@@ -513,7 +513,7 @@ public:
ServiceReference<ChanServService> chanserv("ChanServService", "ChanServ");
if (IRCD->CanSQLineChannel)
{
- time_t inhabit = Config->GetModule("chanserv")->Get<time_t>("inhabit", "1m");
+ time_t inhabit = Config->GetModule("chanserv").Get<time_t>("inhabit", "1m");
XLine x(c->name, OperServ->nick, Anope::CurTime + inhabit, d->reason);
IRCD->SendSQLine(NULL, &x);
}
diff --git a/modules/operserv/os_ignore.cpp b/modules/operserv/os_ignore.cpp
index ecc1ad3b5..ec1dda883 100644
--- a/modules/operserv/os_ignore.cpp
+++ b/modules/operserv/os_ignore.cpp
@@ -383,7 +383,7 @@ public:
" \n"
"Ignores will not be enforced on IRC Operators."));
- const Anope::string &regexengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
+ const Anope::string &regexengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
if (!regexengine.empty())
{
source.Reply(" ");
diff --git a/modules/operserv/os_info.cpp b/modules/operserv/os_info.cpp
index 3becec624..ed111a3cd 100644
--- a/modules/operserv/os_info.cpp
+++ b/modules/operserv/os_info.cpp
@@ -148,7 +148,7 @@ public:
OperInfos *oi = e->Require<OperInfos>("operinfo");
- if ((*oi)->size() >= Config->GetModule(this->module)->Get<unsigned>("max", "10"))
+ if ((*oi)->size() >= Config->GetModule(this->module).Get<unsigned>("max", "10"))
{
source.Reply(_("The oper info list for \002%s\002 is full."), target.c_str());
return;
diff --git a/modules/operserv/os_kill.cpp b/modules/operserv/os_kill.cpp
index e03a022c3..7ad58d062 100644
--- a/modules/operserv/os_kill.cpp
+++ b/modules/operserv/os_kill.cpp
@@ -35,7 +35,7 @@ public:
{
if (reason.empty())
reason = "No reason specified";
- if (Config->GetModule("operserv")->Get<bool>("addakiller"))
+ if (Config->GetModule("operserv").Get<bool>("addakiller"))
reason = "(" + source.GetNick() + ") " + reason;
Log(LOG_ADMIN, source, this) << "on " << u2->nick << " for " << reason;
u2->Kill(*source.service, reason);
diff --git a/modules/operserv/os_list.cpp b/modules/operserv/os_list.cpp
index a80683054..46c4c89bb 100644
--- a/modules/operserv/os_list.cpp
+++ b/modules/operserv/os_list.cpp
@@ -117,7 +117,7 @@ public:
"specified, lists only channels matching \002pattern\002 that have the +s or\n"
"+p mode."));
- const Anope::string &regexengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
+ const Anope::string &regexengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
if (!regexengine.empty())
{
source.Reply(" ");
@@ -260,7 +260,7 @@ public:
"only users that are on the given channel. If INVISIBLE is specified, only users\n"
"with the +i flag will be listed."));
- const Anope::string &regexengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
+ const Anope::string &regexengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
if (!regexengine.empty())
{
source.Reply(" ");
diff --git a/modules/operserv/os_logsearch.cpp b/modules/operserv/os_logsearch.cpp
index f4f6b9210..cd3781ae1 100644
--- a/modules/operserv/os_logsearch.cpp
+++ b/modules/operserv/os_logsearch.cpp
@@ -85,7 +85,7 @@ public:
bool wildcard = search_string.find_first_of("?*") != Anope::string::npos;
bool regex = !search_string.empty() && search_string[0] == '/' && search_string[search_string.length() - 1] == '/';
- const Anope::string &logfile_name = Config->GetModule(this->owner)->Get<const Anope::string>("logname");
+ const Anope::string &logfile_name = Config->GetModule(this->owner).Get<const Anope::string>("logname");
std::vector<Anope::string> matches;
for (int d = days - 1; d >= 0; --d)
{
diff --git a/modules/operserv/os_news.cpp b/modules/operserv/os_news.cpp
index ba6fe37bf..33fa657ef 100644
--- a/modules/operserv/os_news.cpp
+++ b/modules/operserv/os_news.cpp
@@ -318,7 +318,7 @@ public:
"to them. However, no more than \002%d\002 messages will be\n"
"sent in order to avoid flooding the user. If there are\n"
"more news messages, only the most recent will be sent."),
- Config->GetModule(this->owner)->Get<unsigned>("newscount", "3"));
+ Config->GetModule(this->owner).Get<unsigned>("newscount", "3"));
return true;
}
};
@@ -346,7 +346,7 @@ public:
"be sent to them. However, no more than \002%d\002 messages will\n"
"be sent in order to avoid flooding the user. If there are\n"
"more news messages, only the most recent will be sent."),
- Config->GetModule(this->owner)->Get<unsigned>("newscount", "3"));
+ Config->GetModule(this->owner).Get<unsigned>("newscount", "3"));
return true;
}
};
@@ -399,9 +399,9 @@ class OSNews final
BotInfo *bi = NULL;
if (Type == NEWS_OPER)
- bi = BotInfo::Find(Config->GetModule(this)->Get<const Anope::string>("oper_announcer", "OperServ"), true);
+ bi = BotInfo::Find(Config->GetModule(this).Get<const Anope::string>("oper_announcer", "OperServ"), true);
else
- bi = BotInfo::Find(Config->GetModule(this)->Get<const Anope::string>("announcer", "Global"), true);
+ bi = BotInfo::Find(Config->GetModule(this).Get<const Anope::string>("announcer", "Global"), true);
if (bi == NULL)
return;
@@ -448,11 +448,11 @@ public:
{
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- oper_announcer = conf->GetModule(this)->Get<const Anope::string>("oper_announcer", "OperServ");
- announcer = conf->GetModule(this)->Get<const Anope::string>("announcer", "Global");
- news_count = conf->GetModule(this)->Get<unsigned>("newscount", "3");
+ oper_announcer = conf.GetModule(this).Get<const Anope::string>("oper_announcer", "OperServ");
+ announcer = conf.GetModule(this).Get<const Anope::string>("announcer", "Global");
+ news_count = conf.GetModule(this).Get<unsigned>("newscount", "3");
}
void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) override
diff --git a/modules/operserv/os_session.cpp b/modules/operserv/os_session.cpp
index 5e2399d53..93ba17473 100644
--- a/modules/operserv/os_session.cpp
+++ b/modules/operserv/os_session.cpp
@@ -591,21 +591,21 @@ public:
ModuleManager::SetPriority(this, PRIORITY_FIRST);
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *block = Config->GetModule(this);
+ Configuration::Block &block = Config->GetModule(this);
- session_limit = block->Get<int>("defaultsessionlimit");
- max_session_kill = block->Get<int>("maxsessionkill");
- session_autokill_expiry = block->Get<time_t>("sessionautokillexpiry");
- sle_reason = block->Get<const Anope::string>("sessionlimitexceeded");
- sle_detailsloc = block->Get<const Anope::string>("sessionlimitdetailsloc");
+ session_limit = block.Get<int>("defaultsessionlimit");
+ max_session_kill = block.Get<int>("maxsessionkill");
+ session_autokill_expiry = block.Get<time_t>("sessionautokillexpiry");
+ sle_reason = block.Get<const Anope::string>("sessionlimitexceeded");
+ sle_detailsloc = block.Get<const Anope::string>("sessionlimitdetailsloc");
- max_exception_limit = block->Get<int>("maxsessionlimit");
- exception_expiry = block->Get<time_t>("exceptionexpiry");
+ max_exception_limit = block.Get<int>("maxsessionlimit");
+ exception_expiry = block.Get<time_t>("exceptionexpiry");
- ipv4_cidr = block->Get<unsigned>("session_ipv4_cidr", "32");
- ipv6_cidr = block->Get<unsigned>("session_ipv6_cidr", "128");
+ ipv4_cidr = block.Get<unsigned>("session_ipv4_cidr", "32");
+ ipv6_cidr = block.Get<unsigned>("session_ipv6_cidr", "128");
if (ipv4_cidr > 32 || ipv6_cidr > 128)
throw ConfigException(this->name + ": session CIDR value out of range");
diff --git a/modules/operserv/os_set.cpp b/modules/operserv/os_set.cpp
index d7f3fc711..50451d53a 100644
--- a/modules/operserv/os_set.cpp
+++ b/modules/operserv/os_set.cpp
@@ -77,7 +77,7 @@ private:
*
* Rob
**/
- bool super_admin = Config->GetModule(this->owner)->Get<bool>("superadmin");
+ bool super_admin = Config->GetModule(this->owner).Get<bool>("superadmin");
if (!super_admin)
source.Reply(_("Super admin can not be set because it is not enabled in the configuration."));
else if (setting.equals_ci("ON"))
diff --git a/modules/operserv/os_shutdown.cpp b/modules/operserv/os_shutdown.cpp
index 5ebdb2200..37dc15747 100644
--- a/modules/operserv/os_shutdown.cpp
+++ b/modules/operserv/os_shutdown.cpp
@@ -18,14 +18,14 @@ public:
CommandOSQuit(Module *creator) : Command(creator, "operserv/quit", 0, 1)
{
this->SetDesc(_("Terminate services WITHOUT saving"));
- if (Config->GetModule(this->owner)->Get<bool>("requirename"))
+ if (Config->GetModule(this->owner).Get<bool>("requirename"))
this->SetSyntax(_("\037network-name\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- const auto requirename = Config->GetModule(this->owner)->Get<bool>("requirename");
- const auto networkname = Config->GetBlock("networkinfo")->Get<Anope::string>("networkname");
+ const auto requirename = Config->GetModule(this->owner).Get<bool>("requirename");
+ const auto networkname = Config->GetBlock("networkinfo").Get<Anope::string>("networkname");
if (requirename && (params.empty() || !params[0].equals_cs(networkname)))
{
OnSyntaxError(source, source.command);
@@ -57,14 +57,14 @@ public:
CommandOSRestart(Module *creator) : Command(creator, "operserv/restart", 0, 1)
{
this->SetDesc(_("Save databases and restart services"));
- if (Config->GetModule(this->owner)->Get<bool>("requirename"))
+ if (Config->GetModule(this->owner).Get<bool>("requirename"))
this->SetSyntax(_("\037network-name\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- const auto requirename = Config->GetModule(this->owner)->Get<bool>("requirename");
- const auto networkname = Config->GetBlock("networkinfo")->Get<Anope::string>("networkname");
+ const auto requirename = Config->GetModule(this->owner).Get<bool>("requirename");
+ const auto networkname = Config->GetBlock("networkinfo").Get<Anope::string>("networkname");
if (requirename && (params.empty() || !params[0].equals_cs(networkname)))
{
OnSyntaxError(source, source.command);
@@ -94,14 +94,14 @@ public:
CommandOSShutdown(Module *creator) : Command(creator, "operserv/shutdown", 0, 1)
{
this->SetDesc(_("Terminate services with save"));
- if (Config->GetModule(this->owner)->Get<bool>("requirename"))
+ if (Config->GetModule(this->owner).Get<bool>("requirename"))
this->SetSyntax(_("\037network-name\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- const auto requirename = Config->GetModule(this->owner)->Get<bool>("requirename");
- const auto networkname = Config->GetBlock("networkinfo")->Get<Anope::string>("networkname");
+ const auto requirename = Config->GetModule(this->owner).Get<bool>("requirename");
+ const auto networkname = Config->GetBlock("networkinfo").Get<Anope::string>("networkname");
if (requirename && (params.empty() || !params[0].equals_cs(networkname)))
{
OnSyntaxError(source, source.command);
diff --git a/modules/operserv/os_stats.cpp b/modules/operserv/os_stats.cpp
index 1190ac1fc..4b9b2f875 100644
--- a/modules/operserv/os_stats.cpp
+++ b/modules/operserv/os_stats.cpp
@@ -71,7 +71,7 @@ private:
{
/* AKILLs */
source.Reply(_("Current number of AKILLs: \002%zu\002"), akills->GetCount());
- timeout = Config->GetModule("operserv")->Get<time_t>("autokillexpiry", "30d") + 59;
+ timeout = Config->GetModule("operserv").Get<time_t>("autokillexpiry", "30d") + 59;
if (timeout >= 172800)
source.Reply(_("Default AKILL expiry time: \002%d days\002"), timeout / 86400);
else if (timeout >= 86400)
@@ -91,7 +91,7 @@ private:
{
/* SNLINEs */
source.Reply(_("Current number of SNLINEs: \002%zu\002"), snlines->GetCount());
- timeout = Config->GetModule("operserv")->Get<time_t>("snlineexpiry", "30d") + 59;
+ timeout = Config->GetModule("operserv").Get<time_t>("snlineexpiry", "30d") + 59;
if (timeout >= 172800)
source.Reply(_("Default SNLINE expiry time: \002%d days\002"), timeout / 86400);
else if (timeout >= 86400)
@@ -111,7 +111,7 @@ private:
{
/* SQLINEs */
source.Reply(_("Current number of SQLINEs: \002%zu\002"), sqlines->GetCount());
- timeout = Config->GetModule("operserv")->Get<time_t>("sglineexpiry", "30d") + 59;
+ timeout = Config->GetModule("operserv").Get<time_t>("sglineexpiry", "30d") + 59;
if (timeout >= 172800)
source.Reply(_("Default SQLINE expiry time: \002%d days\002"), timeout / 86400);
else if (timeout >= 86400)
diff --git a/modules/operserv/os_sxline.cpp b/modules/operserv/os_sxline.cpp
index 270ece378..18ae3c0c0 100644
--- a/modules/operserv/os_sxline.cpp
+++ b/modules/operserv/os_sxline.cpp
@@ -202,7 +202,7 @@ private:
{
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Mask")).AddColumn(_("By")).AddColumn(_("Created")).AddColumn(_("Expires"));
- if (Config->GetModule("operserv")->Get<bool>("akillids"))
+ if (Config->GetModule("operserv").Get<bool>("akillids"))
list.AddColumn(_("ID"));
list.AddColumn(_("Reason"));
@@ -283,7 +283,7 @@ class CommandOSSNLine final
last_param = 3;
}
- time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv")->Get<time_t>("snlineexpiry", "30d");
+ time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get<time_t>("snlineexpiry", "30d");
/* If the expiry given does not contain a final letter, it's in days,
* said the doc. Ah well.
*/
@@ -327,7 +327,7 @@ class CommandOSSNLine final
if (mask[0] == '/' && mask[mask.length() - 1] == '/')
{
- const Anope::string &regexengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
+ const Anope::string &regexengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
if (regexengine.empty())
{
@@ -361,7 +361,7 @@ class CommandOSSNLine final
if (mask[masklen - 1] == ' ')
mask.erase(masklen - 1);
- if (Config->GetModule("operserv")->Get<bool>("addakiller", "yes") && !source.GetNick().empty())
+ if (Config->GetModule("operserv").Get<bool>("addakiller", "yes") && !source.GetNick().empty())
reason = "[" + source.GetNick() + "] " + reason;
if (mask.find_first_not_of("/.*?") == Anope::string::npos)
@@ -371,7 +371,7 @@ class CommandOSSNLine final
}
auto *x = new XLine(mask, source.GetNick(), expires, reason);
- if (Config->GetModule("operserv")->Get<bool>("akillids"))
+ if (Config->GetModule("operserv").Get<bool>("akillids"))
x->id = XLineManager::GenerateUID();
unsigned int affected = 0;
@@ -404,7 +404,7 @@ class CommandOSSNLine final
this->xlm()->AddXLine(x);
- if (Config->GetModule("operserv")->Get<bool>("killonsnline", "yes"))
+ if (Config->GetModule("operserv").Get<bool>("killonsnline", "yes"))
{
Anope::string rreason = "G-Lined: " + reason;
@@ -457,7 +457,7 @@ public:
" \n"
"\002Note\002: because the realname mask may contain spaces, the\n"
"separator between it and the reason is a colon."));
- const Anope::string &regexengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
+ const Anope::string &regexengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
if (!regexengine.empty())
{
source.Reply(" ");
@@ -511,7 +511,7 @@ class CommandOSSQLine final
last_param = 3;
}
- time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv")->Get<time_t>("sqlineexpiry", "30d");
+ time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get<time_t>("sqlineexpiry", "30d");
/* If the expiry given does not contain a final letter, it's in days,
* said the doc. Ah well.
*/
@@ -544,7 +544,7 @@ class CommandOSSQLine final
if (mask[0] == '/' && mask[mask.length() - 1] == '/')
{
- const Anope::string &regexengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
+ const Anope::string &regexengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
if (regexengine.empty())
{
@@ -571,7 +571,7 @@ class CommandOSSQLine final
}
}
- if (Config->GetModule("operserv")->Get<bool>("addakiller", "yes") && !source.GetNick().empty())
+ if (Config->GetModule("operserv").Get<bool>("addakiller", "yes") && !source.GetNick().empty())
reason = "[" + source.GetNick() + "] " + reason;
if (mask.find_first_not_of("./?*") == Anope::string::npos)
@@ -581,7 +581,7 @@ class CommandOSSQLine final
}
auto *x = new XLine(mask, source.GetNick(), expires, reason);
- if (Config->GetModule("operserv")->Get<bool>("akillids"))
+ if (Config->GetModule("operserv").Get<bool>("akillids"))
x->id = XLineManager::GenerateUID();
unsigned int affected = 0;
@@ -611,7 +611,7 @@ class CommandOSSQLine final
this->xlm()->AddXLine(x);
- if (Config->GetModule("operserv")->Get<bool>("killonsqline", "yes"))
+ if (Config->GetModule("operserv").Get<bool>("killonsqline", "yes"))
{
Anope::string rreason = "Q-Lined: " + reason;
@@ -688,7 +688,7 @@ public:
"must be given, even if it is the same as the default. The\n"
"current SQLINE default expiry time can be found with the\n"
"\002STATS AKILL\002 command."));
- const Anope::string &regexengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
+ const Anope::string &regexengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
if (!regexengine.empty())
{
source.Reply(" ");
diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp
index 59f535e8a..30ae296ff 100644
--- a/modules/protocol/hybrid.cpp
+++ b/modules/protocol/hybrid.cpp
@@ -796,7 +796,7 @@ public:
message_tmode(this),
message_uid(this)
{
- if (Config->GetModule(this))
+ if (IRCD == &ircd_proto)
this->AddModes();
}
diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp
index b0e059d73..538a27a37 100644
--- a/modules/protocol/inspircd.cpp
+++ b/modules/protocol/inspircd.cpp
@@ -105,7 +105,7 @@ class InspIRCdProto final
private:
static Anope::string GetAccountNicks(NickAlias* na)
{
- if (!na || Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
+ if (!na || Config->GetModule("nickserv").Get<bool>("nonicknameownership"))
return {};
Anope::string nicks;
@@ -188,7 +188,7 @@ public:
void SendConnect() override
{
Uplink::Send("CAPAB", "START", 1206);
- Uplink::Send("CAPAB", "CAPABILITIES", "CASEMAPPING=" + Config->GetBlock("options")->Get<const Anope::string>("casemap", "ascii") + (sha256 ? " CHALLENGE=*" : ""));
+ Uplink::Send("CAPAB", "CAPABILITIES", "CASEMAPPING=" + Config->GetBlock("options").Get<const Anope::string>("casemap", "ascii") + (sha256 ? " CHALLENGE=*" : ""));
Uplink::Send("CAPAB", "END");
}
@@ -1553,7 +1553,7 @@ struct IRCDMessageCapab final
IRCD->CanTagMessage = true;
}
- const auto &anoperegex = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
+ const auto &anoperegex = Config->GetBlock("options").Get<const Anope::string>("regexengine");
if (!anoperegex.empty() && !inspircdregex.empty() && anoperegex != inspircdregex)
Log() << "Warning: InspIRCd is using regex engine " << inspircdregex << ", but we have " << anoperegex << ". This may cause inconsistencies.";
}
diff --git a/modules/proxyscan.cpp b/modules/proxyscan.cpp
index 846095abc..53b94e696 100644
--- a/modules/proxyscan.cpp
+++ b/modules/proxyscan.cpp
@@ -260,23 +260,23 @@ public:
delete this->listener;
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *config = Config->GetModule(this);
+ Configuration::Block &config = Config->GetModule(this);
- Anope::string s_target_ip = config->Get<const Anope::string>("target_ip");
+ Anope::string s_target_ip = config.Get<const Anope::string>("target_ip");
if (s_target_ip.empty())
throw ConfigException(this->name + " target_ip may not be empty");
- int s_target_port = config->Get<int>("target_port", "-1");
+ int s_target_port = config.Get<int>("target_port", "-1");
if (s_target_port <= 0)
throw ConfigException(this->name + " target_port may not be empty and must be a positive number");
- Anope::string s_listen_ip = config->Get<const Anope::string>("listen_ip");
+ Anope::string s_listen_ip = config.Get<const Anope::string>("listen_ip");
if (s_listen_ip.empty())
throw ConfigException(this->name + " listen_ip may not be empty");
- int s_listen_port = config->Get<int>("listen_port", "-1");
+ int s_listen_port = config.Get<int>("listen_port", "-1");
if (s_listen_port <= 0)
throw ConfigException(this->name + " listen_port may not be empty and must be a positive number");
@@ -284,12 +284,12 @@ public:
target_port = s_target_port;
this->listen_ip = s_listen_ip;
this->listen_port = s_listen_port;
- this->con_notice = config->Get<const Anope::string>("connect_notice");
- this->con_source = config->Get<const Anope::string>("connect_source");
- add_to_akill = config->Get<bool>("add_to_akill", "true");
- this->connectionTimeout.SetSecs(config->Get<time_t>("timeout", "5s"));
+ this->con_notice = config.Get<const Anope::string>("connect_notice");
+ this->con_source = config.Get<const Anope::string>("connect_source");
+ add_to_akill = config.Get<bool>("add_to_akill", "true");
+ this->connectionTimeout.SetSecs(config.Get<time_t>("timeout", "5s"));
- ProxyCheckString = Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname") + " proxy check";
+ ProxyCheckString = Config->GetBlock("networkinfo").Get<const Anope::string>("networkname") + " proxy check";
delete this->listener;
this->listener = NULL;
try
@@ -302,13 +302,13 @@ public:
}
this->proxyscans.clear();
- for (int i = 0; i < config->CountBlock("proxyscan"); ++i)
+ for (int i = 0; i < Config->CountBlock("proxyscan"); ++i)
{
- Configuration::Block *block = config->GetBlock("proxyscan", i);
+ Configuration::Block &block = config.GetBlock("proxyscan", i);
ProxyCheck p;
Anope::string token;
- commasepstream sep(block->Get<const Anope::string>("type"));
+ commasepstream sep(block.Get<const Anope::string>("type"));
while (sep.GetToken(token))
{
if (!token.equals_ci("HTTP") && !token.equals_ci("SOCKS5"))
@@ -318,7 +318,7 @@ public:
if (p.types.empty())
continue;
- commasepstream sep2(block->Get<const Anope::string>("port"));
+ commasepstream sep2(block.Get<const Anope::string>("port"));
while (sep2.GetToken(token))
{
if (auto port = Anope::TryConvert<unsigned short>(token))
@@ -327,8 +327,8 @@ public:
if (p.ports.empty())
continue;
- p.duration = block->Get<time_t>("time", "4h");
- p.reason = block->Get<const Anope::string>("reason");
+ p.duration = block.Get<time_t>("time", "4h");
+ p.reason = block.Get<const Anope::string>("reason");
if (p.reason.empty())
continue;
diff --git a/modules/redis.cpp b/modules/redis.cpp
index 25ecf0678..f50b4c67f 100644
--- a/modules/redis.cpp
+++ b/modules/redis.cpp
@@ -535,19 +535,19 @@ public:
}
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *block = conf->GetModule(this);
+ Configuration::Block &block = conf.GetModule(this);
std::vector<Anope::string> new_services;
- for (int i = 0; i < block->CountBlock("redis"); ++i)
+ for (int i = 0; i < block.CountBlock("redis"); ++i)
{
- Configuration::Block *redis = block->GetBlock("redis", i);
+ Configuration::Block &redis = block.GetBlock("redis", i);
- const Anope::string &n = redis->Get<const Anope::string>("name"),
- &ip = redis->Get<const Anope::string>("ip");
- int port = redis->Get<int>("port");
- unsigned db = redis->Get<unsigned>("db");
+ const Anope::string &n = redis.Get<const Anope::string>("name"),
+ &ip = redis.Get<const Anope::string>("ip");
+ int port = redis.Get<int>("port");
+ unsigned db = redis.Get<unsigned>("db");
delete services[n];
services[n] = new MyRedisService(this, n, ip, port, db);
diff --git a/modules/regex_stdlib.cpp b/modules/regex_stdlib.cpp
index 0e932c02a..ff524914a 100644
--- a/modules/regex_stdlib.cpp
+++ b/modules/regex_stdlib.cpp
@@ -67,11 +67,11 @@ public:
this->SetPermanent(true);
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *block = conf->GetModule(this);
+ Configuration::Block &block = conf.GetModule(this);
- const Anope::string syntax = block->Get<const Anope::string>("syntax", "ecmascript");
+ const Anope::string syntax = block.Get<const Anope::string>("syntax", "ecmascript");
if (syntax == "awk")
stdlib_regex_provider.type = std::regex::awk;
else if (syntax == "basic")
diff --git a/modules/rewrite.cpp b/modules/rewrite.cpp
index 0a9b22dcb..28007dadd 100644
--- a/modules/rewrite.cpp
+++ b/modules/rewrite.cpp
@@ -163,23 +163,23 @@ public:
{
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
Rewrite::rewrites.clear();
- for (int i = 0; i < conf->CountBlock("command"); ++i)
+ for (int i = 0; i < conf.CountBlock("command"); ++i)
{
- Configuration::Block *block = conf->GetBlock("command", i);
+ Configuration::Block &block = conf.GetBlock("command", i);
- if (!block->Get<bool>("rewrite"))
+ if (!block.Get<bool>("rewrite"))
continue;
Rewrite rw;
- rw.client = block->Get<const Anope::string>("service");
- rw.source_message = block->Get<const Anope::string>("rewrite_source");
- rw.target_message = block->Get<const Anope::string>("rewrite_target");
- rw.desc = block->Get<const Anope::string>("rewrite_description");
+ rw.client = block.Get<const Anope::string>("service");
+ rw.source_message = block.Get<const Anope::string>("rewrite_source");
+ rw.target_message = block.Get<const Anope::string>("rewrite_target");
+ rw.desc = block.Get<const Anope::string>("rewrite_description");
if (rw.client.empty() || rw.source_message.empty() || rw.target_message.empty())
continue;
diff --git a/modules/rpc/jsonrpc.cpp b/modules/rpc/jsonrpc.cpp
index 1e7315984..ad496708a 100644
--- a/modules/rpc/jsonrpc.cpp
+++ b/modules/rpc/jsonrpc.cpp
@@ -267,12 +267,12 @@ public:
httpref->UnregisterPage(&jsonrpcinterface);
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
if (httpref)
httpref->UnregisterPage(&jsonrpcinterface);
- this->httpref = ServiceReference<HTTPProvider>("HTTPProvider", conf->GetModule(this)->Get<const Anope::string>("server", "httpd/main"));
+ this->httpref = ServiceReference<HTTPProvider>("HTTPProvider", conf.GetModule(this).Get<const Anope::string>("server", "httpd/main"));
if (!httpref)
throw ConfigException("Unable to find http reference, is httpd loaded?");
diff --git a/modules/sasl.cpp b/modules/sasl.cpp
index 63b90fc8c..795a76bf3 100644
--- a/modules/sasl.cpp
+++ b/modules/sasl.cpp
@@ -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)
diff --git a/modules/sql_authentication.cpp b/modules/sql_authentication.cpp
index a7044119a..a524a43fc 100644
--- a/modules/sql_authentication.cpp
+++ b/modules/sql_authentication.cpp
@@ -90,13 +90,13 @@ public:
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *config = conf->GetModule(this);
- this->engine = config->Get<const Anope::string>("engine");
- this->query = config->Get<const Anope::string>("query");
- this->disable_reason = config->Get<const Anope::string>("disable_reason");
- this->disable_email_reason = config->Get<Anope::string>("disable_email_reason");
+ Configuration::Block &config = conf.GetModule(this);
+ this->engine = config.Get<const Anope::string>("engine");
+ this->query = config.Get<const Anope::string>("query");
+ this->disable_reason = config.Get<const Anope::string>("disable_reason");
+ this->disable_email_reason = config.Get<Anope::string>("disable_email_reason");
this->SQL = ServiceReference<SQL::Provider>("SQL::Provider", this->engine);
}
diff --git a/modules/sql_log.cpp b/modules/sql_log.cpp
index 63200c2e4..ad23dfb19 100644
--- a/modules/sql_log.cpp
+++ b/modules/sql_log.cpp
@@ -20,10 +20,10 @@ public:
{
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *config = conf->GetModule(this);
- this->table = config->Get<const Anope::string>("table", "logs");
+ Configuration::Block &config = conf.GetModule(this);
+ this->table = config.Get<const Anope::string>("table", "logs");
}
void OnLogMessage(LogInfo *li, const Log *l, const Anope::string &msg) override
diff --git a/modules/sql_oper.cpp b/modules/sql_oper.cpp
index 0cdd82436..cc4c0658d 100644
--- a/modules/sql_oper.cpp
+++ b/modules/sql_oper.cpp
@@ -150,12 +150,12 @@ public:
}
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- Configuration::Block *config = conf->GetModule(this);
+ Configuration::Block &config = conf.GetModule(this);
- this->engine = config->Get<const Anope::string>("engine");
- this->query = config->Get<const Anope::string>("query");
+ this->engine = config.Get<const Anope::string>("engine");
+ this->query = config.Get<const Anope::string>("query");
this->SQL = ServiceReference<SQL::Provider>("SQL::Provider", this->engine);
}
diff --git a/modules/webcpanel/pages/register.cpp b/modules/webcpanel/pages/register.cpp
index 6873dcc43..74ac89a2f 100644
--- a/modules/webcpanel/pages/register.cpp
+++ b/modules/webcpanel/pages/register.cpp
@@ -13,7 +13,7 @@ bool WebCPanel::Register::OnRequest(HTTPProvider *server, const Anope::string &p
replacements["TITLE"] = page_title;
- if (Config->GetModule("nickserv")->Get<bool>("forceemail", "yes"))
+ if (Config->GetModule("nickserv").Get<bool>("forceemail", "yes"))
replacements["FORCE_EMAIL"] = "yes";
TemplateFileServer page("register.html");
diff --git a/modules/webcpanel/webcpanel.cpp b/modules/webcpanel/webcpanel.cpp
index abeaa82b0..182e7077f 100644
--- a/modules/webcpanel/webcpanel.cpp
+++ b/modules/webcpanel/webcpanel.cpp
@@ -58,10 +58,10 @@ public:
me = this;
- Configuration::Block *block = Config->GetModule(this);
- provider_name = block->Get<const Anope::string>("server", "httpd/main");
- template_base = Anope::ExpandData(block->Get<const Anope::string>("template_dir", "webcpanel/templates/default"));
- page_title = block->Get<const Anope::string>("title", "Anope IRC Services");
+ Configuration::Block &block = Config->GetModule(this);
+ provider_name = block.Get<const Anope::string>("server", "httpd/main");
+ template_base = Anope::ExpandData(block.Get<const Anope::string>("template_dir", "webcpanel/templates/default"));
+ page_title = block.Get<const Anope::string>("title", "Anope IRC Services");
provider = ServiceReference<HTTPProvider>("HTTPProvider", provider_name);
if (!provider)
diff --git a/src/command.cpp b/src/command.cpp
index d5bbca2dd..080e6471d 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -222,7 +222,7 @@ namespace
void HandleUnknownCommand(CommandSource& source, const Anope::string &message)
{
// Try to find a similar command.
- size_t distance = Config->GetBlock("options")->Get<size_t>("didyoumeandifference", "4");
+ size_t distance = Config->GetBlock("options").Get<size_t>("didyoumeandifference", "4");
Anope::string similar;
auto umessage = message.upper();
for (const auto &[command, info] : source.service->commands)
diff --git a/src/config.cpp b/src/config.cpp
index 47ce6feaa..33d7a8de8 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -43,14 +43,14 @@ int Block::CountBlock(const Anope::string &bname) const
return blocks.count(bname);
}
-const Block *Block::GetBlock(const Anope::string &bname, int num) const
+const Block &Block::GetBlock(const Anope::string &bname, int num) const
{
std::pair<block_map::const_iterator, block_map::const_iterator> it = blocks.equal_range(bname);
for (int i = 0; it.first != it.second; ++it.first, ++i)
if (i == num)
- return &it.first->second;
- return &EmptyBlock;
+ return it.first->second;
+ return EmptyBlock;
}
Block *Block::GetMutableBlock(const Anope::string &bname, int num)
@@ -127,16 +127,16 @@ Conf::Conf() : Block("")
for (int i = 0; i < this->CountBlock("include"); ++i)
{
- const Block *include = this->GetBlock("include", i);
+ const Block &include = this->GetBlock("include", i);
- const Anope::string &type = include->Get<const Anope::string>("type"),
- &file = include->Get<const Anope::string>("name");
+ const Anope::string &type = include.Get<const Anope::string>("type"),
+ &file = include.Get<const Anope::string>("name");
File f(file, type == "executable");
this->LoadConf(f);
}
- FOREACH_MOD(OnReload, (this));
+ FOREACH_MOD(OnReload, (*this));
/* Check for modified values that aren't allowed to be modified */
if (Config)
@@ -159,58 +159,58 @@ Conf::Conf() : Block("")
for (const auto &tag : noreload)
{
- if (this->GetBlock(tag.block)->Get<const Anope::string>(tag.name) != Config->GetBlock(tag.block)->Get<const Anope::string>(tag.name))
+ if (this->GetBlock(tag.block).Get<const Anope::string>(tag.name) != Config->GetBlock(tag.block).Get<const Anope::string>(tag.name))
throw ConfigException("<" + tag.block + ":" + tag.name + "> can not be modified once set");
}
}
- const Block *serverinfo = this->GetBlock("serverinfo"), *options = this->GetBlock("options"),
- *mail = this->GetBlock("mail"), *networkinfo = this->GetBlock("networkinfo");
+ const Block &serverinfo = this->GetBlock("serverinfo"), &options = this->GetBlock("options"),
+ &mail = this->GetBlock("mail"), &networkinfo = this->GetBlock("networkinfo");
- const Anope::string &servername = serverinfo->Get<Anope::string>("name");
+ const Anope::string &servername = serverinfo.Get<Anope::string>("name");
ValidateNotEmptyOrSpaces("serverinfo", "name", servername);
if (servername.find(' ') != Anope::string::npos || servername.find('.') == Anope::string::npos)
throw ConfigException("serverinfo:name is not a valid server name");
- ValidateNotEmpty("serverinfo", "description", serverinfo->Get<const Anope::string>("description"));
- ValidateNotEmpty("serverinfo", "pid", serverinfo->Get<const Anope::string>("pid"));
- ValidateNotEmpty("serverinfo", "motd", serverinfo->Get<const Anope::string>("motd"));
+ ValidateNotEmpty("serverinfo", "description", serverinfo.Get<const Anope::string>("description"));
+ ValidateNotEmpty("serverinfo", "pid", serverinfo.Get<const Anope::string>("pid"));
+ ValidateNotEmpty("serverinfo", "motd", serverinfo.Get<const Anope::string>("motd"));
- ValidateNotZero("options", "readtimeout", options->Get<time_t>("readtimeout"));
+ ValidateNotZero("options", "readtimeout", options.Get<time_t>("readtimeout"));
- ValidateNotZero("networkinfo", "nicklen", networkinfo->Get<unsigned>("nicklen", "1"));
- ValidateNotZero("networkinfo", "userlen", networkinfo->Get<unsigned>("userlen", "1"));
- ValidateNotZero("networkinfo", "hostlen", networkinfo->Get<unsigned>("hostlen", "1"));
- ValidateNotZero("networkinfo", "chanlen", networkinfo->Get<unsigned>("chanlen", "1"));
+ ValidateNotZero("networkinfo", "nicklen", networkinfo.Get<unsigned>("nicklen", "1"));
+ ValidateNotZero("networkinfo", "userlen", networkinfo.Get<unsigned>("userlen", "1"));
+ ValidateNotZero("networkinfo", "hostlen", networkinfo.Get<unsigned>("hostlen", "1"));
+ ValidateNotZero("networkinfo", "chanlen", networkinfo.Get<unsigned>("chanlen", "1"));
- spacesepstream(options->Get<const Anope::string>("ulineservers")).GetTokens(this->Ulines);
+ spacesepstream(options.Get<const Anope::string>("ulineservers")).GetTokens(this->Ulines);
- if (mail->Get<bool>("usemail"))
+ if (mail.Get<bool>("usemail"))
{
Anope::string check[] = { "sendfrom", "registration_subject", "registration_message", "emailchange_subject", "emailchange_message", "memo_subject", "memo_message" };
for (const auto &field : check)
- ValidateNotEmpty("mail", field, mail->Get<const Anope::string>(field));
+ ValidateNotEmpty("mail", field, mail.Get<const Anope::string>(field));
}
- this->ReadTimeout = options->Get<time_t>("readtimeout");
- this->ServiceAlias = options->Get<bool>("servicealias");
+ this->ReadTimeout = options.Get<time_t>("readtimeout");
+ this->ServiceAlias = options.Get<bool>("servicealias");
{
std::vector<Anope::string> defaults;
- spacesepstream(this->GetModule("nickserv")->Get<const Anope::string>("defaults")).GetTokens(defaults);
+ spacesepstream(this->GetModule("nickserv").Get<const Anope::string>("defaults")).GetTokens(defaults);
this->DefPrivmsg = std::find(defaults.begin(), defaults.end(), "msg") != defaults.end();
}
- this->DefLanguage = options->Get<const Anope::string>("defaultlanguage");
- this->TimeoutCheck = options->Get<time_t>("timeoutcheck");
- this->NickChars = networkinfo->Get<Anope::string>("nick_chars");
+ this->DefLanguage = options.Get<const Anope::string>("defaultlanguage");
+ this->TimeoutCheck = options.Get<time_t>("timeoutcheck");
+ this->NickChars = networkinfo.Get<Anope::string>("nick_chars");
for (int i = 0; i < this->CountBlock("uplink"); ++i)
{
- const Block *uplink = this->GetBlock("uplink", i);
+ const Block &uplink = this->GetBlock("uplink", i);
int protocol;
- const Anope::string &protocolstr = uplink->Get<const Anope::string>("protocol", "ipv4");
+ const Anope::string &protocolstr = uplink.Get<const Anope::string>("protocol", "ipv4");
if (protocolstr == "ipv4")
protocol = AF_INET;
else if (protocolstr == "ipv6")
@@ -220,17 +220,17 @@ Conf::Conf() : Block("")
else
throw ConfigException("uplink:protocol must be set to ipv4, ipv6, or unix");
- const Anope::string &host = uplink->Get<const Anope::string>("host");
+ const Anope::string &host = uplink.Get<const Anope::string>("host");
ValidateNotEmptyOrSpaces("uplink", "host", host);
int port = 0;
if (protocol != AF_UNIX)
{
- port = uplink->Get<int>("port");
+ port = uplink.Get<int>("port");
ValidateNotZero("uplink", "port", port);
}
- const Anope::string &password = uplink->Get<const Anope::string>("password");
+ const Anope::string &password = uplink.Get<const Anope::string>("password");
ValidateNotEmptyOrSpaces("uplink", "password", password);
if (password[0] == ':')
throw ConfigException("uplink:password is not valid");
@@ -240,9 +240,9 @@ Conf::Conf() : Block("")
for (int i = 0; i < this->CountBlock("module"); ++i)
{
- const Block *module = this->GetBlock("module", i);
+ const Block &module = this->GetBlock("module", i);
- const Anope::string &modname = module->Get<const Anope::string>("name");
+ const Anope::string &modname = module.Get<const Anope::string>("name");
ValidateNotEmptyOrSpaces("module", "name", modname);
@@ -251,13 +251,13 @@ Conf::Conf() : Block("")
for (int i = 0; i < this->CountBlock("opertype"); ++i)
{
- const Block *opertype = this->GetBlock("opertype", i);
+ const Block &opertype = this->GetBlock("opertype", i);
- const Anope::string &oname = opertype->Get<const Anope::string>("name"),
- &modes = opertype->Get<const Anope::string>("modes"),
- &inherits = opertype->Get<const Anope::string>("inherits"),
- &commands = opertype->Get<const Anope::string>("commands"),
- &privs = opertype->Get<const Anope::string>("privs");
+ const Anope::string &oname = opertype.Get<const Anope::string>("name"),
+ &modes = opertype.Get<const Anope::string>("modes"),
+ &inherits = opertype.Get<const Anope::string>("inherits"),
+ &commands = opertype.Get<const Anope::string>("commands"),
+ &privs = opertype.Get<const Anope::string>("privs");
ValidateNotEmpty("opertype", "name", oname);
@@ -294,15 +294,15 @@ Conf::Conf() : Block("")
for (int i = 0; i < this->CountBlock("oper"); ++i)
{
- const Block *oper = this->GetBlock("oper", i);
+ const Block &oper = this->GetBlock("oper", i);
- const Anope::string &nname = oper->Get<const Anope::string>("name"),
- &type = oper->Get<const Anope::string>("type"),
- &password = oper->Get<const Anope::string>("password"),
- &certfp = oper->Get<const Anope::string>("certfp"),
- &host = oper->Get<const Anope::string>("host"),
- &vhost = oper->Get<const Anope::string>("vhost");
- bool require_oper = oper->Get<bool>("require_oper");
+ const Anope::string &nname = oper.Get<const Anope::string>("name"),
+ &type = oper.Get<const Anope::string>("type"),
+ &password = oper.Get<const Anope::string>("password"),
+ &certfp = oper.Get<const Anope::string>("certfp"),
+ &host = oper.Get<const Anope::string>("host"),
+ &vhost = oper.Get<const Anope::string>("vhost");
+ bool require_oper = oper.Get<bool>("require_oper");
ValidateNotEmptyOrSpaces("oper", "name", nname);
ValidateNotEmpty("oper", "type", type);
@@ -330,15 +330,15 @@ Conf::Conf() : Block("")
bi->conf = false;
for (int i = 0; i < this->CountBlock("service"); ++i)
{
- const Block *service = this->GetBlock("service", i);
+ const Block &service = this->GetBlock("service", i);
- const Anope::string &nick = service->Get<const Anope::string>("nick"),
- &user = service->Get<const Anope::string>("user"),
- &host = service->Get<const Anope::string>("host"),
- &gecos = service->Get<const Anope::string>("gecos"),
- &modes = service->Get<const Anope::string>("modes"),
- &channels = service->Get<const Anope::string>("channels"),
- &alias = service->Get<const Anope::string>("alias", nick.upper());
+ const Anope::string &nick = service.Get<const Anope::string>("nick"),
+ &user = service.Get<const Anope::string>("user"),
+ &host = service.Get<const Anope::string>("host"),
+ &gecos = service.Get<const Anope::string>("gecos"),
+ &modes = service.Get<const Anope::string>("modes"),
+ &channels = service.Get<const Anope::string>("channels"),
+ &alias = service.Get<const Anope::string>("alias", nick.upper());
ValidateNotEmptyOrSpaces("service", "nick", nick);
ValidateNotEmptyOrSpaces("service", "user", user);
@@ -396,7 +396,6 @@ Conf::Conf() : Block("")
{
size_t ch = oldchannel.find('#');
Anope::string chname = oldchannel.substr(ch != Anope::string::npos ? ch : 0);
-
bool found = false;
for (const auto &botchannel : bi->botchannels)
{
@@ -421,24 +420,24 @@ Conf::Conf() : Block("")
for (int i = 0; i < this->CountBlock("log"); ++i)
{
- const Block *log = this->GetBlock("log", i);
+ const Block &log = this->GetBlock("log", i);
- int logage = log->Get<int>("logage");
- bool rawio = log->Get<bool>("rawio");
- bool debug = log->Get<bool>("debug");
+ int logage = log.Get<int>("logage");
+ bool rawio = log.Get<bool>("rawio");
+ bool debug = log.Get<bool>("debug");
LogInfo l(logage, rawio, debug);
- l.bot = BotInfo::Find(log->Get<const Anope::string>("bot", "Global"), true);
- spacesepstream(log->Get<const Anope::string>("target")).GetTokens(l.targets);
- spacesepstream(log->Get<const Anope::string>("source")).GetTokens(l.sources);
- spacesepstream(log->Get<const Anope::string>("admin")).GetTokens(l.admin);
- spacesepstream(log->Get<const Anope::string>("override")).GetTokens(l.override);
- spacesepstream(log->Get<const Anope::string>("commands")).GetTokens(l.commands);
- spacesepstream(log->Get<const Anope::string>("servers")).GetTokens(l.servers);
- spacesepstream(log->Get<const Anope::string>("channels")).GetTokens(l.channels);
- spacesepstream(log->Get<const Anope::string>("users")).GetTokens(l.users);
- spacesepstream(log->Get<const Anope::string>("other")).GetTokens(l.normal);
+ l.bot = BotInfo::Find(log.Get<const Anope::string>("bot", "Global"), true);
+ spacesepstream(log.Get<const Anope::string>("target")).GetTokens(l.targets);
+ spacesepstream(log.Get<const Anope::string>("source")).GetTokens(l.sources);
+ spacesepstream(log.Get<const Anope::string>("admin")).GetTokens(l.admin);
+ spacesepstream(log.Get<const Anope::string>("override")).GetTokens(l.override);
+ spacesepstream(log.Get<const Anope::string>("commands")).GetTokens(l.commands);
+ spacesepstream(log.Get<const Anope::string>("servers")).GetTokens(l.servers);
+ spacesepstream(log.Get<const Anope::string>("channels")).GetTokens(l.channels);
+ spacesepstream(log.Get<const Anope::string>("users")).GetTokens(l.users);
+ spacesepstream(log.Get<const Anope::string>("other")).GetTokens(l.normal);
this->LogInfos.push_back(l);
}
@@ -447,14 +446,14 @@ Conf::Conf() : Block("")
bi->commands.clear();
for (int i = 0; i < this->CountBlock("command"); ++i)
{
- const Block *command = this->GetBlock("command", i);
+ const Block &command = this->GetBlock("command", i);
- const Anope::string &service = command->Get<const Anope::string>("service"),
- &nname = command->Get<const Anope::string>("name"),
- &cmd = command->Get<const Anope::string>("command"),
- &permission = command->Get<const Anope::string>("permission"),
- &group = command->Get<const Anope::string>("group");
- bool hide = command->Get<bool>("hide");
+ const Anope::string &service = command.Get<const Anope::string>("service"),
+ &nname = command.Get<const Anope::string>("name"),
+ &cmd = command.Get<const Anope::string>("command"),
+ &permission = command.Get<const Anope::string>("permission"),
+ &group = command.Get<const Anope::string>("group");
+ bool hide = command.Get<bool>("hide");
ValidateNotEmptyOrSpaces("command", "service", service);
ValidateNotEmpty("command", "name", nname);
@@ -472,25 +471,25 @@ Conf::Conf() : Block("")
PrivilegeManager::ClearPrivileges();
for (int i = 0; i < this->CountBlock("privilege"); ++i)
{
- const Block *privilege = this->GetBlock("privilege", i);
+ const Block &privilege = this->GetBlock("privilege", i);
- const Anope::string &nname = privilege->Get<const Anope::string>("name"),
- &desc = privilege->Get<const Anope::string>("desc");
- int rank = privilege->Get<int>("rank");
+ const Anope::string &nname = privilege.Get<const Anope::string>("name"),
+ &desc = privilege.Get<const Anope::string>("desc");
+ int rank = privilege.Get<int>("rank");
PrivilegeManager::AddPrivilege(Privilege(nname, desc, rank));
}
for (int i = 0; i < this->CountBlock("fantasy"); ++i)
{
- const Block *fantasy = this->GetBlock("fantasy", i);
+ const Block &fantasy = this->GetBlock("fantasy", i);
- const Anope::string &nname = fantasy->Get<const Anope::string>("name"),
- &service = fantasy->Get<const Anope::string>("command"),
- &permission = fantasy->Get<const Anope::string>("permission"),
- &group = fantasy->Get<const Anope::string>("group");
- bool hide = fantasy->Get<bool>("hide"),
- prepend_channel = fantasy->Get<bool>("prepend_channel", "yes");
+ const Anope::string &nname = fantasy.Get<const Anope::string>("name"),
+ &service = fantasy.Get<const Anope::string>("command"),
+ &permission = fantasy.Get<const Anope::string>("permission"),
+ &group = fantasy.Get<const Anope::string>("group");
+ bool hide = fantasy.Get<bool>("hide"),
+ prepend_channel = fantasy.Get<bool>("prepend_channel", "yes");
ValidateNotEmpty("fantasy", "name", nname);
ValidateNotEmptyOrSpaces("fantasy", "command", service);
@@ -505,10 +504,10 @@ Conf::Conf() : Block("")
for (int i = 0; i < this->CountBlock("command_group"); ++i)
{
- const Block *command_group = this->GetBlock("command_group", i);
+ const Block &command_group = this->GetBlock("command_group", i);
- const Anope::string &nname = command_group->Get<const Anope::string>("name"),
- &description = command_group->Get<const Anope::string>("description");
+ const Anope::string &nname = command_group.Get<const Anope::string>("name"),
+ &description = command_group.Get<const Anope::string>("description");
CommandGroup gr;
gr.name = nname;
@@ -544,19 +543,19 @@ Conf::Conf() : Block("")
Log() << "Tied oper " << na->nc->display << " to type " << o->ot->GetName();
}
- if (options->Get<const Anope::string>("casemap", "ascii") == "ascii")
+ if (options.Get<const Anope::string>("casemap", "ascii") == "ascii")
Anope::casemap = std::locale(std::locale(), new Anope::ascii_ctype<char>());
- else if (options->Get<const Anope::string>("casemap") == "rfc1459")
+ else if (options.Get<const Anope::string>("casemap") == "rfc1459")
Anope::casemap = std::locale(std::locale(), new Anope::rfc1459_ctype<char>());
else
{
try
{
- Anope::casemap = std::locale(options->Get<const Anope::string>("casemap").c_str());
+ Anope::casemap = std::locale(options.Get<const Anope::string>("casemap").c_str());
}
catch (const std::runtime_error &)
{
- Log() << "Unknown casemap " << options->Get<const Anope::string>("casemap") << " - casemap not changed";
+ Log() << "Unknown casemap " << options.Get<const Anope::string>("casemap") << " - casemap not changed";
}
}
Anope::CaseMapRebuild();
@@ -620,30 +619,30 @@ void Conf::Post(Conf *old)
}
}
-Block *Conf::GetModule(const Module *m)
+Block &Conf::GetModule(const Module *m)
{
if (!m)
- return &Block::EmptyBlock;
+ return Block::EmptyBlock;
return GetModule(m->name);
}
-Block *Conf::GetModule(const Anope::string &mname)
+Block &Conf::GetModule(const Anope::string &mname)
{
std::map<Anope::string, Block *>::iterator it = modules.find(mname);
if (it != modules.end())
- return it->second;
+ return *it->second;
Block *&block = modules[mname];
/* Search for the block */
for (std::pair<block_map::iterator, block_map::iterator> iters = blocks.equal_range("module"); iters.first != iters.second; ++iters.first)
{
- Block *b = &iters.first->second;
+ Block &b = iters.first->second;
- if (b->Get<const Anope::string>("name") == mname)
+ if (b.Get<const Anope::string>("name") == mname)
{
- block = b;
+ block = &b;
break;
}
}
@@ -660,25 +659,25 @@ BotInfo *Conf::GetClient(const Anope::string &cname)
if (it != bots.end())
return BotInfo::Find(!it->second.empty() ? it->second : cname, true);
- Block *block = GetModule(cname.lower());
- const Anope::string &client = block->Get<const Anope::string>("client");
+ Block &block = GetModule(cname.lower());
+ const Anope::string &client = block.Get<const Anope::string>("client");
bots[cname] = client;
return GetClient(cname);
}
-const Block *Conf::GetCommand(CommandSource &source)
+const Block &Conf::GetCommand(CommandSource &source)
{
const Anope::string &block_name = source.c ? "fantasy" : "command";
for (std::pair<block_map::iterator, block_map::iterator> iters = blocks.equal_range(block_name); iters.first != iters.second; ++iters.first)
{
- Block *b = &iters.first->second;
+ Block &b = iters.first->second;
- if (b->Get<Anope::string>("name") == source.command)
+ if (b.Get<Anope::string>("name") == source.command)
return b;
}
- return &Block::EmptyBlock;
+ return Block::EmptyBlock;
}
File::File(const Anope::string &n, bool e) : name(n), executable(e)
@@ -929,12 +928,12 @@ void Conf::LoadConf(File &file)
/* Check defines */
for (int i = 0; i < this->CountBlock("define"); ++i)
{
- const Block *define = this->GetBlock("define", i);
+ const Block &define = this->GetBlock("define", i);
- const Anope::string &dname = define->Get<const Anope::string>("name");
+ const Anope::string &dname = define.Get<const Anope::string>("name");
- if (dname == wordbuffer && define != b)
- wordbuffer = define->Get<const Anope::string>("value");
+ if (dname == wordbuffer && &define != b)
+ wordbuffer = define.Get<const Anope::string>("value");
}
if (b)
diff --git a/src/init.cpp b/src/init.cpp
index 0508ab94f..4befb9ea1 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -215,7 +215,7 @@ static void InitSignals()
static void remove_pidfile()
{
- auto pidfile = Anope::ExpandData(Config->GetBlock("serverinfo")->Get<const Anope::string>("pid"));
+ auto pidfile = Anope::ExpandData(Config->GetBlock("serverinfo").Get<const Anope::string>("pid"));
if (!pidfile.empty())
remove(pidfile.c_str());
}
@@ -224,7 +224,7 @@ static void remove_pidfile()
static void write_pidfile()
{
- auto pidfile = Anope::ExpandData(Config->GetBlock("serverinfo")->Get<const Anope::string>("pid"));
+ auto pidfile = Anope::ExpandData(Config->GetBlock("serverinfo").Get<const Anope::string>("pid"));
if (Anope::NoPID || pidfile.empty())
return;
@@ -242,25 +242,25 @@ static void write_pidfile()
static void setuidgid()
{
#ifndef _WIN32
- Configuration::Block *options = Config->GetBlock("options");
+ Configuration::Block &options = Config->GetBlock("options");
uid_t uid = -1;
gid_t gid = -1;
- if (!options->Get<const Anope::string>("user").empty())
+ if (!options.Get<const Anope::string>("user").empty())
{
errno = 0;
- struct passwd *u = getpwnam(options->Get<const Anope::string>("user").c_str());
+ struct passwd *u = getpwnam(options.Get<const Anope::string>("user").c_str());
if (u == NULL)
- Log() << "Unable to setuid to " << options->Get<const Anope::string>("user") << ": " << Anope::LastError();
+ Log() << "Unable to setuid to " << options.Get<const Anope::string>("user") << ": " << Anope::LastError();
else
uid = u->pw_uid;
}
- if (!options->Get<const Anope::string>("group").empty())
+ if (!options.Get<const Anope::string>("group").empty())
{
errno = 0;
- struct group *g = getgrnam(options->Get<const Anope::string>("group").c_str());
+ struct group *g = getgrnam(options.Get<const Anope::string>("group").c_str());
if (g == NULL)
- Log() << "Unable to setgid to " << options->Get<const Anope::string>("group") << ": " << Anope::LastError();
+ Log() << "Unable to setgid to " << options.Get<const Anope::string>("group") << ": " << Anope::LastError();
else
gid = g->gr_gid;
}
@@ -278,16 +278,16 @@ static void setuidgid()
if (static_cast<int>(gid) != -1)
{
if (setgid(gid) == -1)
- Log() << "Unable to setgid to " << options->Get<const Anope::string>("group") << ": " << Anope::LastError();
+ Log() << "Unable to setgid to " << options.Get<const Anope::string>("group") << ": " << Anope::LastError();
else
- Log() << "Successfully set group to " << options->Get<const Anope::string>("group");
+ Log() << "Successfully set group to " << options.Get<const Anope::string>("group");
}
if (static_cast<int>(uid) != -1)
{
if (setuid(uid) == -1)
- Log() << "Unable to setuid to " << options->Get<const Anope::string>("user") << ": " << Anope::LastError();
+ Log() << "Unable to setuid to " << options.Get<const Anope::string>("user") << ": " << Anope::LastError();
else
- Log() << "Successfully set user to " << options->Get<const Anope::string>("user");
+ Log() << "Successfully set user to " << options.Get<const Anope::string>("user");
}
#endif
}
@@ -493,8 +493,8 @@ bool Anope::Init(int ac, char **av)
}
/* Create me */
- Configuration::Block *block = Config->GetBlock("serverinfo");
- Me = new Server(NULL, block->Get<const Anope::string>("name"), 0, block->Get<const Anope::string>("description"), block->Get<const Anope::string>("id"));
+ Configuration::Block &block = Config->GetBlock("serverinfo");
+ Me = new Server(NULL, block.Get<const Anope::string>("name"), 0, block.Get<const Anope::string>("description"), block.Get<const Anope::string>("id"));
for (const auto &[_, bi] : *BotListByNick)
{
bi->server = Me;
@@ -512,15 +512,15 @@ bool Anope::Init(int ac, char **av)
/* load modules */
Log() << "Loading modules...";
for (int i = 0; i < Config->CountBlock("module"); ++i)
- ModuleManager::LoadModule(Config->GetBlock("module", i)->Get<const Anope::string>("name"), NULL);
+ ModuleManager::LoadModule(Config->GetBlock("module", i).Get<const Anope::string>("name"), NULL);
#ifndef _WIN32
/* If we're root, issue a warning now */
if (!getuid() && !getgid())
{
/* If we are configured to setuid later, don't issue a warning */
- Configuration::Block *options = Config->GetBlock("options");
- if (options->Get<const Anope::string>("user").empty())
+ Configuration::Block &options = Config->GetBlock("options");
+ if (options.Get<const Anope::string>("user").empty())
{
std::cerr << "WARNING: You are currently running Anope as the root superuser. Anope does not" << std::endl;
std::cerr << " require root privileges to run, and it is discouraged that you run Anope" << std::endl;
diff --git a/src/language.cpp b/src/language.cpp
index 8d449d362..440461133 100644
--- a/src/language.cpp
+++ b/src/language.cpp
@@ -36,7 +36,7 @@ void Language::InitLanguages()
setlocale(LC_ALL, "");
- spacesepstream sep(Config->GetBlock("options")->Get<const Anope::string>("languages"));
+ spacesepstream sep(Config->GetBlock("options").Get<const Anope::string>("languages"));
Anope::string language;
while (sep.GetToken(language))
{
diff --git a/src/mail.cpp b/src/mail.cpp
index f3adab44c..9fb7aedff 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -15,14 +15,14 @@
Mail::Message::Message(const Anope::string &sf, const Anope::string &mailto, const Anope::string &a, const Anope::string &s, const Anope::string &m)
: Thread()
- , sendmail_path(Config->GetBlock("mail")->Get<const Anope::string>("sendmailpath", "/usr/sbin/sendmail -it"))
+ , sendmail_path(Config->GetBlock("mail").Get<const Anope::string>("sendmailpath", "/usr/sbin/sendmail -it"))
, send_from(sf)
, mail_to(mailto)
, addr(a)
, subject(s)
, message(m)
- , content_type(Config->GetBlock("mail")->Get<const Anope::string>("content_type", "text/plain; charset=UTF-8"))
- , dont_quote_addresses(Config->GetBlock("mail")->Get<bool>("dontquoteaddresses"))
+ , content_type(Config->GetBlock("mail").Get<const Anope::string>("content_type", "text/plain; charset=UTF-8"))
+ , dont_quote_addresses(Config->GetBlock("mail").Get<bool>("dontquoteaddresses"))
{
}
@@ -72,32 +72,32 @@ bool Mail::Send(User *u, NickCore *nc, BotInfo *service, const Anope::string &su
if (!nc || !service || subject.empty() || message.empty())
return false;
- Configuration::Block *b = Config->GetBlock("mail");
+ Configuration::Block &b = Config->GetBlock("mail");
if (!u)
{
- if (!b->Get<bool>("usemail") || b->Get<const Anope::string>("sendfrom").empty())
+ if (!b.Get<bool>("usemail") || b.Get<const Anope::string>("sendfrom").empty())
return false;
else if (nc->email.empty())
return false;
nc->lastmail = Anope::CurTime;
- Thread *t = new Mail::Message(b->Get<const Anope::string>("sendfrom"), nc->display, nc->email, subject, message);
+ Thread *t = new Mail::Message(b.Get<const Anope::string>("sendfrom"), nc->display, nc->email, subject, message);
t->Start();
return true;
}
else
{
- if (!b->Get<bool>("usemail") || b->Get<const Anope::string>("sendfrom").empty())
+ if (!b.Get<bool>("usemail") || b.Get<const Anope::string>("sendfrom").empty())
u->SendMessage(service, _("Services have been configured to not send mail."));
- else if (Anope::CurTime - u->lastmail < b->Get<time_t>("delay"))
- u->SendMessage(service, _("Please wait \002%lu\002 seconds and retry."), (unsigned long)b->Get<time_t>("delay") - (Anope::CurTime - u->lastmail));
+ else if (Anope::CurTime - u->lastmail < b.Get<time_t>("delay"))
+ u->SendMessage(service, _("Please wait \002%lu\002 seconds and retry."), (unsigned long)b.Get<time_t>("delay") - (Anope::CurTime - u->lastmail));
else if (nc->email.empty())
u->SendMessage(service, _("Email for \002%s\002 is invalid."), nc->display.c_str());
else
{
u->lastmail = nc->lastmail = Anope::CurTime;
- Thread *t = new Mail::Message(b->Get<const Anope::string>("sendfrom"), nc->display, nc->email, subject, message);
+ Thread *t = new Mail::Message(b.Get<const Anope::string>("sendfrom"), nc->display, nc->email, subject, message);
t->Start();
return true;
}
@@ -108,12 +108,12 @@ bool Mail::Send(User *u, NickCore *nc, BotInfo *service, const Anope::string &su
bool Mail::Send(NickCore *nc, const Anope::string &subject, const Anope::string &message)
{
- Configuration::Block *b = Config->GetBlock("mail");
- if (!b->Get<bool>("usemail") || b->Get<const Anope::string>("sendfrom").empty() || !nc || nc->email.empty() || subject.empty() || message.empty())
+ Configuration::Block &b = Config->GetBlock("mail");
+ if (!b.Get<bool>("usemail") || b.Get<const Anope::string>("sendfrom").empty() || !nc || nc->email.empty() || subject.empty() || message.empty())
return false;
nc->lastmail = Anope::CurTime;
- Thread *t = new Mail::Message(b->Get<const Anope::string>("sendfrom"), nc->display, nc->email, subject, message);
+ Thread *t = new Mail::Message(b.Get<const Anope::string>("sendfrom"), nc->display, nc->email, subject, message);
t->Start();
return true;
diff --git a/src/main.cpp b/src/main.cpp
index f53b0ba0f..32329043e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -167,8 +167,8 @@ int main(int ac, char **av, char **envp)
/* Set up timers */
time_t last_check = Anope::CurTime;
- UpdateTimer updateTimer(Config->GetBlock("options")->Get<time_t>("updatetimeout", "2m"));
- ExpireTimer expireTimer(Config->GetBlock("options")->Get<time_t>("expiretimeout", "30m"));
+ UpdateTimer updateTimer(Config->GetBlock("options").Get<time_t>("updatetimeout", "2m"));
+ ExpireTimer expireTimer(Config->GetBlock("options").Get<time_t>("expiretimeout", "30m"));
/*** Main loop. ***/
while (!Anope::Quitting)
diff --git a/src/messages.cpp b/src/messages.cpp
index ddc6ec380..391b3d330 100644
--- a/src/messages.cpp
+++ b/src/messages.cpp
@@ -237,7 +237,7 @@ void MOTD::Run(MessageSource &source, const std::vector<Anope::string> &params,
if (s != Me)
return;
- auto motdfile = Anope::ExpandConfig(Config->GetBlock("serverinfo")->Get<const Anope::string>("motd"));
+ auto motdfile = Anope::ExpandConfig(Config->GetBlock("serverinfo").Get<const Anope::string>("motd"));
std::ifstream stream(motdfile.str());
if (!stream.is_open())
{
@@ -405,7 +405,7 @@ void Stats::Run(MessageSource &source, const std::vector<Anope::string> &params,
case 'o':
case 'O':
/* Check whether the user is an operator */
- if (!u->HasMode("OPER") && Config->GetBlock("options")->Get<bool>("hidestatso"))
+ if (!u->HasMode("OPER") && Config->GetBlock("options").Get<bool>("hidestatso"))
IRCD->SendNumeric(RPL_STATSLINKINFO, source.GetSource(), params[0][0], "End of /STATS report.");
else
{
@@ -473,7 +473,7 @@ void Whois::Run(MessageSource &source, const std::vector<Anope::string> &params,
IRCD->SendNumeric(RPL_WHOISUSER, source.GetSource(), u->nick, u->GetIdent(), u->host, '*', u->realname);
if (bi)
IRCD->SendNumeric(RPL_WHOISREGNICK, source.GetSource(), bi->nick, "is a registered nick");
- IRCD->SendNumeric(RPL_WHOISSERVER, source.GetSource(), u->nick, Me->GetName(), Config->GetBlock("serverinfo")->Get<const Anope::string>("description"));
+ IRCD->SendNumeric(RPL_WHOISSERVER, source.GetSource(), u->nick, Me->GetName(), Config->GetBlock("serverinfo").Get<const Anope::string>("description"));
if (bi)
IRCD->SendNumeric(RPL_WHOISIDLE, source.GetSource(), bi->nick, Anope::CurTime - bi->lastmsg, bi->signon, "seconds idle, signon time");
IRCD->SendNumeric(RPL_WHOISOPERATOR, source.GetSource(), u->nick, "is a Network Service");
diff --git a/src/misc.cpp b/src/misc.cpp
index 2c1950ba6..6f0d95833 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -391,7 +391,7 @@ bool Anope::Match(const Anope::string &str, const Anope::string &mask, bool case
if (r == NULL || r->GetExpression() != stripped_mask)
{
- ServiceReference<RegexProvider> provider("Regex", Config->GetBlock("options")->Get<const Anope::string>("regexengine"));
+ ServiceReference<RegexProvider> provider("Regex", Config->GetBlock("options").Get<const Anope::string>("regexengine"));
if (provider)
{
try
diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp
index 07dea3228..11a00e363 100644
--- a/src/modulemanager.cpp
+++ b/src/modulemanager.cpp
@@ -242,7 +242,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u)
/* Initialize config */
try
{
- m->OnReload(Config);
+ m->OnReload(*Config);
}
catch (const ModuleException &ex)
{
diff --git a/src/protocol.cpp b/src/protocol.cpp
index c66f87653..a45985a0d 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -25,10 +25,10 @@ IRCDProto *IRCD = NULL;
IRCDProto::IRCDProto(Module *creator, const Anope::string &p)
: Service(creator, "IRCDProto", creator->name)
, proto_name(p)
- , MaxChannel(Config->GetBlock("networkinfo")->Get<unsigned>("chanlen", "32"))
- , MaxHost(Config->GetBlock("networkinfo")->Get<unsigned>("hostlen", "64"))
- , MaxNick(Config->GetBlock("networkinfo")->Get<unsigned>("nicklen", "31"))
- , MaxUser(Config->GetBlock("networkinfo")->Get<unsigned>("userlen", "10"))
+ , MaxChannel(Config->GetBlock("networkinfo").Get<unsigned>("chanlen", "32"))
+ , MaxHost(Config->GetBlock("networkinfo").Get<unsigned>("hostlen", "64"))
+ , MaxNick(Config->GetBlock("networkinfo").Get<unsigned>("nicklen", "31"))
+ , MaxUser(Config->GetBlock("networkinfo").Get<unsigned>("userlen", "10"))
{
if (IRCD == NULL)
IRCD = this;
@@ -76,7 +76,7 @@ Anope::string IRCDProto::SID_Retrieve()
if (!IRCD || !IRCD->RequiresID)
return "";
- static Anope::string current_sid = Config->GetBlock("serverinfo")->Get<const Anope::string>("id");
+ static Anope::string current_sid = Config->GetBlock("serverinfo").Get<const Anope::string>("id");
if (current_sid.empty())
current_sid = "00A";
@@ -289,8 +289,8 @@ bool IRCDProto::IsHostValid(const Anope::string &host)
if (host.empty() || host.length() > IRCD->MaxHost)
return false;
- const Anope::string &vhostdisablebe = Config->GetBlock("networkinfo")->Get<const Anope::string>("disallow_start_or_end"),
- vhostchars = Config->GetBlock("networkinfo")->Get<const Anope::string>("vhost_chars");
+ const Anope::string &vhostdisablebe = Config->GetBlock("networkinfo").Get<const Anope::string>("disallow_start_or_end"),
+ vhostchars = Config->GetBlock("networkinfo").Get<const Anope::string>("vhost_chars");
if (vhostdisablebe.find_first_of(host[0]) != Anope::string::npos)
return false;
@@ -306,7 +306,7 @@ bool IRCDProto::IsHostValid(const Anope::string &host)
return false;
}
- return dots > 0 || Config->GetBlock("networkinfo")->Get<bool>("allow_undotted_vhosts");
+ return dots > 0 || Config->GetBlock("networkinfo").Get<bool>("allow_undotted_vhosts");
}
void IRCDProto::SendOper(User *u)
@@ -317,7 +317,7 @@ void IRCDProto::SendOper(User *u)
size_t IRCDProto::GetMaxListFor(Channel *c, ChannelMode *cm)
{
- return c->HasMode("LBAN") ? 0 : Config->GetBlock("networkinfo")->Get<size_t>("modelistsize", "100");
+ return c->HasMode("LBAN") ? 0 : Config->GetBlock("networkinfo").Get<size_t>("modelistsize", "100");
}
Anope::string IRCDProto::NormalizeMask(const Anope::string &mask)
diff --git a/src/uplink.cpp b/src/uplink.cpp
index c032d6118..100217291 100644
--- a/src/uplink.cpp
+++ b/src/uplink.cpp
@@ -53,8 +53,8 @@ void Uplink::Connect()
Configuration::Uplink &u = Config->Uplinks[Anope::CurrentUplink];
new UplinkSocket();
- if (!Config->GetBlock("serverinfo")->Get<const Anope::string>("localhost").empty())
- UplinkSock->Bind(Config->GetBlock("serverinfo")->Get<const Anope::string>("localhost"));
+ if (!Config->GetBlock("serverinfo").Get<const Anope::string>("localhost").empty())
+ UplinkSock->Bind(Config->GetBlock("serverinfo").Get<const Anope::string>("localhost"));
FOREACH_MOD(OnPreServerConnect, ());
Anope::string ip = Anope::Resolve(u.host, u.protocol);
Log(LOG_TERMINAL) << "Attempting to connect to uplink #" << (Anope::CurrentUplink + 1) << " " << u.host << " (" << ip << '/' << u.port << ") with protocol " << IRCD->GetProtocolName();
@@ -164,7 +164,7 @@ UplinkSocket::~UplinkSocket()
}
else if (!Anope::Quitting)
{
- time_t retry = Config->GetBlock("options")->Get<time_t>("retrywait");
+ time_t retry = Config->GetBlock("options").Get<time_t>("retrywait");
Log() << "Disconnected, retrying in " << retry << " seconds";
new ReconnectTimer(retry);
diff --git a/src/users.cpp b/src/users.cpp
index f6a4adb37..8f8e9570d 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -835,14 +835,14 @@ Anope::string User::Mask() const
bool User::BadPassword()
{
- if (!Config->GetBlock("options")->Get<unsigned int>("badpasslimit"))
+ if (!Config->GetBlock("options").Get<unsigned int>("badpasslimit"))
return false;
- if (Config->GetBlock("options")->Get<time_t>("badpasstimeout") > 0 && this->invalid_pw_time > 0 && this->invalid_pw_time < Anope::CurTime - Config->GetBlock("options")->Get<time_t>("badpasstimeout"))
+ if (Config->GetBlock("options").Get<time_t>("badpasstimeout") > 0 && this->invalid_pw_time > 0 && this->invalid_pw_time < Anope::CurTime - Config->GetBlock("options").Get<time_t>("badpasstimeout"))
this->invalid_pw_count = 0;
++this->invalid_pw_count;
this->invalid_pw_time = Anope::CurTime;
- if (this->invalid_pw_count >= Config->GetBlock("options")->Get<unsigned int>("badpasslimit"))
+ if (this->invalid_pw_count >= Config->GetBlock("options").Get<unsigned int>("badpasslimit"))
{
this->Kill(Me, "Too many invalid passwords");
return true;
diff --git a/src/xline.cpp b/src/xline.cpp
index cdfc2d7c4..9e8dd41bf 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -25,11 +25,11 @@ Serialize::Checker<std::multimap<Anope::string, XLine *, ci::less> > XLineManage
void XLine::Init()
{
- if (this->mask.length() >= 2 && this->mask[0] == '/' && this->mask[this->mask.length() - 1] == '/' && !Config->GetBlock("options")->Get<const Anope::string>("regexengine").empty())
+ if (this->mask.length() >= 2 && this->mask[0] == '/' && this->mask[this->mask.length() - 1] == '/' && !Config->GetBlock("options").Get<const Anope::string>("regexengine").empty())
{
Anope::string stripped_mask = this->mask.substr(1, this->mask.length() - 2);
- ServiceReference<RegexProvider> provider("Regex", Config->GetBlock("options")->Get<const Anope::string>("regexengine"));
+ ServiceReference<RegexProvider> provider("Regex", Config->GetBlock("options").Get<const Anope::string>("regexengine"));
if (provider)
{
try