diff options
| author | Adam <Adam@anope.org> | 2013-04-11 00:08:28 -0500 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2013-04-11 00:08:28 -0500 |
| commit | 4f9b7874d6b3a41939ecc2e872ec08d03af7b5f1 (patch) | |
| tree | 43162205d31b277c9ff12ee28b7e3a60d6382316 /modules/extra | |
| parent | 207c46c871e85b55ae66acc456c6bc412c0c79f9 (diff) | |
Pass new config and the new config reader to the OnReload event, aswell as call it on module load on modules that hook to it
Diffstat (limited to 'modules/extra')
| -rw-r--r-- | modules/extra/m_chanstats.cpp | 14 | ||||
| -rw-r--r-- | modules/extra/m_dns.cpp | 21 | ||||
| -rw-r--r-- | modules/extra/m_httpd.cpp | 21 | ||||
| -rw-r--r-- | modules/extra/m_ldap.cpp | 21 | ||||
| -rw-r--r-- | modules/extra/m_ldap_authentication.cpp | 23 | ||||
| -rw-r--r-- | modules/extra/m_ldap_oper.cpp | 16 | ||||
| -rw-r--r-- | modules/extra/m_mysql.cpp | 23 | ||||
| -rw-r--r-- | modules/extra/m_proxyscan.cpp | 39 | ||||
| -rw-r--r-- | modules/extra/m_sql_authentication.cpp | 12 | ||||
| -rw-r--r-- | modules/extra/m_sql_oper.cpp | 10 | ||||
| -rw-r--r-- | modules/extra/m_sqlite.cpp | 15 | ||||
| -rw-r--r-- | modules/extra/m_ssl.cpp | 14 | ||||
| -rw-r--r-- | modules/extra/m_xmlrpc.cpp | 12 |
13 files changed, 93 insertions, 148 deletions
diff --git a/modules/extra/m_chanstats.cpp b/modules/extra/m_chanstats.cpp index d62befbb0..caa20aacb 100644 --- a/modules/extra/m_chanstats.cpp +++ b/modules/extra/m_chanstats.cpp @@ -347,18 +347,16 @@ class MChanstats : public Module I_OnChanDrop, I_OnReload}; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); - this->OnReload(); } - void OnReload() anope_override + void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override { - ConfigReader config; - prefix = config.ReadValue("chanstats", "prefix", "anope_", 0); - SmileysHappy = config.ReadValue("chanstats", "SmileysHappy", ":) :-) ;) :D :-D", 0); - SmileysSad = config.ReadValue("chanstats", "SmileysSad", ":( :-( ;( ;-(", 0); - SmileysOther = config.ReadValue("chanstats", "SmileysOther", ":/", 0); + prefix = reader.ReadValue("chanstats", "prefix", "anope_", 0); + SmileysHappy = reader.ReadValue("chanstats", "SmileysHappy", ":) :-) ;) :D :-D", 0); + SmileysSad = reader.ReadValue("chanstats", "SmileysSad", ":( :-( ;( ;-(", 0); + SmileysOther = reader.ReadValue("chanstats", "SmileysOther", ":/", 0); - Anope::string engine = config.ReadValue("chanstats", "engine", "", 0); + Anope::string engine = reader.ReadValue("chanstats", "engine", "", 0); this->sql = ServiceReference<SQL::Provider>("SQL::Provider", engine); if (sql) this->CheckTables(); diff --git a/modules/extra/m_dns.cpp b/modules/extra/m_dns.cpp index 3ee7aaa67..e8f3bd758 100644 --- a/modules/extra/m_dns.cpp +++ b/modules/extra/m_dns.cpp @@ -938,21 +938,18 @@ class ModuleDNS : public Module Implementation i[] = { I_OnReload, I_OnModuleUnload }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); - - this->OnReload(); } - void OnReload() anope_override + void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override { - ConfigReader config; - - nameserver = config.ReadValue("dns", "nameserver", "127.0.0.1", 0); - timeout = Anope::DoTime(config.ReadValue("dns", "timeout", "5", 0)); - ip = config.ReadValue("dns", "ip", "0.0.0.0", 0); - port = config.ReadInteger("dns", "port", "53", 0, false); - admin = config.ReadValue("dns", "admin", "admin@example.com", 0); - nameservers = config.ReadValue("dns", "nameservers", "ns1.example.com", 0); - refresh = config.ReadInteger("dns", "refresh", "3600", 0, false); + + nameserver = reader.ReadValue("dns", "nameserver", "127.0.0.1", 0); + timeout = Anope::DoTime(reader.ReadValue("dns", "timeout", "5", 0)); + ip = reader.ReadValue("dns", "ip", "0.0.0.0", 0); + port = reader.ReadInteger("dns", "port", "53", 0, false); + admin = reader.ReadValue("dns", "admin", "admin@example.com", 0); + nameservers = reader.ReadValue("dns", "nameservers", "ns1.example.com", 0); + refresh = reader.ReadInteger("dns", "refresh", "3600", 0, false); if (Anope::IsFile(nameserver)) { diff --git a/modules/extra/m_httpd.cpp b/modules/extra/m_httpd.cpp index 6972bcdf1..5e643d942 100644 --- a/modules/extra/m_httpd.cpp +++ b/modules/extra/m_httpd.cpp @@ -336,8 +336,6 @@ class HTTPD : public Module Implementation i[] = { I_OnReload }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); - - this->OnReload(); } ~HTTPD() @@ -354,22 +352,21 @@ class HTTPD : public Module this->providers.clear(); } - void OnReload() anope_override + void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override { - ConfigReader config; std::set<Anope::string> existing; - for (int i = 0, num = config.Enumerate("httpd"); i < num; ++i) + for (int i = 0, num = reader.Enumerate("httpd"); i < num; ++i) { - Anope::string hname = config.ReadValue("httpd", "name", "httpd/main", i); + Anope::string hname = reader.ReadValue("httpd", "name", "httpd/main", i); existing.insert(hname); - Anope::string ip = config.ReadValue("httpd", "ip", "", i); - int port = config.ReadInteger("httpd", "port", "8080", i, true); - int timeout = config.ReadInteger("httpd", "timeout", "30", i, true); - bool ssl = config.ReadFlag("httpd", "ssl", "no", i); - Anope::string ext_ip = config.ReadValue("httpd", "extforward_ip", "", i); - Anope::string ext_header = config.ReadValue("httpd", "extforward_header", "", i); + Anope::string ip = reader.ReadValue("httpd", "ip", "", i); + int port = reader.ReadInteger("httpd", "port", "8080", i, true); + int timeout = reader.ReadInteger("httpd", "timeout", "30", i, true); + bool ssl = reader.ReadFlag("httpd", "ssl", "no", i); + Anope::string ext_ip = reader.ReadValue("httpd", "extforward_ip", "", i); + Anope::string ext_header = reader.ReadValue("httpd", "extforward_header", "", i); if (ip.empty()) { diff --git a/modules/extra/m_ldap.cpp b/modules/extra/m_ldap.cpp index 80a6b5a9e..3200d3e38 100644 --- a/modules/extra/m_ldap.cpp +++ b/modules/extra/m_ldap.cpp @@ -409,8 +409,6 @@ class ModuleLDAP : public Module, public Pipe Implementation i[] = { I_OnReload, I_OnModuleUnload }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); - - OnReload(); } ~ModuleLDAP() @@ -425,9 +423,8 @@ class ModuleLDAP : public Module, public Pipe LDAPServices.clear(); } - void OnReload() anope_override + void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override { - ConfigReader config; int i, num; for (std::map<Anope::string, LDAPService *>::iterator it = this->LDAPServices.begin(); it != this->LDAPServices.end();) @@ -436,9 +433,9 @@ class ModuleLDAP : public Module, public Pipe LDAPService *s = it->second; ++it; - for (i = 0, num = config.Enumerate("ldap"); i < num; ++i) + for (i = 0, num = reader.Enumerate("ldap"); i < num; ++i) { - if (config.ReadValue("ldap", "name", "main", i) == cname) + if (reader.ReadValue("ldap", "name", "main", i) == cname) { break; } @@ -454,16 +451,16 @@ class ModuleLDAP : public Module, public Pipe } } - for (i = 0, num = config.Enumerate("ldap"); i < num; ++i) + for (i = 0, num = reader.Enumerate("ldap"); i < num; ++i) { - Anope::string connname = config.ReadValue("ldap", "name", "main", i); + Anope::string connname = reader.ReadValue("ldap", "name", "main", i); if (this->LDAPServices.find(connname) == this->LDAPServices.end()) { - Anope::string server = config.ReadValue("ldap", "server", "127.0.0.1", i); - int port = config.ReadInteger("ldap", "port", "389", i, true); - Anope::string admin_binddn = config.ReadValue("ldap", "admin_binddn", "", i); - Anope::string admin_password = config.ReadValue("ldap", "admin_password", "", i); + Anope::string server = reader.ReadValue("ldap", "server", "127.0.0.1", i); + int port = reader.ReadInteger("ldap", "port", "389", i, true); + Anope::string admin_binddn = reader.ReadValue("ldap", "admin_binddn", "", i); + Anope::string admin_password = reader.ReadValue("ldap", "admin_password", "", i); try { diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp index cc5626cd3..f39bb43e8 100644 --- a/modules/extra/m_ldap_authentication.cpp +++ b/modules/extra/m_ldap_authentication.cpp @@ -224,22 +224,19 @@ class NSIdentifyLDAP : public Module Implementation i[] = { I_OnReload, I_OnPreCommand, I_OnCheckAuthentication, I_OnNickIdentify, I_OnNickRegister }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); ModuleManager::SetPriority(this, PRIORITY_FIRST); - - OnReload(); } - void OnReload() anope_override + void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override { - ConfigReader config; - - basedn = config.ReadValue("m_ldap_authentication", "basedn", "", 0); - search_filter = config.ReadValue("m_ldap_authentication", "search_filter", "", 0); - object_class = config.ReadValue("m_ldap_authentication", "object_class", "", 0); - username_attribute = config.ReadValue("m_ldap_authentication", "username_attribute", "", 0); - this->password_attribute = config.ReadValue("m_ldap_authentication", "password_attribute", "", 0); - email_attribute = config.ReadValue("m_ldap_authentication", "email_attribute", "", 0); - this->disable_register_reason = config.ReadValue("m_ldap_authentication", "disable_register_reason", "", 0); - this->disable_email_reason = config.ReadValue("m_ldap_authentication", "disable_email_reason", "", 0); + + basedn = reader.ReadValue("m_ldap_authentication", "basedn", "", 0); + search_filter = reader.ReadValue("m_ldap_authentication", "search_filter", "", 0); + object_class = reader.ReadValue("m_ldap_authentication", "object_class", "", 0); + username_attribute = reader.ReadValue("m_ldap_authentication", "username_attribute", "", 0); + this->password_attribute = reader.ReadValue("m_ldap_authentication", "password_attribute", "", 0); + email_attribute = reader.ReadValue("m_ldap_authentication", "email_attribute", "", 0); + this->disable_register_reason = reader.ReadValue("m_ldap_authentication", "disable_register_reason", "", 0); + this->disable_email_reason = reader.ReadValue("m_ldap_authentication", "disable_email_reason", "", 0); if (!email_attribute.empty()) /* Don't complain to users about how they need to update their email, we will do it for them */ diff --git a/modules/extra/m_ldap_oper.cpp b/modules/extra/m_ldap_oper.cpp index f44628c63..afe3fde48 100644 --- a/modules/extra/m_ldap_oper.cpp +++ b/modules/extra/m_ldap_oper.cpp @@ -91,19 +91,15 @@ class LDAPOper : public Module Implementation i[] = { I_OnReload, I_OnNickIdentify, I_OnDelCore }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); - - OnReload(); } - void OnReload() anope_override + void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override { - ConfigReader config; - - this->binddn = config.ReadValue("m_ldap_oper", "binddn", "", 0); - this->password = config.ReadValue("m_ldap_oper", "password", "", 0); - this->basedn = config.ReadValue("m_ldap_oper", "basedn", "", 0); - this->filter = config.ReadValue("m_ldap_oper", "filter", "", 0); - opertype_attribute = config.ReadValue("m_ldap_oper", "opertype_attribute", "", 0); + this->binddn = reader.ReadValue("m_ldap_oper", "binddn", "", 0); + this->password = reader.ReadValue("m_ldap_oper", "password", "", 0); + this->basedn = reader.ReadValue("m_ldap_oper", "basedn", "", 0); + this->filter = reader.ReadValue("m_ldap_oper", "filter", "", 0); + opertype_attribute = reader.ReadValue("m_ldap_oper", "opertype_attribute", "", 0); for (std::set<Oper *>::iterator it = my_opers.begin(), it_end = my_opers.end(); it != it_end; ++it) delete *it; diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp index 8eecb4a23..c41ba37a8 100644 --- a/modules/extra/m_mysql.cpp +++ b/modules/extra/m_mysql.cpp @@ -174,8 +174,6 @@ class ModuleSQL : public Module, public Pipe DThread = new DispatcherThread(); DThread->Start(); - - OnReload(); } ~ModuleSQL() @@ -190,9 +188,8 @@ class ModuleSQL : public Module, public Pipe delete DThread; } - void OnReload() anope_override + void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override { - ConfigReader config; int i, num; for (std::map<Anope::string, MySQLService *>::iterator it = this->MySQLServices.begin(); it != this->MySQLServices.end();) @@ -201,9 +198,9 @@ class ModuleSQL : public Module, public Pipe MySQLService *s = it->second; ++it; - for (i = 0, num = config.Enumerate("mysql"); i < num; ++i) + for (i = 0, num = reader.Enumerate("mysql"); i < num; ++i) { - if (config.ReadValue("mysql", "name", "main", i) == cname) + if (reader.ReadValue("mysql", "name", "main", i) == cname) { break; } @@ -218,17 +215,17 @@ class ModuleSQL : public Module, public Pipe } } - for (i = 0, num = config.Enumerate("mysql"); i < num; ++i) + for (i = 0, num = reader.Enumerate("mysql"); i < num; ++i) { - Anope::string connname = config.ReadValue("mysql", "name", "mysql/main", i); + Anope::string connname = reader.ReadValue("mysql", "name", "mysql/main", i); if (this->MySQLServices.find(connname) == this->MySQLServices.end()) { - Anope::string database = config.ReadValue("mysql", "database", "anope", i); - Anope::string server = config.ReadValue("mysql", "server", "127.0.0.1", i); - Anope::string user = config.ReadValue("mysql", "username", "anope", i); - Anope::string password = config.ReadValue("mysql", "password", "", i); - int port = config.ReadInteger("mysql", "port", "3306", i, true); + Anope::string database = reader.ReadValue("mysql", "database", "anope", i); + Anope::string server = reader.ReadValue("mysql", "server", "127.0.0.1", i); + Anope::string user = reader.ReadValue("mysql", "username", "anope", i); + Anope::string password = reader.ReadValue("mysql", "password", "", i); + int port = reader.ReadInteger("mysql", "port", "3306", i, true); try { diff --git a/modules/extra/m_proxyscan.cpp b/modules/extra/m_proxyscan.cpp index 78f42a910..9dd3f8884 100644 --- a/modules/extra/m_proxyscan.cpp +++ b/modules/extra/m_proxyscan.cpp @@ -229,15 +229,6 @@ class ModuleProxyScan : public Module ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); this->listener = NULL; - - try - { - OnReload(); - } - catch (const ConfigException &ex) - { - throw ModuleException(ex.GetReason()); - } } ~ModuleProxyScan() @@ -262,23 +253,21 @@ class ModuleProxyScan : public Module delete this->listener; } - void OnReload() anope_override + void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override { - ConfigReader config; - - Anope::string s_target_ip = config.ReadValue("m_proxyscan", "target_ip", "", 0); + Anope::string s_target_ip = reader.ReadValue("m_proxyscan", "target_ip", "", 0); if (s_target_ip.empty()) throw ConfigException("m_proxyscan:target_ip may not be empty"); - int s_target_port = config.ReadInteger("m_proxyscan", "target_port", "-1", 0, true); + int s_target_port = reader.ReadInteger("m_proxyscan", "target_port", "-1", 0, true); if (s_target_port <= 0) throw ConfigException("m_proxyscan:target_port may not be empty and must be a positive number"); - Anope::string s_listen_ip = config.ReadValue("m_proxyscan", "listen_ip", "", 0); + Anope::string s_listen_ip = reader.ReadValue("m_proxyscan", "listen_ip", "", 0); if (s_listen_ip.empty()) throw ConfigException("m_proxyscan:listen_ip may not be empty"); - int s_listen_port = config.ReadInteger("m_proxyscan", "listen_port", "-1", 0, true); + int s_listen_port = reader.ReadInteger("m_proxyscan", "listen_port", "-1", 0, true); if (s_listen_port <= 0) throw ConfigException("m_proxyscan:listen_port may not be empty and must be a positive number"); @@ -286,10 +275,10 @@ class ModuleProxyScan : public Module target_port = s_target_port; this->listen_ip = s_listen_ip; this->listen_port = s_listen_port; - this->con_notice = config.ReadValue("m_proxyscan", "connect_notice", "", 0); - this->con_source = config.ReadValue("m_proxyscan", "connect_source", "", 0); - add_to_akill = config.ReadFlag("m_proxyscan", "add_to_akill", "true", 0); - this->connectionTimeout.SetSecs(config.ReadInteger("m_proxyscan", "timeout", "5", 0, true)); + this->con_notice = reader.ReadValue("m_proxyscan", "connect_notice", "", 0); + this->con_source = reader.ReadValue("m_proxyscan", "connect_source", "", 0); + add_to_akill = reader.ReadFlag("m_proxyscan", "add_to_akill", "true", 0); + this->connectionTimeout.SetSecs(reader.ReadInteger("m_proxyscan", "timeout", "5", 0, true)); ProxyCheckString = Config->NetworkName + " proxy check"; delete this->listener; @@ -304,12 +293,12 @@ class ModuleProxyScan : public Module } this->proxyscans.clear(); - for (int i = 0; i < config.Enumerate("proxyscan"); ++i) + for (int i = 0; i < reader.Enumerate("proxyscan"); ++i) { ProxyCheck p; Anope::string token; - commasepstream sep(config.ReadValue("proxyscan", "type", "", i)); + commasepstream sep(reader.ReadValue("proxyscan", "type", "", i)); while (sep.GetToken(token)) { if (!token.equals_ci("HTTP") && !token.equals_ci("SOCKS5")) @@ -319,7 +308,7 @@ class ModuleProxyScan : public Module if (p.types.empty()) continue; - commasepstream sep2(config.ReadValue("proxyscan", "port", "", i)); + commasepstream sep2(reader.ReadValue("proxyscan", "port", "", i)); while (sep2.GetToken(token)) { try @@ -332,8 +321,8 @@ class ModuleProxyScan : public Module if (p.ports.empty()) continue; - p.duration = Anope::DoTime(config.ReadValue("proxyscan", "time", "4h", i)); - p.reason = config.ReadValue("proxyscan", "reason", "", i); + p.duration = Anope::DoTime(reader.ReadValue("proxyscan", "time", "4h", i)); + p.reason = reader.ReadValue("proxyscan", "reason", "", i); if (p.reason.empty()) continue; diff --git a/modules/extra/m_sql_authentication.cpp b/modules/extra/m_sql_authentication.cpp index 7fcdf4e13..027b0bbcc 100644 --- a/modules/extra/m_sql_authentication.cpp +++ b/modules/extra/m_sql_authentication.cpp @@ -85,17 +85,13 @@ class ModuleSQLAuthentication : public Module Implementation i[] = { I_OnReload, I_OnPreCommand, I_OnCheckAuthentication }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); - - this->OnReload(); } - void OnReload() anope_override + void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override { - ConfigReader config; - - this->engine = config.ReadValue("m_sql_authentication", "engine", "", 0); - this->query = config.ReadValue("m_sql_authentication", "query", "", 0); - this->disable_reason = config.ReadValue("m_sql_authentication", "disable_reason", "", 0); + this->engine = reader.ReadValue("m_sql_authentication", "engine", "", 0); + this->query = reader.ReadValue("m_sql_authentication", "query", "", 0); + this->disable_reason = reader.ReadValue("m_sql_authentication", "disable_reason", "", 0); this->SQL = ServiceReference<SQL::Provider>("SQL::Provider", this->engine); } diff --git a/modules/extra/m_sql_oper.cpp b/modules/extra/m_sql_oper.cpp index bbcd108c4..4f982e1d8 100644 --- a/modules/extra/m_sql_oper.cpp +++ b/modules/extra/m_sql_oper.cpp @@ -99,16 +99,12 @@ class ModuleSQLOper : public Module Implementation i[] = { I_OnReload, I_OnNickIdentify }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); - - this->OnReload(); } - void OnReload() anope_override + void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override { - ConfigReader config; - - this->engine = config.ReadValue("m_sql_oper", "engine", "", 0); - this->query = config.ReadValue("m_sql_oper", "query", "", 0); + this->engine = reader.ReadValue("m_sql_oper", "engine", "", 0); + this->query = reader.ReadValue("m_sql_oper", "query", "", 0); this->SQL = ServiceReference<SQL::Provider>("SQL::Provider", this->engine); } diff --git a/modules/extra/m_sqlite.cpp b/modules/extra/m_sqlite.cpp index 623e1e8b1..9626741a0 100644 --- a/modules/extra/m_sqlite.cpp +++ b/modules/extra/m_sqlite.cpp @@ -68,8 +68,6 @@ class ModuleSQLite : public Module { Implementation i[] = { I_OnReload }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); - - OnReload(); } ~ModuleSQLite() @@ -79,9 +77,8 @@ class ModuleSQLite : public Module SQLiteServices.clear(); } - void OnReload() anope_override + void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override { - ConfigReader config; int i, num; for (std::map<Anope::string, SQLiteService *>::iterator it = this->SQLiteServices.begin(); it != this->SQLiteServices.end();) @@ -90,8 +87,8 @@ class ModuleSQLite : public Module SQLiteService *s = it->second; ++it; - for (i = 0, num = config.Enumerate("sqlite"); i < num; ++i) - if (config.ReadValue("sqlite", "name", "sqlite/main", i) == cname) + for (i = 0, num = reader.Enumerate("sqlite"); i < num; ++i) + if (reader.ReadValue("sqlite", "name", "sqlite/main", i) == cname) break; if (i == num) @@ -103,13 +100,13 @@ class ModuleSQLite : public Module } } - for (i = 0, num = config.Enumerate("sqlite"); i < num; ++i) + for (i = 0, num = reader.Enumerate("sqlite"); i < num; ++i) { - Anope::string connname = config.ReadValue("sqlite", "name", "sqlite/main", i); + Anope::string connname = reader.ReadValue("sqlite", "name", "sqlite/main", i); if (this->SQLiteServices.find(connname) == this->SQLiteServices.end()) { - Anope::string database = Anope::DataDir + "/" + config.ReadValue("sqlite", "database", "anope", i); + Anope::string database = Anope::DataDir + "/" + reader.ReadValue("sqlite", "database", "anope", i); try { diff --git a/modules/extra/m_ssl.cpp b/modules/extra/m_ssl.cpp index 5ecf30cfc..c64e04af5 100644 --- a/modules/extra/m_ssl.cpp +++ b/modules/extra/m_ssl.cpp @@ -107,8 +107,6 @@ class SSLModule : public Module if (!client_ctx || !server_ctx) throw ModuleException("Error initializing SSL CTX"); - this->OnReload(); - if (Anope::IsFile(this->certfile.c_str())) { if (!SSL_CTX_use_certificate_file(client_ctx, this->certfile.c_str(), SSL_FILETYPE_PEM) || !SSL_CTX_use_certificate_file(server_ctx, this->certfile.c_str(), SSL_FILETYPE_PEM)) @@ -175,19 +173,17 @@ class SSLModule : public Module SSL_CTX_free(server_ctx); } - void OnReload() anope_override + void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override { - ConfigReader config; - - this->certfile = config.ReadValue("ssl", "cert", "data/anope.crt", 0); - this->keyfile = config.ReadValue("ssl", "key", "data/anope.key", 0); + this->certfile = reader.ReadValue("ssl", "cert", "data/anope.crt", 0); + this->keyfile = reader.ReadValue("ssl", "key", "data/anope.key", 0); } void OnPreServerConnect() anope_override { - ConfigReader config; + ConfigReader reader; - if (config.ReadFlag("uplink", "ssl", "no", Anope::CurrentUplink)) + if (reader.ReadFlag("uplink", "ssl", "no", Anope::CurrentUplink)) { this->service.Init(UplinkSock); } diff --git a/modules/extra/m_xmlrpc.cpp b/modules/extra/m_xmlrpc.cpp index 060001940..cac848c69 100644 --- a/modules/extra/m_xmlrpc.cpp +++ b/modules/extra/m_xmlrpc.cpp @@ -161,13 +161,11 @@ class ModuleXMLRPC : public Module public: MyXMLRPCServiceInterface xmlrpcinterface; - ModuleXMLRPC(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR), xmlrpcinterface(this, "xmlrpc") + ModuleXMLRPC(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR), + httpref("HTTPProvider", "httpd/main"), xmlrpcinterface(this, "xmlrpc") { - OnReload(); - if (!httpref) throw ModuleException("Unable to find http reference, is m_httpd loaded?"); - httpref->RegisterPage(&xmlrpcinterface); Implementation i[] = { I_OnReload }; @@ -179,12 +177,6 @@ class ModuleXMLRPC : public Module if (httpref) httpref->UnregisterPage(&xmlrpcinterface); } - - void OnReload() anope_override - { - ConfigReader config; - httpref = ServiceReference<HTTPProvider>("HTTPProvider", "httpd/main"); - } }; MODULE_INIT(ModuleXMLRPC) |
