summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-01-25 15:48:07 -0500
committerAdam <Adam@anope.org>2012-01-25 15:48:07 -0500
commit52eaa7d6d61e3373340fd5a69b92b0fb3b5609e0 (patch)
tree428f2b440ab5675ae3a9c19ae5b813f132497c79
parente88e37c59b45cc43b714d1d28719eb3c2ca9579a (diff)
Windows
-rw-r--r--include/access.h2
-rw-r--r--include/commands.h2
-rw-r--r--include/modules.h7
-rw-r--r--include/oper.h2
-rw-r--r--include/services.h43
-rw-r--r--modules/commands/bs_badwords.cpp10
-rw-r--r--modules/commands/cs_access.cpp2
-rw-r--r--modules/commands/cs_flags.cpp2
-rw-r--r--modules/commands/cs_log.cpp2
-rw-r--r--modules/commands/cs_saset.cpp2
-rw-r--r--modules/commands/cs_set.cpp2
-rw-r--r--modules/commands/cs_xop.cpp2
-rw-r--r--modules/commands/help.cpp4
-rw-r--r--modules/commands/ns_saset.cpp2
-rw-r--r--modules/commands/ns_set.cpp2
-rw-r--r--modules/commands/os_akill.cpp2
-rw-r--r--modules/commands/os_chankill.cpp2
-rw-r--r--modules/commands/os_defcon.cpp4
-rw-r--r--modules/commands/os_forbid.cpp48
-rw-r--r--modules/commands/os_forbid.h6
-rw-r--r--modules/commands/os_ignore.h6
-rw-r--r--modules/commands/os_modinfo.cpp4
-rw-r--r--modules/commands/os_news.cpp26
-rw-r--r--modules/commands/os_news.h6
-rw-r--r--modules/commands/os_oper.cpp6
-rw-r--r--modules/commands/os_session.cpp4
-rw-r--r--modules/commands/os_session.h6
-rw-r--r--modules/commands/os_stats.cpp2
-rw-r--r--modules/commands/os_sxline.cpp4
-rw-r--r--modules/database/db_old.cpp29
-rw-r--r--modules/database/db_plain.cpp4
-rw-r--r--modules/database/db_sql.cpp6
-rw-r--r--modules/database/db_sql_live_read.cpp6
-rw-r--r--modules/database/db_sql_live_write.cpp6
-rw-r--r--modules/extra/ldap.h4
-rw-r--r--modules/extra/m_dnsbl.cpp2
-rw-r--r--modules/extra/m_ldap.cpp4
-rw-r--r--modules/extra/m_ldap_authentication.cpp4
-rw-r--r--modules/extra/m_ldap_oper.cpp4
-rw-r--r--modules/extra/m_proxyscan.cpp2
-rw-r--r--modules/extra/m_xmlrpc.cpp4
-rw-r--r--modules/extra/m_xmlrpc_main.cpp4
-rw-r--r--modules/extra/sql.h4
-rw-r--r--modules/extra/ssl.h4
-rw-r--r--modules/extra/xmlrpc.h4
-rw-r--r--modules/pseudoclients/global.h6
-rw-r--r--modules/pseudoclients/memoserv.h6
-rw-r--r--modules/pseudoclients/nickserv.h6
-rw-r--r--src/access.cpp4
-rw-r--r--src/base.cpp2
-rw-r--r--src/bots.cpp2
-rw-r--r--src/command.cpp2
-rw-r--r--src/operserv.cpp4
53 files changed, 175 insertions, 160 deletions
diff --git a/include/access.h b/include/access.h
index 8f36b68d0..8b380895d 100644
--- a/include/access.h
+++ b/include/access.h
@@ -30,7 +30,7 @@ class CoreExport PrivilegeManager
class ChanAccess;
-class CoreExport AccessProvider : public Service<AccessProvider>
+class CoreExport AccessProvider : public Service
{
public:
AccessProvider(Module *o, const Anope::string &n);
diff --git a/include/commands.h b/include/commands.h
index d73e20017..c0812620f 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -58,7 +58,7 @@ struct CoreExport CommandSource
/** Every services command is a class, inheriting from Command.
*/
-class CoreExport Command : public Service<Command>, public Flags<CommandFlag>
+class CoreExport Command : public Service, public Flags<CommandFlag>
{
Anope::string desc;
std::vector<Anope::string> syntax;
diff --git a/include/modules.h b/include/modules.h
index c4a6c8f62..d251be353 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -1123,13 +1123,14 @@ class CallBack : public Timer
}
};
-template<typename T, typename U = T>
+template<typename T>
class service_reference : public dynamic_reference<T>
{
+ Anope::string type;
Anope::string name;
public:
- service_reference(const Anope::string &n) : dynamic_reference<T>(NULL), name(n)
+ service_reference(const Anope::string &t, const Anope::string &n) : dynamic_reference<T>(NULL), type(t), name(n)
{
}
@@ -1147,7 +1148,7 @@ class service_reference : public dynamic_reference<T>
}
if (!this->ref)
{
- this->ref = static_cast<T *>(Service<U>::FindService(this->name));
+ this->ref = static_cast<T *>(Service::FindService(this->type, this->name));
if (this->ref)
this->ref->AddReference(this);
}
diff --git a/include/oper.h b/include/oper.h
index 8eb1719bf..1a82a8530 100644
--- a/include/oper.h
+++ b/include/oper.h
@@ -36,7 +36,7 @@ class CoreExport XLine : public Serializable
static void unserialize(serialized_data &data);
};
-class CoreExport XLineManager : public Service<XLineManager>
+class CoreExport XLineManager : public Service
{
char type;
/* List of XLines in this XLineManager */
diff --git a/include/services.h b/include/services.h
index cd15fed68..37b8df1ad 100644
--- a/include/services.h
+++ b/include/services.h
@@ -306,30 +306,38 @@ template<typename T, size_t Size = 32> class Flags
class Module;
-template<typename T> class Service : public Base
+class CoreExport Service : public Base
{
- static Anope::map<T *> services;
+ static Anope::map<Anope::map<Service *> > services;
public:
- static T* FindService(const Anope::string &n)
+ static Service *FindService(const Anope::string &t, const Anope::string &n)
{
- typename Anope::map<T *>::iterator it = Service<T>::services.find(n);
- if (it != Service<T>::services.end())
- return it->second;
+ Anope::map<Anope::map<Service *> >::iterator it = services.find(t);
+ if (it != services.end())
+ {
+ Anope::map<Service *>::iterator it2 = it->second.find(n);
+ if (it2 != it->second.end())
+ return it2->second;
+ }
+
return NULL;
}
- static std::vector<Anope::string> GetServiceKeys()
+ static std::vector<Anope::string> GetServiceKeys(const Anope::string &t)
{
std::vector<Anope::string> keys;
- for (typename Anope::map<T *>::iterator it = Service<T>::services.begin(), it_end = Service<T>::services.end(); it != it_end; ++it)
- keys.push_back(it->first);
+ Anope::map<Anope::map<Service *> >::iterator it = services.find(t);
+ if (it != services.end())
+ for (Anope::map<Service *>::iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2)
+ keys.push_back(it2->first);
return keys;
}
Module *owner;
+ Anope::string type;
Anope::string name;
- Service(Module *o, const Anope::string &n) : owner(o), name(n)
+ Service(Module *o, const Anope::string &t, const Anope::string &n) : owner(o), type(t), name(n)
{
this->Register();
}
@@ -341,19 +349,20 @@ template<typename T> class Service : public Base
void Register()
{
- if (Service<T>::services.find(this->name) != Service<T>::services.end())
- throw ModuleException("Service with name " + this->name + " already exists");
- Service<T>::services[this->name] = static_cast<T *>(this);
+ Anope::map<Service *> &smap = services[this->type];
+ if (smap.find(this->name) != smap.end())
+ throw ModuleException("Service " + this->type + " with name " + this->name + " already exists");
+ smap[this->name] = this;
}
void Unregister()
{
- Service<T>::services.erase(this->name);
+ Anope::map<Service *> &smap = services[this->type];
+ smap.erase(this->name);
+ if (smap.empty())
+ services.erase(this->type);
}
};
-template<typename T> Anope::map<T *> Service<T>::services;
-
-template class Service<Base>;
#include "sockets.h"
#include "socketengine.h"
diff --git a/modules/commands/bs_badwords.cpp b/modules/commands/bs_badwords.cpp
index 8b92377c7..a700fa6c9 100644
--- a/modules/commands/bs_badwords.cpp
+++ b/modules/commands/bs_badwords.cpp
@@ -128,7 +128,7 @@ class CommandBSBadwords : public Command
void DoAdd(CommandSource &source, ChannelInfo *ci, const Anope::string &word)
{
size_t pos = word.rfind(' ');
- BadWordType type = BW_ANY;
+ BadWordType bwtype = BW_ANY;
Anope::string realword = word;
if (pos != Anope::string::npos)
@@ -137,11 +137,11 @@ class CommandBSBadwords : public Command
if (!opt.empty())
{
if (opt.equals_ci("SINGLE"))
- type = BW_SINGLE;
+ bwtype = BW_SINGLE;
else if (opt.equals_ci("START"))
- type = BW_START;
+ bwtype = BW_START;
else if (opt.equals_ci("END"))
- type = BW_END;
+ bwtype = BW_END;
}
realword = word.substr(0, pos);
}
@@ -165,7 +165,7 @@ class CommandBSBadwords : public Command
bool override = !ci->AccessFor(source.u).HasPriv("BADWORDS");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, this, ci) << "ADD " << realword;
- ci->AddBadWord(realword, type);
+ ci->AddBadWord(realword, bwtype);
source.Reply(_("\002%s\002 added to %s bad words list."), realword.c_str(), ci->name.c_str());
diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp
index ae1a848c9..3c36fabbd 100644
--- a/modules/commands/cs_access.cpp
+++ b/modules/commands/cs_access.cpp
@@ -148,7 +148,7 @@ class CommandCSAccess : public Command
return;
}
- service_reference<AccessProvider> provider("access/access");
+ service_reference<AccessProvider> provider("AccessProvider", "access/access");
if (!provider)
return;
AccessChanAccess *access = debug_cast<AccessChanAccess *>(provider->Create());
diff --git a/modules/commands/cs_flags.cpp b/modules/commands/cs_flags.cpp
index 811730e27..0e48f59c7 100644
--- a/modules/commands/cs_flags.cpp
+++ b/modules/commands/cs_flags.cpp
@@ -184,7 +184,7 @@ class CommandCSFlags : public Command
return;
}
- service_reference<AccessProvider> provider("access/flags");
+ service_reference<AccessProvider> provider("AccessProvider", "access/flags");
if (!provider)
return;
FlagsChanAccess *access = debug_cast<FlagsChanAccess *>(provider->Create());
diff --git a/modules/commands/cs_log.cpp b/modules/commands/cs_log.cpp
index a94608b4c..35f8831e6 100644
--- a/modules/commands/cs_log.cpp
+++ b/modules/commands/cs_log.cpp
@@ -88,7 +88,7 @@ public:
return;
}
- service_reference<Command> c_service(bi->commands[command_name].name);
+ service_reference<Command> c_service("Command", bi->commands[command_name].name);
if (!c_service)
{
source.Reply(_("%s is not a valid command."), command.c_str());
diff --git a/modules/commands/cs_saset.cpp b/modules/commands/cs_saset.cpp
index ad0df3d76..3290e7cc3 100644
--- a/modules/commands/cs_saset.cpp
+++ b/modules/commands/cs_saset.cpp
@@ -43,7 +43,7 @@ class CommandCSSASet : public Command
CommandInfo &info = it->second;
if (c_name.find_ci(this_name + " ") == 0)
{
- service_reference<Command> command(info.name);
+ service_reference<Command> command("Command", info.name);
if (command)
{
source.command = it->first;
diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp
index e76164332..9a63c8335 100644
--- a/modules/commands/cs_set.cpp
+++ b/modules/commands/cs_set.cpp
@@ -43,7 +43,7 @@ class CommandCSSet : public Command
CommandInfo &info = it->second;
if (c_name.find_ci(this_name + " ") == 0)
{
- service_reference<Command> command(info.name);
+ service_reference<Command> command("Command", info.name);
if (command)
{
source.command = it->first;
diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp
index 58fd99ba2..39789bf89 100644
--- a/modules/commands/cs_xop.cpp
+++ b/modules/commands/cs_xop.cpp
@@ -251,7 +251,7 @@ class XOPBase : public Command
return;
}
- service_reference<AccessProvider> provider("access/xop");
+ service_reference<AccessProvider> provider("AccessProvider", "access/xop");
if (!provider)
return;
XOPChanAccess *acc = debug_cast<XOPChanAccess *>(provider->Create());
diff --git a/modules/commands/help.cpp b/modules/commands/help.cpp
index dc0c3864d..a7356c0d0 100644
--- a/modules/commands/help.cpp
+++ b/modules/commands/help.cpp
@@ -45,7 +45,7 @@ class CommandHelp : public Command
if (cmd != it->first && bi->commands.count(cmd))
continue;
- service_reference<Command> c(info.name);
+ service_reference<Command> c("Command", info.name);
if (!c)
continue;
if (!Config->HidePrivilegedCommands || info.permission.empty() || u->HasCommand(info.permission))
@@ -71,7 +71,7 @@ class CommandHelp : public Command
CommandInfo &info = it->second;
- service_reference<Command> c(info.name);
+ service_reference<Command> c("Command", info.name);
if (!c)
continue;
diff --git a/modules/commands/ns_saset.cpp b/modules/commands/ns_saset.cpp
index 0afd08c15..793c8c670 100644
--- a/modules/commands/ns_saset.cpp
+++ b/modules/commands/ns_saset.cpp
@@ -40,7 +40,7 @@ class CommandNSSASet : public Command
if (c_name.find_ci(this_name + " ") == 0)
{
- service_reference<Command> command(info.name);
+ service_reference<Command> command("Command", info.name);
if (command)
{
source.command = c_name;
diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp
index 4f5d6e5b5..b52bec52a 100644
--- a/modules/commands/ns_set.cpp
+++ b/modules/commands/ns_set.cpp
@@ -41,7 +41,7 @@ class CommandNSSet : public Command
if (c_name.find_ci(this_name + " ") == 0)
{
- service_reference<Command> command(info.name);
+ service_reference<Command> command("Command", info.name);
if (command)
{
source.command = c_name;
diff --git a/modules/commands/os_akill.cpp b/modules/commands/os_akill.cpp
index db303a2f3..c34e932b0 100644
--- a/modules/commands/os_akill.cpp
+++ b/modules/commands/os_akill.cpp
@@ -13,7 +13,7 @@
#include "module.h"
-static service_reference<XLineManager> akills("xlinemanager/sgline");
+static service_reference<XLineManager> akills("XLineManager", "xlinemanager/sgline");
class AkillDelCallback : public NumberList
{
diff --git a/modules/commands/os_chankill.cpp b/modules/commands/os_chankill.cpp
index 19b202f6d..43ac0b3ee 100644
--- a/modules/commands/os_chankill.cpp
+++ b/modules/commands/os_chankill.cpp
@@ -13,7 +13,7 @@
#include "module.h"
-static service_reference<XLineManager> akills("xlinemanager/sgline");
+static service_reference<XLineManager> akills("XLineManager", "xlinemanager/sgline");
class CommandOSChanKill : public Command
{
diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp
index 2905b07bf..7e40a5c02 100644
--- a/modules/commands/os_defcon.cpp
+++ b/modules/commands/os_defcon.cpp
@@ -243,7 +243,7 @@ class CommandOSDefcon : public Command
class OSDefcon : public Module
{
- service_reference<SessionService, Base> session_service;
+ service_reference<SessionService> session_service;
service_reference<XLineManager> akills;
CommandOSDefcon commandosdefcon;
@@ -335,7 +335,7 @@ class OSDefcon : public Module
}
public:
- OSDefcon(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), session_service("session"), akills("xlinemanager/sgline"), commandosdefcon(this)
+ OSDefcon(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), session_service("SessionService", "session"), akills("XLineManager", "xlinemanager/sgline"), commandosdefcon(this)
{
this->SetAuthor("Anope");
diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp
index b5d9876fb..a60b362db 100644
--- a/modules/commands/os_forbid.cpp
+++ b/modules/commands/os_forbid.cpp
@@ -34,14 +34,14 @@ class MyForbidService : public ForbidService
delete d;
}
- ForbidData *FindForbid(const Anope::string &mask, ForbidType type)
+ ForbidData *FindForbid(const Anope::string &mask, ForbidType ftype)
{
const std::vector<ForbidData *> &forbids = this->GetForbids();
for (unsigned i = forbids.size(); i > 0; --i)
{
ForbidData *d = this->forbidData[i - 1];
- if ((type == FT_NONE || type == d->type) && Anope::Match(mask, d->mask))
+ if ((ftype == FT_NONE || ftype == d->type) && Anope::Match(mask, d->mask))
return d;
}
return NULL;
@@ -55,15 +55,15 @@ class MyForbidService : public ForbidService
if (d->expires && Anope::CurTime >= d->expires)
{
- Anope::string type = "none";
+ Anope::string ftype = "none";
if (d->type == FT_NICK)
- type = "nick";
+ ftype = "nick";
else if (d->type == FT_CHAN)
- type = "chan";
+ ftype = "chan";
else if (d->type == FT_EMAIL)
- type = "email";
+ ftype = "email";
- Log(LOG_NORMAL, Config->OperServ + "/forbid") << "Expiring forbid for " << d->mask << " type " << type;
+ Log(LOG_NORMAL, Config->OperServ + "/forbid") << "Expiring forbid for " << d->mask << " type " << ftype;
this->forbidData.erase(this->forbidData.begin() + i - 1);
delete d;
}
@@ -75,9 +75,9 @@ class MyForbidService : public ForbidService
class CommandOSForbid : public Command
{
- service_reference<ForbidService, Base> fs;
+ service_reference<ForbidService> fs;
public:
- CommandOSForbid(Module *creator) : Command(creator, "operserv/forbid", 1, 5), fs("forbid")
+ CommandOSForbid(Module *creator) : Command(creator, "operserv/forbid", 1, 5), fs("ForbidService", "forbid")
{
this->SetDesc(_("Forbid usage of nicknames, channels, and emails"));
this->SetSyntax(_("ADD {NICK|CHAN|EMAIL} [+\037expiry\037] \037entry\037\002 [\037reason\037]"));
@@ -93,15 +93,15 @@ class CommandOSForbid : public Command
const Anope::string &command = params[0];
const Anope::string &subcommand = params.size() > 1 ? params[1] : "";
- ForbidType type = FT_NONE;
+ ForbidType ftype = FT_NONE;
if (subcommand.equals_ci("NICK"))
- type = FT_NICK;
+ ftype = FT_NICK;
else if (subcommand.equals_ci("CHAN"))
- type = FT_CHAN;
+ ftype = FT_CHAN;
else if (subcommand.equals_ci("EMAIL"))
- type = FT_EMAIL;
+ ftype = FT_EMAIL;
- if (command.equals_ci("ADD") && params.size() > 3 && type != FT_NONE)
+ if (command.equals_ci("ADD") && params.size() > 3 && ftype != FT_NONE)
{
const Anope::string &expiry = params[2][0] == '+' ? params[2] : "";
const Anope::string &entry = !expiry.empty() ? params[3] : params[2];
@@ -127,7 +127,7 @@ class CommandOSForbid : public Command
expiryt += Anope::CurTime;
}
- ForbidData *d = this->fs->FindForbid(entry, type);
+ ForbidData *d = this->fs->FindForbid(entry, ftype);
bool created = false;
if (d == NULL)
{
@@ -140,18 +140,18 @@ class CommandOSForbid : public Command
d->reason = reason;
d->created = Anope::CurTime;
d->expires = expiryt;
- d->type = type;
+ d->type = ftype;
if (created)
this->fs->AddForbid(d);
Log(LOG_ADMIN, source.u, this) << "to add a forbid on " << entry << " of type " << subcommand;
- source.Reply(_("Added a%s forbid on %s to expire on %s"), type == FT_CHAN ? "n" : "", entry.c_str(), d->expires ? do_strftime(d->expires).c_str() : "never");
+ source.Reply(_("Added a%s forbid on %s to expire on %s"), ftype == FT_CHAN ? "n" : "", entry.c_str(), d->expires ? do_strftime(d->expires).c_str() : "never");
}
- else if (command.equals_ci("DEL") && params.size() > 2 && type != FT_NONE)
+ else if (command.equals_ci("DEL") && params.size() > 2 && ftype != FT_NONE)
{
const Anope::string &entry = params[2];
- ForbidData *d = this->fs->FindForbid(entry, type);
+ ForbidData *d = this->fs->FindForbid(entry, ftype);
if (d != NULL)
{
Log(LOG_ADMIN, source.u, this) << "to remove forbid " << d->mask << " of type " << subcommand;
@@ -175,19 +175,19 @@ class CommandOSForbid : public Command
{
ForbidData *d = forbids[i];
- Anope::string ftype;
+ Anope::string stype;
if (d->type == FT_NICK)
- ftype = "NICK";
+ stype = "NICK";
else if (d->type == FT_CHAN)
- ftype = "CHAN";
+ stype = "CHAN";
else if (d->type == FT_EMAIL)
- ftype = "EMAIL";
+ stype = "EMAIL";
else
continue;
ListFormatter::ListEntry entry;
entry["Mask"] = d->mask;
- entry["Type"] = ftype;
+ entry["Type"] = stype;
entry["Creator"] = d->creator;
entry["Expires"] = d->expires ? do_strftime(d->expires).c_str() : "never";
entry["Reason"] = d->reason;
diff --git a/modules/commands/os_forbid.h b/modules/commands/os_forbid.h
index 1ccb36e91..98e5fdc81 100644
--- a/modules/commands/os_forbid.h
+++ b/modules/commands/os_forbid.h
@@ -23,10 +23,10 @@ struct ForbidData : Serializable
static void unserialize(serialized_data &data);
};
-class ForbidService : public Service<Base>
+class ForbidService : public Service
{
public:
- ForbidService(Module *m) : Service<Base>(m, "forbid") { }
+ ForbidService(Module *m) : Service(m, "ForbidService", "forbid") { }
virtual void AddForbid(ForbidData *d) = 0;
@@ -37,7 +37,7 @@ class ForbidService : public Service<Base>
virtual const std::vector<ForbidData *> &GetForbids() = 0;
};
-static service_reference<ForbidService, Base> forbid_service("forbid");
+static service_reference<ForbidService> forbid_service("ForbidService", "forbid");
Serializable::serialized_data ForbidData::serialize()
{
diff --git a/modules/commands/os_ignore.h b/modules/commands/os_ignore.h
index d59ab6a5f..4a47c947f 100644
--- a/modules/commands/os_ignore.h
+++ b/modules/commands/os_ignore.h
@@ -22,12 +22,12 @@ struct IgnoreData : Serializable
static void unserialize(serialized_data &data);
};
-class IgnoreService : public Service<Base>
+class IgnoreService : public Service
{
protected:
std::list<IgnoreData> ignores;
- IgnoreService(Module *c) : Service<Base>(c, "ignore") { }
+ IgnoreService(Module *c) : Service(c, "IgnoreService", "ignore") { }
public:
virtual void AddIgnore(const Anope::string &mask, const Anope::string &creator, const Anope::string &reason, time_t delta = Anope::CurTime) = 0;
@@ -41,7 +41,7 @@ class IgnoreService : public Service<Base>
inline std::list<IgnoreData> &GetIgnores() { return this->ignores; }
};
-static service_reference<IgnoreService, Base> ignore_service("ignore");
+static service_reference<IgnoreService> ignore_service("IgnoreService", "ignore");
Serializable::serialized_data IgnoreData::serialize()
{
diff --git a/modules/commands/os_modinfo.cpp b/modules/commands/os_modinfo.cpp
index 0fd0ff5bd..75859a762 100644
--- a/modules/commands/os_modinfo.cpp
+++ b/modules/commands/os_modinfo.cpp
@@ -31,10 +31,10 @@ class CommandOSModInfo : public Command
{
source.Reply(_("Module: \002%s\002 Version: \002%s\002 Author: \002%s\002 loaded: \002%s\002"), m->name.c_str(), !m->version.empty() ? m->version.c_str() : "?", !m->author.empty() ? m->author.c_str() : "?", do_strftime(m->created).c_str());
- std::vector<Anope::string> servicekeys = Service<Command>::GetServiceKeys();
+ std::vector<Anope::string> servicekeys = Service::GetServiceKeys("Command");
for (unsigned i = 0; i < servicekeys.size(); ++i)
{
- Command *c = Service<Command>::FindService(servicekeys[i]);
+ service_reference<Command> c("Command", servicekeys[i]);
if (!c || c->owner != m)
continue;
diff --git a/modules/commands/os_news.cpp b/modules/commands/os_news.cpp
index 466f583b0..1f96337cd 100644
--- a/modules/commands/os_news.cpp
+++ b/modules/commands/os_news.cpp
@@ -106,12 +106,12 @@ static const char **findmsgs(NewsType type)
class NewsBase : public Command
{
- service_reference<NewsService, Base> ns;
+ service_reference<NewsService> ns;
protected:
- void DoList(CommandSource &source, NewsType type, const char **msgs)
+ void DoList(CommandSource &source, NewsType ntype, const char **msgs)
{
- std::vector<NewsItem *> &list = this->ns->GetNewsList(type);
+ std::vector<NewsItem *> &list = this->ns->GetNewsList(ntype);
if (list.empty())
source.Reply(msgs[MSG_LIST_NONE]);
else
@@ -143,7 +143,7 @@ class NewsBase : public Command
return;
}
- void DoAdd(CommandSource &source, const std::vector<Anope::string> &params, NewsType type, const char **msgs)
+ void DoAdd(CommandSource &source, const std::vector<Anope::string> &params, NewsType ntype, const char **msgs)
{
const Anope::string text = params.size() > 1 ? params[1] : "";
@@ -155,7 +155,7 @@ class NewsBase : public Command
source.Reply(READ_ONLY_MODE);
NewsItem *news = new NewsItem();
- news->type = type;
+ news->type = ntype;
news->text = text;
news->time = Anope::CurTime;
news->who = source.u->nick;
@@ -168,7 +168,7 @@ class NewsBase : public Command
return;
}
- void DoDel(CommandSource &source, const std::vector<Anope::string> &params, NewsType type, const char **msgs)
+ void DoDel(CommandSource &source, const std::vector<Anope::string> &params, NewsType ntype, const char **msgs)
{
const Anope::string &text = params.size() > 1 ? params[1] : "";
@@ -176,7 +176,7 @@ class NewsBase : public Command
this->OnSyntaxError(source, "DEL");
else
{
- std::vector<NewsItem *> &list = this->ns->GetNewsList(type);
+ std::vector<NewsItem *> &list = this->ns->GetNewsList(ntype);
if (list.empty())
source.Reply(msgs[MSG_LIST_NONE]);
else
@@ -211,30 +211,30 @@ class NewsBase : public Command
return;
}
- void DoNews(CommandSource &source, const std::vector<Anope::string> &params, NewsType type)
+ void DoNews(CommandSource &source, const std::vector<Anope::string> &params, NewsType ntype)
{
if (!this->ns)
return;
const Anope::string &cmd = params[0];
- const char **msgs = findmsgs(type);
+ const char **msgs = findmsgs(ntype);
if (!msgs)
throw CoreException("news: Invalid type to do_news()");
if (cmd.equals_ci("LIST"))
- return this->DoList(source, type, msgs);
+ return this->DoList(source, ntype, msgs);
else if (cmd.equals_ci("ADD"))
- return this->DoAdd(source, params, type, msgs);
+ return this->DoAdd(source, params, ntype, msgs);
else if (cmd.equals_ci("DEL"))
- return this->DoDel(source, params, type, msgs);
+ return this->DoDel(source, params, ntype, msgs);
else
this->OnSyntaxError(source, "");
return;
}
public:
- NewsBase(Module *creator, const Anope::string &newstype) : Command(creator, newstype, 1, 2), ns("news")
+ NewsBase(Module *creator, const Anope::string &newstype) : Command(creator, newstype, 1, 2), ns("NewsService", "news")
{
this->SetSyntax(_("ADD \037text\037"));
this->SetSyntax(_("DEL {\037num\037 | ALL}"));
diff --git a/modules/commands/os_news.h b/modules/commands/os_news.h
index 02e2c8147..7bc36d987 100644
--- a/modules/commands/os_news.h
+++ b/modules/commands/os_news.h
@@ -27,10 +27,10 @@ struct NewsItem : Serializable
static void unserialize(serialized_data &data);
};
-class NewsService : public Service<Base>
+class NewsService : public Service
{
public:
- NewsService(Module *m) : Service<Base>(m, "news") { }
+ NewsService(Module *m) : Service(m, "NewsService", "news") { }
virtual void AddNewsItem(NewsItem *n) = 0;
@@ -39,7 +39,7 @@ class NewsService : public Service<Base>
virtual std::vector<NewsItem *> &GetNewsList(NewsType t) = 0;
};
-static service_reference<NewsService, Base> news_service("news");
+static service_reference<NewsService> news_service("NewsService", "news");
Serializable::serialized_data NewsItem::serialize()
{
diff --git a/modules/commands/os_oper.cpp b/modules/commands/os_oper.cpp
index 0a245928c..6b5ebc0ed 100644
--- a/modules/commands/os_oper.cpp
+++ b/modules/commands/os_oper.cpp
@@ -65,7 +65,7 @@ class CommandOSOper : public Command
if (subcommand.equals_ci("ADD") && params.size() > 2)
{
const Anope::string &oper = params[1];
- const Anope::string &type = params[2];
+ const Anope::string &otype = params[2];
NickAlias *na = findnick(oper);
if (na == NULL)
@@ -74,9 +74,9 @@ class CommandOSOper : public Command
source.Reply(_("Nick \2%s\2 is already an operator."), na->nick.c_str());
else
{
- OperType *ot = OperType::Find(type);
+ OperType *ot = OperType::Find(otype);
if (ot == NULL)
- source.Reply(_("Oper type \2%s\2 has not been configured."), type.c_str());
+ source.Reply(_("Oper type \2%s\2 has not been configured."), otype.c_str());
else
{
na->nc->o = new MyOper(na->nc->display, ot);
diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp
index 1e48baf5d..c35be7b09 100644
--- a/modules/commands/os_session.cpp
+++ b/modules/commands/os_session.cpp
@@ -605,7 +605,7 @@ class OSSession : public Module
ExpireTimer expiretimer;
CommandOSSession commandossession;
CommandOSException commandosexception;
- service_reference<XLineManager, Base> akills;
+ service_reference<XLineManager> akills;
void AddSession(User *u, bool exempt)
{
@@ -693,7 +693,7 @@ class OSSession : public Module
public:
OSSession(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- exception_type("Exception", Exception::unserialize), ss(this), commandossession(this), commandosexception(this), akills("xlinemanager/sgline")
+ exception_type("Exception", Exception::unserialize), ss(this), commandossession(this), commandosexception(this), akills("XLineManager", "xlinemanager/sgline")
{
this->SetAuthor("Anope");
diff --git a/modules/commands/os_session.h b/modules/commands/os_session.h
index 898c40fa5..67927410d 100644
--- a/modules/commands/os_session.h
+++ b/modules/commands/os_session.h
@@ -16,13 +16,13 @@ struct Exception : Serializable
};
-class SessionService : public Service<Base>
+class SessionService : public Service
{
public:
typedef Anope::map<Session *> SessionMap;
typedef std::vector<Exception *> ExceptionVector;
- SessionService(Module *m) : Service<Base>(m, "session") { }
+ SessionService(Module *m) : Service(m, "SessionService", "session") { }
virtual void AddException(Exception *e) = 0;
@@ -43,7 +43,7 @@ class SessionService : public Service<Base>
virtual SessionMap &GetSessions() = 0;
};
-static service_reference<SessionService, Base> session_service("session");
+static service_reference<SessionService> session_service("SessionService", "session");
Serializable::serialized_data Exception::serialize()
{
diff --git a/modules/commands/os_stats.cpp b/modules/commands/os_stats.cpp
index ef5436ba4..994b330ab 100644
--- a/modules/commands/os_stats.cpp
+++ b/modules/commands/os_stats.cpp
@@ -135,7 +135,7 @@ class CommandOSStats : public Command
public:
CommandOSStats(Module *creator) : Command(creator, "operserv/stats", 0, 1),
- akills("xlinemanager/sgline"), snlines("xlinemanager/snline"), sqlines("xlinemanager/sqline")
+ akills("XLineManager", "xlinemanager/sgline"), snlines("XLineManager", "xlinemanager/snline"), sqlines("XLineManager", "xlinemanager/sqline")
{
this->SetDesc(_("Show status of Services and network"));
this->SetSyntax(_("[AKILL | ALL | RESET | UPLINK]"));
diff --git a/modules/commands/os_sxline.cpp b/modules/commands/os_sxline.cpp
index 90c218e1b..db2cad0e7 100644
--- a/modules/commands/os_sxline.cpp
+++ b/modules/commands/os_sxline.cpp
@@ -390,7 +390,7 @@ class CommandOSSNLine : public CommandOSSXLineBase
service_reference<XLineManager> snlines;
public:
- CommandOSSNLine(Module *creator) : CommandOSSXLineBase(creator, "operserv/snline"), snlines("xlinemanager/snline")
+ CommandOSSNLine(Module *creator) : CommandOSSXLineBase(creator, "operserv/snline"), snlines("XLineManager", "xlinemanager/snline")
{
this->SetSyntax(_("ADD [+\037expiry\037] \037mask\037:\037reason\037"));
this->SetSyntax(_("DEL {\037mask\037 | \037entry-num\037 | \037list\037 | \037id\037}"));
@@ -589,7 +589,7 @@ class CommandOSSQLine : public CommandOSSXLineBase
service_reference<XLineManager> sqlines;
public:
- CommandOSSQLine(Module *creator) : CommandOSSXLineBase(creator, "operserv/sqline"), sqlines("xlinemanager/sqline")
+ CommandOSSQLine(Module *creator) : CommandOSSXLineBase(creator, "operserv/sqline"), sqlines("XLineManager", "xlinemanager/sqline")
{
this->SetSyntax(_("ADD [+\037expiry\037] \037mask\037 \037reason\037"));
this->SetSyntax(_("DEL {\037mask\037 | \037entry-num\037 | \037list\037 | \037id\037}"));
diff --git a/modules/database/db_old.cpp b/modules/database/db_old.cpp
index 61a8bc1b2..e7a6fa390 100644
--- a/modules/database/db_old.cpp
+++ b/modules/database/db_old.cpp
@@ -723,6 +723,7 @@ static void LoadChannels()
ci->SetLevel(GetLevelName(j), level);
}
+ service_reference<AccessProvider> provider("AccessProvider", "access/access");
uint16_t tmpu16;
READ(read_uint16(&tmpu16, f));
for (uint16_t j = 0; j < tmpu16; ++j)
@@ -731,27 +732,29 @@ static void LoadChannels()
READ(read_uint16(&in_use, f));
if (in_use)
{
- service_reference<AccessProvider> provider("access/access");
- if (!provider)
- break;
-
- ChanAccess *access = provider->Create();
- access->ci = ci;
+ ChanAccess *access = provider ? provider->Create() : NULL;
+ if (access)
+ access->ci = ci;
int16_t level;
READ(read_int16(&level, f));
- access->Unserialize(stringify(level));
+ if (access)
+ access->Unserialize(stringify(level));
Anope::string mask;
READ(read_string(mask, f));
- access->mask = mask;
+ if (access)
+ access->mask = mask;
READ(read_int32(&tmp32, f));
- access->last_seen = tmp32;
- access->creator = "Unknown";
- access->created = Anope::CurTime;
-
- ci->AddAccess(access);
+ if (access)
+ {
+ access->last_seen = tmp32;
+ access->creator = "Unknown";
+ access->created = Anope::CurTime;
+
+ ci->AddAccess(access);
+ }
}
}
diff --git a/modules/database/db_plain.cpp b/modules/database/db_plain.cpp
index a0f52c550..7c7721f7c 100644
--- a/modules/database/db_plain.cpp
+++ b/modules/database/db_plain.cpp
@@ -168,7 +168,7 @@ EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, co
}
else if (key.equals_ci("ACCESS")) // Older access system, from Anope 1.9.4.
{
- service_reference<AccessProvider> provider("access/access");
+ service_reference<AccessProvider> provider("AccessProvider", "access/access");
if (!provider)
throw DatabaseException("Old access entry for nonexistant provider");
@@ -184,7 +184,7 @@ EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, co
}
else if (key.equals_ci("ACCESS2"))
{
- service_reference<AccessProvider> provider(params[0]);
+ service_reference<AccessProvider> provider("AccessProvider", params[0]);
if (!provider)
throw DatabaseException("Access entry for nonexistant provider " + params[0]);
diff --git a/modules/database/db_sql.cpp b/modules/database/db_sql.cpp
index c32c12e2e..6022418de 100644
--- a/modules/database/db_sql.cpp
+++ b/modules/database/db_sql.cpp
@@ -32,7 +32,7 @@ class SQLSQLInterface : public SQLInterface
class DBSQL : public Module
{
- service_reference<SQLProvider, Base> sql;
+ service_reference<SQLProvider> sql;
SQLSQLInterface sqlinterface;
void RunBackground(const SQLQuery &q)
@@ -101,7 +101,7 @@ class DBSQL : public Module
}
public:
- DBSQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE), sql(""), sqlinterface(this)
+ DBSQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE), sql("", ""), sqlinterface(this)
{
this->SetAuthor("Anope");
@@ -115,7 +115,7 @@ class DBSQL : public Module
{
ConfigReader config;
Anope::string engine = config.ReadValue("db_sql", "engine", "", 0);
- this->sql = engine;
+ this->sql = service_reference<SQLProvider>("SQLProvider", engine);
}
EventReturn OnSaveDatabase()
diff --git a/modules/database/db_sql_live_read.cpp b/modules/database/db_sql_live_read.cpp
index 90a36d10a..e79e4c27d 100644
--- a/modules/database/db_sql_live_read.cpp
+++ b/modules/database/db_sql_live_read.cpp
@@ -34,7 +34,7 @@ class SQLCache : public Timer
class MySQLLiveModule : public Module
{
- service_reference<SQLProvider, Base> SQL;
+ service_reference<SQLProvider> SQL;
SQLCache chan_cache, nick_cache, core_cache;
@@ -51,7 +51,7 @@ class MySQLLiveModule : public Module
public:
MySQLLiveModule(const Anope::string &modname, const Anope::string &creator) :
- Module(modname, creator, DATABASE), SQL("")
+ Module(modname, creator, DATABASE), SQL("", "")
{
this->OnReload();
@@ -63,7 +63,7 @@ class MySQLLiveModule : public Module
{
ConfigReader config;
Anope::string engine = config.ReadValue("db_sql", "engine", "", 0);
- this->SQL = engine;
+ this->SQL = service_reference<SQLProvider>("SQLProvider", engine);
}
void OnShutdown()
diff --git a/modules/database/db_sql_live_write.cpp b/modules/database/db_sql_live_write.cpp
index a97f57359..15bb6e91f 100644
--- a/modules/database/db_sql_live_write.cpp
+++ b/modules/database/db_sql_live_write.cpp
@@ -25,7 +25,7 @@ class DBMySQL : public Module
{
private:
MySQLInterface sqlinterface;
- service_reference<SQLProvider, Base> SQL;
+ service_reference<SQLProvider> SQL;
std::set<Anope::string> tables;
void RunQuery(const SQLQuery &query)
@@ -106,7 +106,7 @@ class DBMySQL : public Module
time_t lastwarn;
bool ro;
- DBMySQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE), sqlinterface(this), SQL("")
+ DBMySQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE), sqlinterface(this), SQL("", "")
{
this->lastwarn = 0;
this->ro = false;
@@ -124,7 +124,7 @@ class DBMySQL : public Module
{
ConfigReader config;
Anope::string engine = config.ReadValue("db_sql", "engine", "", 0);
- this->SQL = engine;
+ this->SQL = service_reference<SQLProvider>("SQLProvider", engine);
}
void OnServerConnect()
diff --git a/modules/extra/ldap.h b/modules/extra/ldap.h
index 96b6eb5e4..c21d60b05 100644
--- a/modules/extra/ldap.h
+++ b/modules/extra/ldap.h
@@ -112,10 +112,10 @@ class LDAPInterface
virtual void OnError(const LDAPResult &err) { }
};
-class LDAPProvider : public Service<Base>
+class LDAPProvider : public Service
{
public:
- LDAPProvider(Module *c, const Anope::string &n) : Service<Base>(c, n) { }
+ LDAPProvider(Module *c, const Anope::string &n) : Service(c, "LDAPProvider", n) { }
/** Attempt to bind to the LDAP server as an admin
* @param i The LDAPInterface the result is sent to
diff --git a/modules/extra/m_dnsbl.cpp b/modules/extra/m_dnsbl.cpp
index dea6a951d..285871cc6 100644
--- a/modules/extra/m_dnsbl.cpp
+++ b/modules/extra/m_dnsbl.cpp
@@ -7,7 +7,7 @@
#include "module.h"
-static service_reference<XLineManager> akills("xlinemanager/sgline");
+static service_reference<XLineManager> akills("XLineManager", "xlinemanager/sgline");
struct Blacklist
{
diff --git a/modules/extra/m_ldap.cpp b/modules/extra/m_ldap.cpp
index bdb573675..835215533 100644
--- a/modules/extra/m_ldap.cpp
+++ b/modules/extra/m_ldap.cpp
@@ -214,8 +214,8 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
static struct timeval tv = { 1, 0 };
LDAPMessage *result;
- int type = ldap_result(this->con, LDAP_RES_ANY, 1, &tv, &result);
- if (type <= 0 || this->GetExitState())
+ int rtype = ldap_result(this->con, LDAP_RES_ANY, 1, &tv, &result);
+ if (rtype <= 0 || this->GetExitState())
continue;
int cur_id = ldap_msgid(result);
diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp
index 148ee8250..02fc05649 100644
--- a/modules/extra/m_ldap_authentication.cpp
+++ b/modules/extra/m_ldap_authentication.cpp
@@ -163,7 +163,7 @@ class OnRegisterInterface : public LDAPInterface
class NSIdentifyLDAP : public Module
{
- service_reference<LDAPProvider, Base> ldap;
+ service_reference<LDAPProvider> ldap;
IdentifyInterface iinterface;
OnIdentifyInterface oninterface;
OnRegisterInterface orinterface;
@@ -176,7 +176,7 @@ class NSIdentifyLDAP : public Module
Anope::string disable_reason;
public:
NSIdentifyLDAP(const Anope::string &modname, const Anope::string &creator) :
- Module(modname, creator, SUPPORTED), ldap("ldap/main"), iinterface(this), oninterface(this), orinterface(this)
+ Module(modname, creator, SUPPORTED), ldap("LDAPProvider", "ldap/main"), iinterface(this), oninterface(this), orinterface(this)
{
this->SetAuthor("Anope");
diff --git a/modules/extra/m_ldap_oper.cpp b/modules/extra/m_ldap_oper.cpp
index 59ad0e670..b25dd8eff 100644
--- a/modules/extra/m_ldap_oper.cpp
+++ b/modules/extra/m_ldap_oper.cpp
@@ -76,7 +76,7 @@ class IdentifyInterface : public LDAPInterface
class LDAPOper : public Module
{
- service_reference<LDAPProvider, Base> ldap;
+ service_reference<LDAPProvider> ldap;
IdentifyInterface iinterface;
Anope::string binddn;
@@ -85,7 +85,7 @@ class LDAPOper : public Module
Anope::string filter;
public:
LDAPOper(const Anope::string &modname, const Anope::string &creator) :
- Module(modname, creator, SUPPORTED), ldap("ldap/main"), iinterface(this)
+ Module(modname, creator, SUPPORTED), ldap("LDAPProvider", "ldap/main"), iinterface(this)
{
this->SetAuthor("Anope");
diff --git a/modules/extra/m_proxyscan.cpp b/modules/extra/m_proxyscan.cpp
index f74469a5c..6b3153e32 100644
--- a/modules/extra/m_proxyscan.cpp
+++ b/modules/extra/m_proxyscan.cpp
@@ -102,7 +102,7 @@ class ProxyConnect : public ConnectionSocket
}
}
};
-service_reference<XLineManager> ProxyConnect::akills("xlinemanager/sgline");
+service_reference<XLineManager> ProxyConnect::akills("XLineManager", "xlinemanager/sgline");
std::set<ProxyConnect *> ProxyConnect::proxies;
class HTTPProxyConnect : public ProxyConnect, public BufferedSocket
diff --git a/modules/extra/m_xmlrpc.cpp b/modules/extra/m_xmlrpc.cpp
index 01cbc7c85..215be9d77 100644
--- a/modules/extra/m_xmlrpc.cpp
+++ b/modules/extra/m_xmlrpc.cpp
@@ -220,12 +220,12 @@ class ModuleXMLRPC;
static ModuleXMLRPC *me;
class ModuleXMLRPC : public Module
{
- service_reference<SSLService, Base> sslref;
+ service_reference<SSLService> sslref;
public:
MyXMLRPCServiceInterface xmlrpcinterface;
- ModuleXMLRPC(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED), sslref("ssl"), xmlrpcinterface(this, "xmlrpc")
+ ModuleXMLRPC(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED), sslref("SSLService", "ssl"), xmlrpcinterface(this, "xmlrpc")
{
me = this;
diff --git a/modules/extra/m_xmlrpc_main.cpp b/modules/extra/m_xmlrpc_main.cpp
index 98677761c..7498a3059 100644
--- a/modules/extra/m_xmlrpc_main.cpp
+++ b/modules/extra/m_xmlrpc_main.cpp
@@ -256,12 +256,12 @@ class MyXMLRPCEvent : public XMLRPCEvent
class ModuleXMLRPCMain : public Module
{
- service_reference<XMLRPCServiceInterface, Base> xmlrpc;
+ service_reference<XMLRPCServiceInterface> xmlrpc;
MyXMLRPCEvent stats;
public:
- ModuleXMLRPCMain(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED), xmlrpc("xmlrpc")
+ ModuleXMLRPCMain(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED), xmlrpc("XMLRPCServiceInterface", "xmlrpc")
{
if (!xmlrpc)
throw ModuleException("Unable to find xmlrpc reference, is m_xmlrpc loaded?");
diff --git a/modules/extra/sql.h b/modules/extra/sql.h
index 14272ed90..40c893722 100644
--- a/modules/extra/sql.h
+++ b/modules/extra/sql.h
@@ -108,10 +108,10 @@ class SQLInterface
/** Class providing the SQL service, modules call this to execute queries
*/
-class SQLProvider : public Service<Base>
+class SQLProvider : public Service
{
public:
- SQLProvider(Module *c, const Anope::string &n) : Service<Base>(c, n) { }
+ SQLProvider(Module *c, const Anope::string &n) : Service(c, "SQLProvider", n) { }
virtual void Run(SQLInterface *i, const SQLQuery &query) = 0;
diff --git a/modules/extra/ssl.h b/modules/extra/ssl.h
index 5b404067a..6eb97582c 100644
--- a/modules/extra/ssl.h
+++ b/modules/extra/ssl.h
@@ -1,8 +1,8 @@
-class SSLService : public Service<Base>
+class SSLService : public Service
{
public:
- SSLService(Module *o, const Anope::string &n) : Service<Base>(o, n) { }
+ SSLService(Module *o, const Anope::string &n) : Service(o, "SSLService", n) { }
virtual void Init(Socket *s) = 0;
};
diff --git a/modules/extra/xmlrpc.h b/modules/extra/xmlrpc.h
index a76400728..ef300e583 100644
--- a/modules/extra/xmlrpc.h
+++ b/modules/extra/xmlrpc.h
@@ -55,10 +55,10 @@ class XMLRPCEvent
virtual void Run(XMLRPCServiceInterface *iface, XMLRPCClientSocket *source, XMLRPCRequest *request) = 0;
};
-class XMLRPCServiceInterface : public Service<Base>
+class XMLRPCServiceInterface : public Service
{
public:
- XMLRPCServiceInterface(Module *creator, const Anope::string &sname) : Service<Base>(creator, sname) { }
+ XMLRPCServiceInterface(Module *creator, const Anope::string &sname) : Service(creator, "XMLRPCServiceInterface", sname) { }
virtual void Register(XMLRPCEvent *event) = 0;
diff --git a/modules/pseudoclients/global.h b/modules/pseudoclients/global.h
index 440ca1d8b..8aaa26a37 100644
--- a/modules/pseudoclients/global.h
+++ b/modules/pseudoclients/global.h
@@ -1,10 +1,10 @@
#ifndef GLOBAL_H
#define GLOBAL_H
-class GlobalService : public Service<Base>
+class GlobalService : public Service
{
public:
- GlobalService(Module *m) : Service<Base>(m, "Global") { }
+ GlobalService(Module *m) : Service(m, "GlobalService", "Global") { }
/** Send out a global message to all users
* @param sender Our client which should send the global
@@ -14,7 +14,7 @@ class GlobalService : public Service<Base>
virtual void SendGlobal(BotInfo *sender, const Anope::string &source, const Anope::string &message) = 0;
};
-static service_reference<GlobalService, Base> global("Global");
+static service_reference<GlobalService> global("GlobalService", "Global");
#endif // GLOBAL_H
diff --git a/modules/pseudoclients/memoserv.h b/modules/pseudoclients/memoserv.h
index 0cc88c9f0..aae7d26b5 100644
--- a/modules/pseudoclients/memoserv.h
+++ b/modules/pseudoclients/memoserv.h
@@ -1,7 +1,7 @@
#ifndef MEMOSERV_H
#define MEMOSERV_H
-class MemoServService : public Service<Base>
+class MemoServService : public Service
{
public:
enum MemoResult
@@ -12,7 +12,7 @@ class MemoServService : public Service<Base>
MEMO_TARGET_FULL
};
- MemoServService(Module *m) : Service<Base>(m, "MemoServ") { }
+ MemoServService(Module *m) : Service(m, "MemoServService", "MemoServ") { }
/** Retrieve the memo info for a nick or channel
* @param target Target
@@ -35,7 +35,7 @@ class MemoServService : public Service<Base>
virtual void Check(User *u) = 0;
};
-static service_reference<MemoServService, Base> memoserv("MemoServ");
+static service_reference<MemoServService> memoserv("MemoServService", "MemoServ");
#endif // MEMOSERV_H
diff --git a/modules/pseudoclients/nickserv.h b/modules/pseudoclients/nickserv.h
index dcca4164b..750b77784 100644
--- a/modules/pseudoclients/nickserv.h
+++ b/modules/pseudoclients/nickserv.h
@@ -1,15 +1,15 @@
#ifndef NICKSERV_H
#define NICKSERV_H
-class NickServService : public Service<Base>
+class NickServService : public Service
{
public:
- NickServService(Module *m) : Service<Base>(m, "NickServ") { }
+ NickServService(Module *m) : Service(m, "NickServService", "NickServ") { }
virtual void Validate(User *u) = 0;
};
-static service_reference<NickServService, Base> nickserv("NickServ");
+static service_reference<NickServService> nickserv("NickServService", "NickServ");
#endif // NICKSERV_H
diff --git a/src/access.cpp b/src/access.cpp
index 7639b7723..32c648857 100644
--- a/src/access.cpp
+++ b/src/access.cpp
@@ -65,7 +65,7 @@ void PrivilegeManager::ClearPrivileges()
privs.clear();
}
-AccessProvider::AccessProvider(Module *o, const Anope::string &n) : Service<AccessProvider>(o, n)
+AccessProvider::AccessProvider(Module *o, const Anope::string &n) : Service(o, "AccessProvider", n)
{
}
@@ -103,7 +103,7 @@ Serializable::serialized_data ChanAccess::serialize()
void ChanAccess::unserialize(serialized_data &data)
{
- service_reference<AccessProvider> aprovider(data["provider"].astr());
+ service_reference<AccessProvider> aprovider("AccessProvider", data["provider"].astr());
ChannelInfo *ci = cs_findchan(data["ci"].astr());
if (!aprovider || !ci)
return;
diff --git a/src/base.cpp b/src/base.cpp
index 98734d34d..f8b393774 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -6,6 +6,8 @@ std::vector<Anope::string> SerializeType::type_order;
Anope::map<SerializeType *> SerializeType::types;
std::list<Serializable *> *Serializable::serizliable_items;
+Anope::map<Anope::map<Service *> > Service::services;
+
void RegisterTypes()
{
static SerializeType nc("NickCore", NickCore::unserialize), na("NickAlias", NickAlias::unserialize), bi("BotInfo", BotInfo::unserialize),
diff --git a/src/bots.cpp b/src/bots.cpp
index 851177b9e..a6cc1c06f 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -244,7 +244,7 @@ void BotInfo::OnMessage(User *u, const Anope::string &message)
}
CommandInfo &info = it->second;
- service_reference<Command> c(info.name);
+ service_reference<Command> c("Command", info.name);
if (!c)
{
if (has_help)
diff --git a/src/command.cpp b/src/command.cpp
index cbd4d8042..75271867b 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -34,7 +34,7 @@ void CommandSource::Reply(const Anope::string &message)
u->SendMessage(this->service, tok);
}
-Command::Command(Module *o, const Anope::string &sname, size_t min_params, size_t max_params) : Service<Command>(o, sname), Flags<CommandFlag>(CommandFlagStrings), MaxParams(max_params), MinParams(min_params), module(owner)
+Command::Command(Module *o, const Anope::string &sname, size_t min_params, size_t max_params) : Service(o, "Command", sname), Flags<CommandFlag>(CommandFlagStrings), MaxParams(max_params), MinParams(min_params), module(owner)
{
}
diff --git a/src/operserv.cpp b/src/operserv.cpp
index 42a5c2f5b..6793581e0 100644
--- a/src/operserv.cpp
+++ b/src/operserv.cpp
@@ -92,7 +92,7 @@ Serializable::serialized_data XLine::serialize()
void XLine::unserialize(serialized_data &data)
{
- service_reference<XLineManager> xlm(data["manager"].astr());
+ service_reference<XLineManager> xlm("XLineManager", data["manager"].astr());
if (!xlm)
return;
@@ -172,7 +172,7 @@ Anope::string XLineManager::GenerateUID()
/** Constructor
*/
-XLineManager::XLineManager(Module *creator, const Anope::string &xname, char t) : Service<XLineManager>(creator, xname), type(t)
+XLineManager::XLineManager(Module *creator, const Anope::string &xname, char t) : Service(creator, "XLineManager", xname), type(t)
{
}