summaryrefslogtreecommitdiff
path: root/modules/proxyscan.cpp
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 /modules/proxyscan.cpp
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.
Diffstat (limited to 'modules/proxyscan.cpp')
-rw-r--r--modules/proxyscan.cpp34
1 files changed, 17 insertions, 17 deletions
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;