summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/commands/bs_kick.cpp2
-rw-r--r--modules/commands/cs_access.cpp43
-rw-r--r--modules/commands/cs_entrymsg.cpp9
-rw-r--r--modules/commands/cs_flags.cpp41
-rw-r--r--modules/commands/cs_seen.cpp11
-rw-r--r--modules/commands/cs_set_misc.cpp9
-rw-r--r--modules/commands/cs_suspend.cpp11
-rw-r--r--modules/commands/cs_xop.cpp39
-rw-r--r--modules/commands/hs_request.cpp9
-rw-r--r--modules/commands/ns_ajoin.cpp9
-rw-r--r--modules/commands/ns_set_misc.cpp9
-rw-r--r--modules/commands/ns_suspend.cpp11
-rw-r--r--modules/commands/os_forbid.cpp6
-rw-r--r--modules/commands/os_forbid.h10
-rw-r--r--modules/commands/os_ignore.cpp5
-rw-r--r--modules/commands/os_ignore.h7
-rw-r--r--modules/commands/os_news.cpp6
-rw-r--r--modules/commands/os_news.h7
-rw-r--r--modules/commands/os_oper.cpp9
-rw-r--r--modules/commands/os_session.cpp5
-rw-r--r--modules/commands/os_session.h10
-rw-r--r--modules/database/db_flatfile.cpp57
-rw-r--r--modules/database/db_plain.cpp4
-rw-r--r--modules/database/db_sql.cpp42
-rw-r--r--modules/database/db_sql_live_read.cpp110
-rw-r--r--modules/database/db_sql_live_write.cpp2
-rw-r--r--modules/extra/m_mysql.cpp6
-rw-r--r--modules/extra/m_proxyscan.cpp4
-rw-r--r--modules/extra/m_sqlite.cpp6
-rw-r--r--modules/extra/sql.h2
-rw-r--r--modules/pseudoclients/operserv.cpp2
31 files changed, 198 insertions, 305 deletions
diff --git a/modules/commands/bs_kick.cpp b/modules/commands/bs_kick.cpp
index b53510c10..26ae934a7 100644
--- a/modules/commands/bs_kick.cpp
+++ b/modules/commands/bs_kick.cpp
@@ -599,7 +599,7 @@ struct BanData : public ExtensibleItem
};
private:
- typedef std::map<Anope::string, Data, std::less<ci::string> > data_type;
+ typedef std::map<Anope::string, Data, ci::less> data_type;
data_type data_map;
public:
diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp
index 7cfbb303d..7a9c3b9a5 100644
--- a/modules/commands/cs_access.cpp
+++ b/modules/commands/cs_access.cpp
@@ -19,16 +19,16 @@ enum
ACCESS_FOUNDER = 10001
};
-static std::map<Anope::string, int16_t, std::less<ci::string> > defaultLevels;
+static std::map<Anope::string, int16_t, ci::less> defaultLevels;
static void reset_levels(ChannelInfo *ci)
{
ci->ClearLevels();
- for (std::map<Anope::string, int16_t, std::less<ci::string> >::iterator it = defaultLevels.begin(), it_end = defaultLevels.end(); it != it_end; ++it)
+ for (std::map<Anope::string, int16_t, ci::less>::iterator it = defaultLevels.begin(), it_end = defaultLevels.end(); it != it_end; ++it)
ci->SetLevel(it->first, it->second);
}
-class AccessChanAccess : public ChanAccess, public Serializable<AccessChanAccess>
+class AccessChanAccess : public ChanAccess
{
public:
int level;
@@ -86,41 +86,6 @@ class AccessChanAccess : public ChanAccess, public Serializable<AccessChanAccess
return highest;
}
}
-
- Anope::string serialize_name() { return "AccessChanAccess"; }
- serialized_data serialize()
- {
- serialized_data data;
-
- data["provider"] << this->provider->name;
- data["ci"] << this->ci->name;
- data["mask"] << this->mask;
- data["creator"] << this->creator;
- data["last_seen"].setType(Serialize::DT_INT) << this->last_seen;
- data["created"].setType(Serialize::DT_INT) << this->created;
- data["level"].setType(Serialize::DT_INT) << this->level;
-
- return data;
- }
-
- static void unserialize(SerializableBase::serialized_data &data)
- {
- service_reference<AccessProvider> aprovider(data["provider"].astr());
- ChannelInfo *ci = cs_findchan(data["ci"].astr());
- if (!aprovider || !ci)
- return;
-
- AccessChanAccess *access = new AccessChanAccess(aprovider);
- access->provider = aprovider;
- access->ci = ci;
- data["mask"] >> access->mask;
- data["creator"] >> access->creator;
- data["last_seen"] >> access->last_seen;
- data["created"] >> access->created;
- data["level"] >> access->level;
-
- ci->AddAccess(access);
- }
};
class AccessAccessProvider : public AccessProvider
@@ -868,8 +833,6 @@ class CSAccess : public Module
{
this->SetAuthor("Anope");
- Serializable<AccessChanAccess>::Alloc.Register("AccessChanAccess");
-
Implementation i[] = { I_OnReload, I_OnCreateChan, I_OnGroupCheckPriv };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
diff --git a/modules/commands/cs_entrymsg.cpp b/modules/commands/cs_entrymsg.cpp
index 7e927a343..d3fd7270c 100644
--- a/modules/commands/cs_entrymsg.cpp
+++ b/modules/commands/cs_entrymsg.cpp
@@ -13,14 +13,14 @@
#include "module.h"
-struct EntryMsg : Serializable<EntryMsg>
+struct EntryMsg : Serializable
{
ChannelInfo *ci;
Anope::string creator;
Anope::string message;
time_t when;
- EntryMsg(ChannelInfo *c, const Anope::string &cname, const Anope::string &cmessage, time_t ct = Anope::CurTime)
+ EntryMsg(ChannelInfo *c, const Anope::string &cname, const Anope::string &cmessage, time_t ct = Anope::CurTime) : Serializable("EntryMsg")
{
this->ci = c;
@@ -195,16 +195,15 @@ class CommandEntryMessage : public Command
class CSEntryMessage : public Module
{
+ SerializeType entrymsg_type;
CommandEntryMessage commandentrymsg;
public:
- CSEntryMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), commandentrymsg(this)
+ CSEntryMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), entrymsg_type("EntryMsg", EntryMsg::unserialize), commandentrymsg(this)
{
this->SetAuthor("Anope");
this->OnReload();
-
- Serializable<EntryMsg>::Alloc.Register("EntryMsg");
}
void OnJoinChannel(User *u, Channel *c)
diff --git a/modules/commands/cs_flags.cpp b/modules/commands/cs_flags.cpp
index 1b790b5f1..e81589968 100644
--- a/modules/commands/cs_flags.cpp
+++ b/modules/commands/cs_flags.cpp
@@ -15,7 +15,7 @@
static std::map<Anope::string, char> defaultFlags;
-class FlagsChanAccess : public ChanAccess, public Serializable<FlagsChanAccess>
+class FlagsChanAccess : public ChanAccess
{
public:
std::set<char> flags;
@@ -65,41 +65,6 @@ class FlagsChanAccess : public ChanAccess, public Serializable<FlagsChanAccess>
return Anope::string(buffer.begin(), buffer.end());
}
-
- Anope::string serialize_name() { return "FlagsChanAccess"; }
- serialized_data serialize()
- {
- serialized_data data;
-
- data["provider"] << this->provider->name;
- data["ci"] << this->ci->name;
- data["mask"] << this->mask;
- data["creator"] << this->creator;
- data["last_seen"].setType(Serialize::DT_INT) << this->last_seen;
- data["created"].setType(Serialize::DT_INT) << this->created;
- data["flags"] << this->Serialize();
-
- return data;
- }
-
- static void unserialize(SerializableBase::serialized_data &data)
- {
- service_reference<AccessProvider> aprovider(data["provider"].astr());
- ChannelInfo *ci = cs_findchan(data["ci"].astr());
- if (!aprovider || !ci)
- return;
-
- FlagsChanAccess *access = new FlagsChanAccess(aprovider);
- access->provider = aprovider;
- access->ci = ci;
- data["mask"] >> access->mask;
- data["creator"] >> access->creator;
- data["last_seen"] >> access->last_seen;
- data["created"] >> access->created;
- access->Unserialize(data["flags"].astr());
-
- ci->AddAccess(access);
- }
};
class FlagsAccessProvider : public AccessProvider
@@ -387,7 +352,7 @@ class CommandCSFlags : public Command
source.Reply(" ");
source.Reply(_("The available flags are:"));
- typedef std::multimap<char, Anope::string, std::less<ci::string> > reverse_map;
+ typedef std::multimap<char, Anope::string, ci::less> reverse_map;
reverse_map reverse;
for (std::map<Anope::string, char>::iterator it = defaultFlags.begin(), it_end = defaultFlags.end(); it != it_end; ++it)
reverse.insert(std::make_pair(it->second, it->first));
@@ -420,8 +385,6 @@ class CSFlags : public Module
ModuleManager::Attach(i, this, 1);
this->OnReload();
-
- Serializable<FlagsChanAccess>::Alloc.Register("FlagsChanAccess");
}
void OnReload()
diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp
index f828e181d..3c63e56ed 100644
--- a/modules/commands/cs_seen.cpp
+++ b/modules/commands/cs_seen.cpp
@@ -23,7 +23,7 @@ struct SeenInfo;
typedef Anope::insensitive_map<SeenInfo *> database_map;
database_map database;
-struct SeenInfo : Serializable<SeenInfo>
+struct SeenInfo : Serializable
{
Anope::string nick;
Anope::string vhost;
@@ -33,6 +33,10 @@ struct SeenInfo : Serializable<SeenInfo>
Anope::string message; // for part/kick/quit
time_t last; // the time when the user was last seen
+ SeenInfo() : Serializable("SeenInfo")
+ {
+ }
+
serialized_data serialize()
{
serialized_data data;
@@ -304,11 +308,12 @@ class DataBasePurger : public CallBack
class CSSeen : public Module
{
+ SerializeType seeninfo_type;
CommandSeen commandseen;
CommandOSSeen commandosseen;
DataBasePurger purger;
public:
- CSSeen(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), commandseen(this), commandosseen(this), purger(this)
+ CSSeen(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), seeninfo_type("SeenInfo", SeenInfo::unserialize), commandseen(this), commandosseen(this), purger(this)
{
this->SetAuthor("Anope");
@@ -322,8 +327,6 @@ class CSSeen : public Module
ModuleManager::Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
OnReload();
-
- Serializable<SeenInfo>::Alloc.Register("SeenInfo");
}
void OnReload()
diff --git a/modules/commands/cs_set_misc.cpp b/modules/commands/cs_set_misc.cpp
index e438210e3..3329d3aa2 100644
--- a/modules/commands/cs_set_misc.cpp
+++ b/modules/commands/cs_set_misc.cpp
@@ -12,13 +12,13 @@
#include "module.h"
-struct CSMiscData : Anope::string, ExtensibleItem, Serializable<CSMiscData>
+struct CSMiscData : Anope::string, ExtensibleItem, Serializable
{
ChannelInfo *ci;
Anope::string name;
Anope::string data;
- CSMiscData(ChannelInfo *c, const Anope::string &n, const Anope::string &d) : ci(c), name(n), data(d)
+ CSMiscData(ChannelInfo *c, const Anope::string &n, const Anope::string &d) : Serializable("CSMiscData"), ci(c), name(n), data(d)
{
}
@@ -96,19 +96,18 @@ class CommandCSSASetMisc : public CommandCSSetMisc
class CSSetMisc : public Module
{
+ SerializeType csmiscdata_type;
CommandCSSetMisc commandcssetmisc;
CommandCSSASetMisc commandcssasetmisc;
public:
CSSetMisc(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- commandcssetmisc(this), commandcssasetmisc(this)
+ csmiscdata_type("CSMiscData", CSMiscData::unserialize), commandcssetmisc(this), commandcssasetmisc(this)
{
this->SetAuthor("Anope");
Implementation i[] = { I_OnChanInfo };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
-
- Serializable<CSMiscData>::Alloc.Register("CSMisc");
}
void OnChanInfo(CommandSource &source, ChannelInfo *ci, bool ShowHidden)
diff --git a/modules/commands/cs_suspend.cpp b/modules/commands/cs_suspend.cpp
index f076ae361..48dcd4045 100644
--- a/modules/commands/cs_suspend.cpp
+++ b/modules/commands/cs_suspend.cpp
@@ -13,11 +13,15 @@
#include "module.h"
-struct ChanSuspend : ExtensibleItem, Serializable<ChanSuspend>
+struct ChanSuspend : ExtensibleItem, Serializable
{
Anope::string chan;
time_t when;
+ ChanSuspend() : Serializable("ChanSuspend")
+ {
+ }
+
serialized_data serialize()
{
serialized_data sd;
@@ -195,19 +199,18 @@ class CommandCSUnSuspend : public Command
class CSSuspend : public Module
{
+ SerializeType chansuspend_type;
CommandCSSuspend commandcssuspend;
CommandCSUnSuspend commandcsunsuspend;
public:
CSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- commandcssuspend(this), commandcsunsuspend(this)
+ chansuspend_type("ChanSuspend", ChanSuspend::unserialize), commandcssuspend(this), commandcsunsuspend(this)
{
this->SetAuthor("Anope");
Implementation i[] = { I_OnPreChanExpire };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
-
- Serializable<ChanSuspend>::Alloc.Register("ChanSuspend");
}
~CSSuspend()
diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp
index d23b24b81..9279688a6 100644
--- a/modules/commands/cs_xop.cpp
+++ b/modules/commands/cs_xop.cpp
@@ -90,7 +90,7 @@ static struct XOPAccess
}
};
-class XOPChanAccess : public ChanAccess, public Serializable<XOPChanAccess>
+class XOPChanAccess : public ChanAccess
{
public:
XOPType type;
@@ -188,41 +188,6 @@ class XOPChanAccess : public ChanAccess, public Serializable<XOPChanAccess>
return max;
}
}
-
- Anope::string serialize_name() { return "XOPChanAccess"; }
- serialized_data serialize()
- {
- serialized_data data;
-
- data["provider"] << this->provider->name;
- data["ci"] << this->ci->name;
- data["mask"] << this->mask;
- data["creator"] << this->creator;
- data["last_seen"] << this->last_seen;
- data["created"] << this->created;
- data["type"] << this->Serialize();
-
- return data;
- }
-
- static void unserialize(SerializableBase::serialized_data &data)
- {
- service_reference<AccessProvider> aprovider(data["provider"].astr());
- ChannelInfo *ci = cs_findchan(data["ci"].astr());
- if (!aprovider || !ci)
- return;
-
- XOPChanAccess *access = new XOPChanAccess(aprovider);
- access->provider = aprovider;
- access->ci = ci;
- data["mask"] >> access->mask;
- data["creator"] >> access->creator;
- data["last_seen"] >> access->last_seen;
- data["created"] >> access->created;
- access->Unserialize(data["type"].astr());
-
- ci->AddAccess(access);
- }
};
class XOPAccessProvider : public AccessProvider
@@ -902,8 +867,6 @@ class CSXOP : public Module
accessprovider(this), commandcsqop(this), commandcssop(this), commandcsaop(this), commandcshop(this), commandcsvop(this)
{
this->SetAuthor("Anope");
-
- Serializable<XOPChanAccess>::Alloc.Register("XOPChanAccess");
}
};
diff --git a/modules/commands/hs_request.cpp b/modules/commands/hs_request.cpp
index 82bba1bbc..f7a904979 100644
--- a/modules/commands/hs_request.cpp
+++ b/modules/commands/hs_request.cpp
@@ -23,13 +23,17 @@ static bool HSRequestMemoOper = false;
void req_send_memos(CommandSource &source, const Anope::string &vIdent, const Anope::string &vHost);
-struct HostRequest : ExtensibleItem, Serializable<HostRequest>
+struct HostRequest : ExtensibleItem, Serializable
{
Anope::string nick;
Anope::string ident;
Anope::string host;
time_t time;
+ HostRequest() : Serializable("HostRequest")
+ {
+ }
+
serialized_data serialize()
{
serialized_data data;
@@ -326,6 +330,7 @@ class CommandHSWaiting : public HSListBase
class HSRequest : public Module
{
+ SerializeType request_type;
CommandHSRequest commandhsrequest;
CommandHSActivate commandhsactive;
CommandHSReject commandhsreject;
@@ -333,7 +338,7 @@ class HSRequest : public Module
public:
HSRequest(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- commandhsrequest(this), commandhsactive(this), commandhsreject(this), commandhswaiting(this)
+ request_type("HSRequest", HostRequest::unserialize), commandhsrequest(this), commandhsactive(this), commandhsreject(this), commandhswaiting(this)
{
this->SetAuthor("Anope");
diff --git a/modules/commands/ns_ajoin.cpp b/modules/commands/ns_ajoin.cpp
index d7bde685e..5e2a99aa0 100644
--- a/modules/commands/ns_ajoin.cpp
+++ b/modules/commands/ns_ajoin.cpp
@@ -13,11 +13,11 @@
#include "module.h"
-struct AJoinList : std::vector<std::pair<Anope::string, Anope::string> >, ExtensibleItem, Serializable<AJoinList>
+struct AJoinList : std::vector<std::pair<Anope::string, Anope::string> >, ExtensibleItem, Serializable
{
NickCore *nc;
- AJoinList(NickCore *n) : nc(n) { }
+ AJoinList(NickCore *n) : Serializable("AJoinList"), nc(n) { }
serialized_data serialize()
{
@@ -159,18 +159,17 @@ class CommandNSAJoin : public Command
class NSAJoin : public Module
{
+ SerializeType ajoinlist_type;
CommandNSAJoin commandnsajoin;
public:
NSAJoin(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- commandnsajoin(this)
+ ajoinlist_type("AJoinList", AJoinList::unserialize), commandnsajoin(this)
{
this->SetAuthor("Anope");
Implementation i[] = { I_OnNickIdentify };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
-
- Serializable<AJoinList>::Alloc.Register("AJoinList");
}
void OnNickIdentify(User *u)
diff --git a/modules/commands/ns_set_misc.cpp b/modules/commands/ns_set_misc.cpp
index adf63e9d7..1cfd4fad3 100644
--- a/modules/commands/ns_set_misc.cpp
+++ b/modules/commands/ns_set_misc.cpp
@@ -13,13 +13,13 @@
#include "module.h"
-struct NSMiscData : Anope::string, ExtensibleItem, Serializable<NSMiscData>
+struct NSMiscData : Anope::string, ExtensibleItem, Serializable
{
NickCore *nc;
Anope::string name;
Anope::string data;
- NSMiscData(NickCore *ncore, const Anope::string &n, const Anope::string &d) : nc(ncore), name(n), data(d)
+ NSMiscData(NickCore *ncore, const Anope::string &n, const Anope::string &d) : Serializable("NSMiscdata"), nc(ncore), name(n), data(d)
{
}
@@ -107,19 +107,18 @@ class CommandNSSASetMisc : public CommandNSSetMisc
class NSSetMisc : public Module
{
+ SerializeType nsmiscdata_type;
CommandNSSetMisc commandnssetmisc;
CommandNSSASetMisc commandnssasetmisc;
public:
NSSetMisc(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- commandnssetmisc(this), commandnssasetmisc(this)
+ nsmiscdata_type("NSMiscData", NSMiscData::unserialize), commandnssetmisc(this), commandnssasetmisc(this)
{
this->SetAuthor("Anope");
Implementation i[] = { I_OnNickInfo };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
-
- Serializable<NSMiscData>::Alloc.Register("NSMisc");
}
void OnNickInfo(CommandSource &source, NickAlias *na, bool ShowHidden)
diff --git a/modules/commands/ns_suspend.cpp b/modules/commands/ns_suspend.cpp
index bab14ad86..9f7e3a1b8 100644
--- a/modules/commands/ns_suspend.cpp
+++ b/modules/commands/ns_suspend.cpp
@@ -13,11 +13,15 @@
#include "module.h"
-struct NickSuspend : ExtensibleItem, Serializable<NickSuspend>
+struct NickSuspend : ExtensibleItem, Serializable
{
Anope::string nick;
time_t when;
+ NickSuspend() : Serializable("NickSuspend")
+ {
+ }
+
serialized_data serialize()
{
serialized_data sd;
@@ -196,19 +200,18 @@ class CommandNSUnSuspend : public Command
class NSSuspend : public Module
{
+ SerializeType nicksuspend_type;
CommandNSSuspend commandnssuspend;
CommandNSUnSuspend commandnsunsuspend;
public:
NSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- commandnssuspend(this), commandnsunsuspend(this)
+ nicksuspend_type("NickSuspend", NickSuspend::unserialize), commandnssuspend(this), commandnsunsuspend(this)
{
this->SetAuthor("Anope");
Implementation i[] = { I_OnPreNickExpire };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
-
- Serializable<NickSuspend>::Alloc.Register("NickSuspend");
}
~NSSuspend()
diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp
index 83b9829fa..4c6ead48f 100644
--- a/modules/commands/os_forbid.cpp
+++ b/modules/commands/os_forbid.cpp
@@ -210,20 +210,18 @@ class CommandOSForbid : public Command
class OSForbid : public Module
{
+ SerializeType forbiddata_type;
MyForbidService forbidService;
CommandOSForbid commandosforbid;
public:
OSForbid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- forbidService(this), commandosforbid(this)
+ forbiddata_type("ForbidData", ForbidData::unserialize), forbidService(this), commandosforbid(this)
{
this->SetAuthor("Anope");
Implementation i[] = { I_OnUserConnect, I_OnUserNickChange, I_OnJoinChannel, I_OnPreCommand };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
-
-
- Serializable<ForbidData>::Alloc.Register("Forbid");
}
void OnUserConnect(dynamic_reference<User> &u, bool &exempt)
diff --git a/modules/commands/os_forbid.h b/modules/commands/os_forbid.h
index 1aac412a3..00e769919 100644
--- a/modules/commands/os_forbid.h
+++ b/modules/commands/os_forbid.h
@@ -9,7 +9,7 @@ enum ForbidType
FT_EMAIL
};
-struct ForbidData : Serializable<ForbidData>
+struct ForbidData : Serializable
{
Anope::string mask;
Anope::string creator;
@@ -18,6 +18,10 @@ struct ForbidData : Serializable<ForbidData>
time_t expires;
ForbidType type;
+ ForbidData() : Serializable("ForbidData")
+ {
+ }
+
serialized_data serialize();
static void unserialize(serialized_data &data);
};
@@ -38,7 +42,7 @@ class ForbidService : public Service<Base>
static service_reference<ForbidService, Base> forbid_service("forbid");
-SerializableBase::serialized_data ForbidData::serialize()
+Serializable::serialized_data ForbidData::serialize()
{
serialized_data data;
@@ -52,7 +56,7 @@ SerializableBase::serialized_data ForbidData::serialize()
return data;
}
-void ForbidData::unserialize(SerializableBase::serialized_data &data)
+void ForbidData::unserialize(serialized_data &data)
{
if (!forbid_service)
return;
diff --git a/modules/commands/os_ignore.cpp b/modules/commands/os_ignore.cpp
index 6462284f5..52edd04e9 100644
--- a/modules/commands/os_ignore.cpp
+++ b/modules/commands/os_ignore.cpp
@@ -278,20 +278,19 @@ class CommandOSIgnore : public Command
class OSIgnore : public Module
{
+ SerializeType ignoredata_type;
OSIgnoreService osignoreservice;
CommandOSIgnore commandosignore;
public:
OSIgnore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- osignoreservice(this), commandosignore(this)
+ ignoredata_type("IgnoreData", IgnoreData::unserialize), osignoreservice(this), commandosignore(this)
{
this->SetAuthor("Anope");
Implementation i[] = { I_OnBotPrivmsg };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
-
- Serializable<IgnoreData>::Alloc.Register("Ignore");
}
EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message)
diff --git a/modules/commands/os_ignore.h b/modules/commands/os_ignore.h
index 753a4cfaf..84bf5442d 100644
--- a/modules/commands/os_ignore.h
+++ b/modules/commands/os_ignore.h
@@ -10,13 +10,14 @@
*/
-struct IgnoreData : Serializable<IgnoreData>
+struct IgnoreData : Serializable
{
Anope::string mask;
Anope::string creator;
Anope::string reason;
time_t time; /* When do we stop ignoring them? */
+ IgnoreData() : Serializable("IgnoreData") { }
serialized_data serialize();
static void unserialize(serialized_data &data);
};
@@ -42,7 +43,7 @@ class IgnoreService : public Service<Base>
static service_reference<IgnoreService, Base> ignore_service("ignore");
-SerializableBase::serialized_data IgnoreData::serialize()
+Serializable::serialized_data IgnoreData::serialize()
{
serialized_data data;
@@ -54,7 +55,7 @@ SerializableBase::serialized_data IgnoreData::serialize()
return data;
}
-void IgnoreData::unserialize(SerializableBase::serialized_data &data)
+void IgnoreData::unserialize(serialized_data &data)
{
if (!ignore_service)
return;
diff --git a/modules/commands/os_news.cpp b/modules/commands/os_news.cpp
index b2537bbc9..cf127d284 100644
--- a/modules/commands/os_news.cpp
+++ b/modules/commands/os_news.cpp
@@ -318,6 +318,7 @@ class CommandOSRandomNews : public NewsBase
class OSNews : public Module
{
+ SerializeType newsitem_type;
MyNewsService newsservice;
CommandOSLogonNews commandoslogonnews;
@@ -372,15 +373,12 @@ class OSNews : public Module
public:
OSNews(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- newsservice(this), commandoslogonnews(this), commandosopernews(this), commandosrandomnews(this)
+ newsitem_type("NewsItem", NewsItem::unserialize), newsservice(this), commandoslogonnews(this), commandosopernews(this), commandosrandomnews(this)
{
this->SetAuthor("Anope");
-
Implementation i[] = { I_OnUserModeSet, I_OnUserConnect };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
-
- Serializable<NewsItem>::Alloc.Register("NewsItem");
}
void OnUserModeSet(User *u, UserModeName Name)
diff --git a/modules/commands/os_news.h b/modules/commands/os_news.h
index 9e41173d7..2b2fd7528 100644
--- a/modules/commands/os_news.h
+++ b/modules/commands/os_news.h
@@ -15,13 +15,14 @@ struct NewsMessages
const char *msgs[10];
};
-struct NewsItem : Serializable<NewsItem>
+struct NewsItem : Serializable
{
NewsType type;
Anope::string text;
Anope::string who;
time_t time;
+ NewsItem() : Serializable("NewsItem") { }
serialized_data serialize();
static void unserialize(serialized_data &data);
};
@@ -40,7 +41,7 @@ class NewsService : public Service<Base>
static service_reference<NewsService, Base> news_service("news");
-SerializableBase::serialized_data NewsItem::serialize()
+Serializable::serialized_data NewsItem::serialize()
{
serialized_data data;
@@ -52,7 +53,7 @@ SerializableBase::serialized_data NewsItem::serialize()
return data;
}
-void NewsItem::unserialize(SerializableBase::serialized_data &data)
+void NewsItem::unserialize(serialized_data &data)
{
if (!news_service)
return;
diff --git a/modules/commands/os_oper.cpp b/modules/commands/os_oper.cpp
index 1d38a0279..18391e4ca 100644
--- a/modules/commands/os_oper.cpp
+++ b/modules/commands/os_oper.cpp
@@ -13,9 +13,9 @@
#include "module.h"
-struct MyOper : Oper, Serializable<MyOper>
+struct MyOper : Oper, Serializable
{
- MyOper(const Anope::string &n, OperType *o) : Oper(n, o) { }
+ MyOper(const Anope::string &n, OperType *o) : Oper(n, o), Serializable("Oper") { }
serialized_data serialize()
{
@@ -196,15 +196,14 @@ class CommandOSOper : public Command
class OSOper : public Module
{
+ SerializeType myoper_type;
CommandOSOper commandosoper;
public:
OSOper(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- commandosoper(this)
+ myoper_type("Oper", MyOper::unserialize), commandosoper(this)
{
this->SetAuthor("Anope");
-
- Serializable<MyOper>::Alloc.Register("Oper");
}
~OSOper()
diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp
index 752fe8729..5417e83d7 100644
--- a/modules/commands/os_session.cpp
+++ b/modules/commands/os_session.cpp
@@ -628,6 +628,7 @@ class CommandOSException : public Command
class OSSession : public Module
{
+ SerializeType exception_type;
MySessionService ss;
ExpireTimer expiretimer;
CommandOSSession commandossession;
@@ -720,15 +721,13 @@ class OSSession : public Module
public:
OSSession(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- ss(this), commandossession(this), commandosexception(this), akills("xlinemanager/sgline")
+ exception_type("Exception", Exception::unserialize), ss(this), commandossession(this), commandosexception(this), akills("xlinemanager/sgline")
{
this->SetAuthor("Anope");
Implementation i[] = { I_OnUserConnect, I_OnUserLogoff };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
ModuleManager::SetPriority(this, PRIORITY_FIRST);
-
- Serializable<Exception>::Alloc.Register("Exception");
}
void OnUserConnect(dynamic_reference<User> &user, bool &exempt)
diff --git a/modules/commands/os_session.h b/modules/commands/os_session.h
index 8a839318d..8d04e31c5 100644
--- a/modules/commands/os_session.h
+++ b/modules/commands/os_session.h
@@ -1,7 +1,7 @@
#ifndef OS_SESSION_H
#define OS_SESSION_H
-struct Exception : Serializable<Exception>
+struct Exception : Serializable
{
Anope::string mask; /* Hosts to which this exception applies */
unsigned limit; /* Session limit for exception */
@@ -10,6 +10,10 @@ struct Exception : Serializable<Exception>
time_t time; /* When this exception was added */
time_t expires; /* Time when it expires. 0 == no expiry */
+ Exception() : Serializable("Exception")
+ {
+ }
+
serialized_data serialize();
static void unserialize(serialized_data &data);
};
@@ -44,7 +48,7 @@ class SessionService : public Service<Base>
static service_reference<SessionService, Base> session_service("session");
-SerializableBase::serialized_data Exception::serialize()
+Serializable::serialized_data Exception::serialize()
{
serialized_data data;
@@ -58,7 +62,7 @@ SerializableBase::serialized_data Exception::serialize()
return data;
}
-void Exception::unserialize(SerializableBase::serialized_data &data)
+void Exception::unserialize(Serializable::serialized_data &data)
{
if (!session_service)
return;
diff --git a/modules/database/db_flatfile.cpp b/modules/database/db_flatfile.cpp
index 639d6e1e8..c3b8cbf75 100644
--- a/modules/database/db_flatfile.cpp
+++ b/modules/database/db_flatfile.cpp
@@ -21,14 +21,6 @@ class DBFlatFile : public Module
/* Backup file names */
std::list<Anope::string> Backups;
- SerializableBase *find(const Anope::string &sname)
- {
- for (unsigned i = 0; i < serialized_types.size(); ++i)
- if (serialized_types[i]->serialize_name() == sname)
- return serialized_types[i];
- return NULL;
- }
-
public:
DBFlatFile(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE)
{
@@ -75,7 +67,7 @@ class DBFlatFile : public Module
if (Config->KeepBackups > 0 && Backups.size() > static_cast<unsigned>(Config->KeepBackups))
{
- DeleteFile(Backups.front().c_str());
+ unlink(Backups.front().c_str());
Backups.pop_front();
}
}
@@ -98,9 +90,9 @@ class DBFlatFile : public Module
return EVENT_CONTINUE;
}
- SerializableBase *sb = NULL;
- SerializableBase::serialized_data data;
- std::multimap<SerializableBase *, SerializableBase::serialized_data> objects;
+ SerializeType *st = NULL;
+ Serializable::serialized_data data;
+ std::multimap<SerializeType *, Serializable::serialized_data> objects;
for (Anope::string buf, token; std::getline(db, buf.str());)
{
spacesepstream sep(buf);
@@ -110,29 +102,30 @@ class DBFlatFile : public Module
if (token == "OBJECT" && sep.GetToken(token))
{
- sb = this->find(token);
+ st = SerializeType::Find(token);
data.clear();
}
- else if (token == "DATA" && sb != NULL && sep.GetToken(token))
+ else if (token == "DATA" && st != NULL && sep.GetToken(token))
data[token] << sep.GetRemaining();
- else if (token == "END" && sb != NULL)
+ else if (token == "END" && st != NULL)
{
- objects.insert(std::make_pair(sb, data));
+ objects.insert(std::make_pair(st, data));
- sb = NULL;
+ st = NULL;
data.clear();
}
}
- for (unsigned i = 0; i < serialized_types.size(); ++i)
+ const std::vector<Anope::string> type_order = SerializeType::GetTypeOrder();
+ for (unsigned i = 0; i < type_order.size(); ++i)
{
- SerializableBase *stype = serialized_types[i];
+ SerializeType *stype = SerializeType::Find(type_order[i]);
- std::multimap<SerializableBase *, SerializableBase::serialized_data>::iterator it = objects.find(stype), it_end = objects.upper_bound(stype);
+ std::multimap<SerializeType *, Serializable::serialized_data>::iterator it = objects.find(stype), it_end = objects.upper_bound(stype);
if (it == objects.end())
continue;
for (; it != it_end; ++it)
- it->first->alloc(it->second);
+ it->first->Create(it->second);
}
db.close();
@@ -158,17 +151,17 @@ class DBFlatFile : public Module
return EVENT_CONTINUE;
}
- if (serialized_items != NULL)
- for (std::list<SerializableBase *>::iterator it = serialized_items->begin(), it_end = serialized_items->end(); it != it_end; ++it)
- {
- SerializableBase *base = *it;
- SerializableBase::serialized_data data = base->serialize();
+ const std::list<Serializable *> &items = Serializable::GetItems();
+ for (std::list<Serializable *>::const_iterator it = items.begin(), it_end = items.end(); it != it_end; ++it)
+ {
+ Serializable *base = *it;
+ Serializable::serialized_data data = base->serialize();
- db << "OBJECT " << base->serialize_name() << "\n";
- for (SerializableBase::serialized_data::iterator dit = data.begin(), dit_end = data.end(); dit != dit_end; ++dit)
- db << "DATA " << dit->first << " " << dit->second.astr() << "\n";
- db << "END\n";
- }
+ db << "OBJECT " << base->GetSerializeName() << "\n";
+ for (Serializable::serialized_data::iterator dit = data.begin(), dit_end = data.end(); dit != dit_end; ++dit)
+ db << "DATA " << dit->first << " " << dit->second.astr() << "\n";
+ db << "END\n";
+ }
db.close();
@@ -181,7 +174,7 @@ class DBFlatFile : public Module
rename(tmp_db.c_str(), DatabaseFile.c_str());
}
else
- DeleteFile(tmp_db.c_str());
+ unlink(tmp_db.c_str());
return EVENT_CONTINUE;
}
diff --git a/modules/database/db_plain.cpp b/modules/database/db_plain.cpp
index 387d5ca61..c28d064cd 100644
--- a/modules/database/db_plain.cpp
+++ b/modules/database/db_plain.cpp
@@ -596,7 +596,6 @@ class DBPlain : public Module
OnReload();
LastDay = 0;
- Serializable<Exception>::Alloc.Register("Exception");
}
~DBPlain()
@@ -637,7 +636,7 @@ class DBPlain : public Module
unsigned KeepBackups = Config->KeepBackups;
if (KeepBackups && Backups.size() > KeepBackups)
{
- DeleteFile(Backups.front().c_str());
+ unlink(Backups.front().c_str());
Backups.pop_front();
}
}
@@ -655,7 +654,6 @@ class DBPlain : public Module
/* No need to ever reload this again, although this should never be trigged again */
ModuleManager::Detach(I_OnLoadDatabase, this);
- //ModuleManager::Detach(I_OnDatabaseReadMetadata, this);
return EVENT_STOP;
}
diff --git a/modules/database/db_sql.cpp b/modules/database/db_sql.cpp
index 8b2b0e26d..e083204d4 100644
--- a/modules/database/db_sql.cpp
+++ b/modules/database/db_sql.cpp
@@ -60,9 +60,9 @@ class DBSQL : public Module
}
}
- void AlterTable(const Anope::string &table, std::set<Anope::string> &data, const SerializableBase::serialized_data &newd)
+ void AlterTable(const Anope::string &table, std::set<Anope::string> &data, const Serializable::serialized_data &newd)
{
- for (SerializableBase::serialized_data::const_iterator it = newd.begin(), it_end = newd.end(); it != it_end; ++it)
+ for (Serializable::serialized_data::const_iterator it = newd.begin(), it_end = newd.end(); it != it_end; ++it)
{
if (data.count(it->first) > 0)
continue;
@@ -81,20 +81,20 @@ class DBSQL : public Module
}
}
- void Insert(const Anope::string &table, const SerializableBase::serialized_data &data)
+ void Insert(const Anope::string &table, const Serializable::serialized_data &data)
{
Anope::string query_text = "INSERT INTO `" + table + "` (";
- for (SerializableBase::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
+ for (Serializable::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
query_text += "`" + it->first + "`,";
query_text.erase(query_text.end() - 1);
query_text += ") VALUES (";
- for (SerializableBase::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
+ for (Serializable::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
query_text += "@" + it->first + "@,";
query_text.erase(query_text.end() - 1);
query_text += ")";
SQLQuery query(query_text);
- for (SerializableBase::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
+ for (Serializable::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
query.setValue(it->first, it->second.astr());
this->RunBackground(query);
@@ -126,32 +126,33 @@ class DBSQL : public Module
return EVENT_CONTINUE;
}
- if (serialized_items == NULL)
+ const std::list<Serializable *> &items = Serializable::GetItems();
+ if (items.empty())
return EVENT_CONTINUE;
this->DropAll();
std::map<Anope::string, std::set<Anope::string> > table_layout;
- for (std::list<SerializableBase *>::iterator it = serialized_items->begin(), it_end = serialized_items->end(); it != it_end; ++it)
+ for (std::list<Serializable *>::const_iterator it = items.begin(), it_end = items.end(); it != it_end; ++it)
{
- SerializableBase *base = *it;
- SerializableBase::serialized_data data = base->serialize();
+ Serializable *base = *it;
+ Serializable::serialized_data data = base->serialize();
if (data.empty())
continue;
- std::set<Anope::string> &layout = table_layout[base->serialize_name()];
+ std::set<Anope::string> &layout = table_layout[base->GetSerializeName()];
if (layout.empty())
{
- this->RunBackground(this->sql->CreateTable(base->serialize_name(), data));
+ this->RunBackground(this->sql->CreateTable(base->GetSerializeName(), data));
- for (SerializableBase::serialized_data::iterator it2 = data.begin(), it2_end = data.end(); it2 != it2_end; ++it2)
+ for (Serializable::serialized_data::iterator it2 = data.begin(), it2_end = data.end(); it2 != it2_end; ++it2)
layout.insert(it2->first);
}
else
- this->AlterTable(base->serialize_name(), layout, data);
+ this->AlterTable(base->GetSerializeName(), layout, data);
- this->Insert(base->serialize_name(), data);
+ this->Insert(base->GetSerializeName(), data);
}
return EVENT_CONTINUE;
}
@@ -164,20 +165,21 @@ class DBSQL : public Module
return EVENT_CONTINUE;
}
- for (std::vector<SerializableBase *>::iterator it = serialized_types.begin(), it_end = serialized_types.end(); it != it_end; ++it)
+ const std::vector<Anope::string> type_order = SerializeType::GetTypeOrder();
+ for (unsigned i = 0; i < type_order.size(); ++i)
{
- SerializableBase *sb = *it;
+ SerializeType *sb = SerializeType::Find(type_order[i]);
- SQLQuery query("SELECT * FROM `" + sb->serialize_name() + "`");
+ SQLQuery query("SELECT * FROM `" + sb->GetName() + "`");
SQLResult res = this->sql->RunQuery(query);
for (int i = 0; i < res.Rows(); ++i)
{
- SerializableBase::serialized_data data;
+ Serializable::serialized_data data;
const std::map<Anope::string, Anope::string> &row = res.Row(i);
for (std::map<Anope::string, Anope::string>::const_iterator rit = row.begin(), rit_end = row.end(); rit != rit_end; ++rit)
data[rit->first] << rit->second;
- sb->alloc(data);
+ sb->Create(data);
}
}
diff --git a/modules/database/db_sql_live_read.cpp b/modules/database/db_sql_live_read.cpp
index b908949ab..9dfc68c69 100644
--- a/modules/database/db_sql_live_read.cpp
+++ b/modules/database/db_sql_live_read.cpp
@@ -55,7 +55,7 @@ class DBMySQL : public Module
}
}
- void Insert(const Anope::string &table, const SerializableBase::serialized_data &data)
+ void Insert(const Anope::string &table, const Serializable::serialized_data &data)
{
if (tables.count(table) == 0 && SQL)
{
@@ -64,33 +64,33 @@ class DBMySQL : public Module
}
Anope::string query_text = "INSERT INTO `" + table + "` (";
- for (SerializableBase::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
+ for (Serializable::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
query_text += "`" + it->first + "`,";
query_text.erase(query_text.end() - 1);
query_text += ") VALUES (";
- for (SerializableBase::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
+ for (Serializable::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
query_text += "@" + it->first + "@,";
query_text.erase(query_text.end() - 1);
query_text += ") ON DUPLICATE KEY UPDATE ";
- for (SerializableBase::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
+ for (Serializable::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
query_text += it->first + "=VALUES(" + it->first + "),";
query_text.erase(query_text.end() - 1);
SQLQuery query(query_text);
- for (SerializableBase::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
+ for (Serializable::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
query.setValue(it->first, it->second.astr());
this->RunQuery(query);
}
- void Delete(const Anope::string &table, const SerializableBase::serialized_data &data)
+ void Delete(const Anope::string &table, const Serializable::serialized_data &data)
{
Anope::string query_text = "DELETE FROM `" + table + "` WHERE ";
- for (SerializableBase::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
+ for (Serializable::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
query_text += "`" + it->first + "` = @" + it->first + "@";
SQLQuery query(query_text);
- for (SerializableBase::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
+ for (Serializable::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
query.setValue(it->first, it->second.astr());
this->RunQuery(query);
@@ -158,20 +158,20 @@ class DBMySQL : public Module
{
NickAlias *na = findnick(source.u->nick);
if (!na)
- this->Insert(na->nc->serialize_name(), na->nc->serialize());
+ this->Insert(na->nc->GetSerializeName(), na->nc->serialize());
}
else if (command->name.find("nickserv/saset/") == 0)
{
NickAlias *na = findnick(params[1]);
if (!na)
- this->Insert(na->nc->serialize_name(), na->nc->serialize());
+ this->Insert(na->nc->GetSerializeName(), na->nc->serialize());
}
else if (command->name.find("chanserv/set") == 0 || command->name.find("chanserv/saset") == 0)
{
ChannelInfo *ci = params.size() > 0 ? cs_findchan(params[0]) : NULL;
if (!ci)
- this->Insert(ci->serialize_name(), ci->serialize());
+ this->Insert(ci->GetSerializeName(), ci->serialize());
}
else if (command->name == "botserv/kick" && params.size() > 2)
{
@@ -180,7 +180,7 @@ class DBMySQL : public Module
return;
if (!ci->AccessFor(u).HasPriv("SET") && !u->HasPriv("botserv/administration"))
return;
- this->Insert(ci->serialize_name(), ci->serialize());
+ this->Insert(ci->GetSerializeName(), ci->serialize());
}
else if (command->name == "botserv/set" && params.size() > 1)
{
@@ -189,9 +189,9 @@ class DBMySQL : public Module
if (!ci)
bi = findbot(params[0]);
if (bi && params[1].equals_ci("PRIVATE") && u->HasPriv("botserv/set/private"))
- this->Insert(bi->serialize_name(), bi->serialize());
+ this->Insert(bi->GetSerializeName(), bi->serialize());
else if (ci && !ci->AccessFor(u).HasPriv("SET") && !u->HasPriv("botserv/administration"))
- this->Insert(ci->serialize_name(), ci->serialize());
+ this->Insert(ci->GetSerializeName(), ci->serialize());
}
else if (command->name == "memoserv/ignore" && params.size() > 0)
{
@@ -200,40 +200,40 @@ class DBMySQL : public Module
{
NickCore *nc = u->Account();
if (nc)
- this->Insert(nc->serialize_name(), nc->serialize());
+ this->Insert(nc->GetSerializeName(), nc->serialize());
}
else
{
ChannelInfo *ci = cs_findchan(target);
if (ci && ci->AccessFor(u).HasPriv("MEMO"))
- this->Insert(ci->serialize_name(), ci->serialize());
+ this->Insert(ci->GetSerializeName(), ci->serialize());
}
}
}
void OnNickAddAccess(NickCore *nc, const Anope::string &entry)
{
- this->Insert(nc->serialize_name(), nc->serialize());
+ this->Insert(nc->GetSerializeName(), nc->serialize());
}
void OnNickEraseAccess(NickCore *nc, const Anope::string &entry)
{
- this->Insert(nc->serialize_name(), nc->serialize());
+ this->Insert(nc->GetSerializeName(), nc->serialize());
}
void OnNickClearAccess(NickCore *nc)
{
- this->Insert(nc->serialize_name(), nc->serialize());
+ this->Insert(nc->GetSerializeName(), nc->serialize());
}
void OnDelCore(NickCore *nc)
{
- this->Delete(nc->serialize_name(), nc->serialize());
+ this->Delete(nc->GetSerializeName(), nc->serialize());
}
void OnNickForbidden(NickAlias *na)
{
- this->Insert(na->serialize_name(), na->serialize());
+ this->Insert(na->GetSerializeName(), na->serialize());
}
void OnNickGroup(User *u, NickAlias *)
@@ -243,12 +243,12 @@ class DBMySQL : public Module
void InsertAlias(NickAlias *na)
{
- this->Insert(na->serialize_name(), na->serialize());
+ this->Insert(na->GetSerializeName(), na->serialize());
}
void InsertCore(NickCore *nc)
{
- this->Insert(nc->serialize_name(), nc->serialize());
+ this->Insert(nc->GetSerializeName(), nc->serialize());
}
void OnNickRegister(NickAlias *na)
@@ -259,42 +259,42 @@ class DBMySQL : public Module
void OnChangeCoreDisplay(NickCore *nc, const Anope::string &newdisplay)
{
- SerializableBase::serialized_data data = nc->serialize();
- this->Delete(nc->serialize_name(), data);
+ Serializable::serialized_data data = nc->serialize();
+ this->Delete(nc->GetSerializeName(), data);
data.erase("display");
data["display"] << newdisplay;
- this->Insert(nc->serialize_name(), data);
+ this->Insert(nc->GetSerializeName(), data);
for (std::list<NickAlias *>::iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end; ++it)
{
NickAlias *na = *it;
data = na->serialize();
- this->Delete(na->serialize_name(), data);
+ this->Delete(na->GetSerializeName(), data);
data.erase("nc");
data["nc"] << newdisplay;
- this->Insert(na->serialize_name(), data);
+ this->Insert(na->GetSerializeName(), data);
}
}
void OnNickSuspend(NickAlias *na)
{
- this->Insert(na->serialize_name(), na->serialize());
+ this->Insert(na->GetSerializeName(), na->serialize());
}
void OnDelNick(NickAlias *na)
{
- this->Delete(na->serialize_name(), na->serialize());
+ this->Delete(na->GetSerializeName(), na->serialize());
}
void OnAccessAdd(ChannelInfo *ci, User *, ChanAccess *access)
{
- this->Insert(access->serialize_name(), access->serialize());
+ this->Insert(access->GetSerializeName(), access->serialize());
}
void OnAccessDel(ChannelInfo *ci, User *u, ChanAccess *access)
{
- this->Delete(access->serialize_name(), access->serialize());
+ this->Delete(access->GetSerializeName(), access->serialize());
}
void OnAccessClear(ChannelInfo *ci, User *u)
@@ -305,49 +305,49 @@ class DBMySQL : public Module
void OnLevelChange(User *u, ChannelInfo *ci, const Anope::string &priv, int16_t what)
{
- this->Insert(ci->serialize_name(), ci->serialize());
+ this->Insert(ci->GetSerializeName(), ci->serialize());
}
void OnDelChan(ChannelInfo *ci)
{
- this->Delete(ci->serialize_name(), ci->serialize());
+ this->Delete(ci->GetSerializeName(), ci->serialize());
}
void OnChanRegistered(ChannelInfo *ci)
{
- this->Insert(ci->serialize_name(), ci->serialize());
+ this->Insert(ci->GetSerializeName(), ci->serialize());
}
void OnChanSuspend(ChannelInfo *ci)
{
- this->Insert(ci->serialize_name(), ci->serialize());
+ this->Insert(ci->GetSerializeName(), ci->serialize());
}
void OnAkickAdd(ChannelInfo *ci, AutoKick *ak)
{
- this->Insert(ak->serialize_name(), ak->serialize());
+ this->Insert(ak->GetSerializeName(), ak->serialize());
}
void OnAkickDel(ChannelInfo *ci, AutoKick *ak)
{
- this->Delete(ak->serialize_name(), ak->serialize());
+ this->Delete(ak->GetSerializeName(), ak->serialize());
}
EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock)
{
- this->Insert(lock->serialize_name(), lock->serialize());
+ this->Insert(lock->GetSerializeName(), lock->serialize());
return EVENT_CONTINUE;
}
EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock)
{
- this->Delete(lock->serialize_name(), lock->serialize());
+ this->Delete(lock->GetSerializeName(), lock->serialize());
return EVENT_CONTINUE;
}
void OnBotCreate(BotInfo *bi)
{
- this->Insert(bi->serialize_name(), bi->serialize());
+ this->Insert(bi->GetSerializeName(), bi->serialize());
}
void OnBotChange(BotInfo *bi)
@@ -357,76 +357,76 @@ class DBMySQL : public Module
void OnBotDelete(BotInfo *bi)
{
- this->Delete(bi->serialize_name(), bi->serialize());
+ this->Delete(bi->GetSerializeName(), bi->serialize());
}
EventReturn OnBotAssign(User *sender, ChannelInfo *ci, BotInfo *bi)
{
- this->Insert(ci->serialize_name(), ci->serialize());
+ this->Insert(ci->GetSerializeName(), ci->serialize());
return EVENT_CONTINUE;
}
EventReturn OnBotUnAssign(User *sender, ChannelInfo *ci)
{
- this->Insert(ci->serialize_name(), ci->serialize());
+ this->Insert(ci->GetSerializeName(), ci->serialize());
return EVENT_CONTINUE;
}
void OnBadWordAdd(ChannelInfo *ci, BadWord *bw)
{
- this->Insert(bw->serialize_name(), bw->serialize());
+ this->Insert(bw->GetSerializeName(), bw->serialize());
}
void OnBadWordDel(ChannelInfo *ci, BadWord *bw)
{
- this->Delete(bw->serialize_name(), bw->serialize());
+ this->Delete(bw->GetSerializeName(), bw->serialize());
}
void OnMemoSend(const Anope::string &source, const Anope::string &target, MemoInfo *mi, Memo *m)
{
- this->Insert(m->serialize_name(), m->serialize());
+ this->Insert(m->GetSerializeName(), m->serialize());
}
void OnMemoDel(const NickCore *nc, MemoInfo *mi, Memo *m)
{
- this->Delete(m->serialize_name(), m->serialize());
+ this->Delete(m->GetSerializeName(), m->serialize());
}
void OnMemoDel(ChannelInfo *ci, MemoInfo *mi, Memo *m)
{
- this->Delete(m->serialize_name(), m->serialize());
+ this->Delete(m->GetSerializeName(), m->serialize());
}
EventReturn OnExceptionAdd(Exception *ex)
{
- this->Insert(ex->serialize_name(), ex->serialize());
+ this->Insert(ex->GetSerializeName(), ex->serialize());
return EVENT_CONTINUE;
}
void OnExceptionDel(User *, Exception *ex)
{
- this->Delete(ex->serialize_name(), ex->serialize());
+ this->Delete(ex->GetSerializeName(), ex->serialize());
}
EventReturn OnAddXLine(XLine *x, XLineManager *xlm)
{
- this->Insert(x->serialize_name(), x->serialize());
+ this->Insert(x->GetSerializeName(), x->serialize());
return EVENT_CONTINUE;
}
void OnDelXLine(User *, XLine *x, XLineManager *xlm)
{
- this->Delete(x->serialize_name(), x->serialize());
+ this->Delete(x->GetSerializeName(), x->serialize());
}
void OnDeleteVhost(NickAlias *na)
{
- this->Insert(na->serialize_name(), na->serialize());
+ this->Insert(na->GetSerializeName(), na->serialize());
}
void OnSetVhost(NickAlias *na)
{
- this->Insert(na->serialize_name(), na->serialize());
+ this->Insert(na->GetSerializeName(), na->serialize());
}
};
diff --git a/modules/database/db_sql_live_write.cpp b/modules/database/db_sql_live_write.cpp
index 5d15d14d3..21b45bdb4 100644
--- a/modules/database/db_sql_live_write.cpp
+++ b/modules/database/db_sql_live_write.cpp
@@ -3,7 +3,7 @@
class SQLCache : public Timer
{
- typedef std::map<Anope::string, time_t, std::less<ci::string> > cache_map;
+ typedef std::map<Anope::string, time_t, ci::less> cache_map;
cache_map cache;
public:
diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp
index 61e6c39c9..189a950d8 100644
--- a/modules/extra/m_mysql.cpp
+++ b/modules/extra/m_mysql.cpp
@@ -123,7 +123,7 @@ class MySQLService : public SQLProvider
SQLResult RunQuery(const SQLQuery &query);
- SQLQuery CreateTable(const Anope::string &table, const SerializableBase::serialized_data &data);
+ SQLQuery CreateTable(const Anope::string &table, const Serializable::serialized_data &data);
SQLQuery GetTables();
@@ -342,10 +342,10 @@ SQLResult MySQLService::RunQuery(const SQLQuery &query)
}
}
-SQLQuery MySQLService::CreateTable(const Anope::string &table, const SerializableBase::serialized_data &data)
+SQLQuery MySQLService::CreateTable(const Anope::string &table, const Serializable::serialized_data &data)
{
Anope::string query_text = "CREATE TABLE `" + table + "` (", key_buf;
- for (SerializableBase::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
+ for (Serializable::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
{
query_text += "`" + it->first + "` ";
if (it->second.getType() == Serialize::DT_INT)
diff --git a/modules/extra/m_proxyscan.cpp b/modules/extra/m_proxyscan.cpp
index 685d984b0..36d9544ec 100644
--- a/modules/extra/m_proxyscan.cpp
+++ b/modules/extra/m_proxyscan.cpp
@@ -9,7 +9,7 @@
struct ProxyCheck
{
- std::set<Anope::string, std::less<ci::string> > types;
+ std::set<Anope::string, ci::less> types;
std::vector<unsigned short> ports;
time_t duration;
Anope::string reason;
@@ -361,7 +361,7 @@ class ModuleProxyScan : public Module
{
ProxyCheck &p = this->proxyscans[i - 1];
- for (std::set<Anope::string, std::less<ci::string> >::iterator it = p.types.begin(), it_end = p.types.end(); it != it_end; ++it)
+ for (std::set<Anope::string, ci::less>::iterator it = p.types.begin(), it_end = p.types.end(); it != it_end; ++it)
{
for (unsigned k = 0; k < p.ports.size(); ++k)
{
diff --git a/modules/extra/m_sqlite.cpp b/modules/extra/m_sqlite.cpp
index 2411f843f..e81bca8ab 100644
--- a/modules/extra/m_sqlite.cpp
+++ b/modules/extra/m_sqlite.cpp
@@ -44,7 +44,7 @@ class SQLiteService : public SQLProvider
SQLResult RunQuery(const SQLQuery &query);
- SQLQuery CreateTable(const Anope::string &table, const SerializableBase::serialized_data &data);
+ SQLQuery CreateTable(const Anope::string &table, const Serializable::serialized_data &data);
SQLQuery GetTables();
@@ -181,10 +181,10 @@ SQLResult SQLiteService::RunQuery(const SQLQuery &query)
return result;
}
-SQLQuery SQLiteService::CreateTable(const Anope::string &table, const SerializableBase::serialized_data &data)
+SQLQuery SQLiteService::CreateTable(const Anope::string &table, const Serializable::serialized_data &data)
{
Anope::string query_text = "CREATE TABLE `" + table + "` (", key_buf;
- for (SerializableBase::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
+ for (Serializable::serialized_data::const_iterator it = data.begin(), it_end = data.end(); it != it_end; ++it)
{
query_text += "`" + it->first + "` ";
if (it->second.getType() == Serialize::DT_INT)
diff --git a/modules/extra/sql.h b/modules/extra/sql.h
index 21b311014..14272ed90 100644
--- a/modules/extra/sql.h
+++ b/modules/extra/sql.h
@@ -117,7 +117,7 @@ class SQLProvider : public Service<Base>
virtual SQLResult RunQuery(const SQLQuery &query) = 0;
- virtual SQLQuery CreateTable(const Anope::string &table, const SerializableBase::serialized_data &data) = 0;
+ virtual SQLQuery CreateTable(const Anope::string &table, const Serializable::serialized_data &data) = 0;
virtual SQLQuery GetTables() = 0;
};
diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp
index d29c2c66e..de24fbfbf 100644
--- a/modules/pseudoclients/operserv.cpp
+++ b/modules/pseudoclients/operserv.cpp
@@ -188,8 +188,6 @@ class OperServCore : public Module
XLineManager::RegisterXLineManager(&sglines);
XLineManager::RegisterXLineManager(&sqlines);
XLineManager::RegisterXLineManager(&snlines);
-
- Serializable<XLine>::Alloc.Register("XLine");
}
~OperServCore()