mirror of
https://github.com/anope/anope.git
synced 2026-07-03 07:53:14 +02:00
Rework the interface for service references.
This commit is contained in:
@@ -134,7 +134,10 @@ class DatabaseRedis final
|
||||
public:
|
||||
ServiceReference<Provider> redis;
|
||||
|
||||
DatabaseRedis(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR), sl(this)
|
||||
DatabaseRedis(const Anope::string &modname, const Anope::string &creator)
|
||||
: Module(modname, creator, DATABASE | VENDOR)
|
||||
, sl(this)
|
||||
, redis("Redis::Provider")
|
||||
{
|
||||
me = this;
|
||||
|
||||
@@ -180,7 +183,7 @@ public:
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
const auto &block = conf.GetModule(this);
|
||||
this->redis = ServiceReference<Provider>("Redis::Provider", block.Get<const Anope::string>("engine", "redis/main"));
|
||||
this->redis.SetServiceName(block.Get<const Anope::string>("engine", "redis/main"));
|
||||
}
|
||||
|
||||
EventReturn OnLoadDatabase() override
|
||||
|
||||
@@ -102,10 +102,11 @@ class DBSQL final
|
||||
}
|
||||
|
||||
public:
|
||||
DBSQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR), sql("", ""), sqlinterface(this)
|
||||
DBSQL(const Anope::string &modname, const Anope::string &creator)
|
||||
: Module(modname, creator, DATABASE | VENDOR)
|
||||
, sql("SQL::Provider")
|
||||
, sqlinterface(this)
|
||||
{
|
||||
|
||||
|
||||
if (ModuleManager::FindModule("db_sql_live") != NULL)
|
||||
throw ModuleException("db_sql can not be loaded after db_sql_live");
|
||||
}
|
||||
@@ -166,7 +167,7 @@ public:
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
const auto &block = conf.GetModule(this);
|
||||
this->sql = ServiceReference<Provider>("SQL::Provider", block.Get<const Anope::string>("engine"));
|
||||
this->sql.SetServiceName(block.Get<const Anope::string>("engine"));
|
||||
this->prefix = block.Get<const Anope::string>("prefix", "anope_db_");
|
||||
this->import = block.Get<bool>("import");
|
||||
}
|
||||
|
||||
@@ -79,7 +79,9 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
DBMySQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR), SQL("", "")
|
||||
DBMySQL(const Anope::string &modname, const Anope::string &creator)
|
||||
: Module(modname, creator, DATABASE | VENDOR)
|
||||
, SQL("SQL::Provider")
|
||||
{
|
||||
this->lastwarn = 0;
|
||||
this->ro = false;
|
||||
@@ -148,7 +150,8 @@ public:
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
const auto &block = conf.GetModule(this);
|
||||
this->SQL = ServiceReference<Provider>("SQL::Provider", block.Get<const Anope::string>("engine"));
|
||||
|
||||
this->SQL.SetServiceName(block.Get<const Anope::string>("engine"));
|
||||
this->prefix = block.Get<const Anope::string>("prefix", "anope_db_");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user