diff options
Diffstat (limited to 'modules/commands')
-rw-r--r-- | modules/commands/bs_kick.cpp | 2 | ||||
-rw-r--r-- | modules/commands/cs_access.cpp | 43 | ||||
-rw-r--r-- | modules/commands/cs_entrymsg.cpp | 9 | ||||
-rw-r--r-- | modules/commands/cs_flags.cpp | 41 | ||||
-rw-r--r-- | modules/commands/cs_seen.cpp | 11 | ||||
-rw-r--r-- | modules/commands/cs_set_misc.cpp | 9 | ||||
-rw-r--r-- | modules/commands/cs_suspend.cpp | 11 | ||||
-rw-r--r-- | modules/commands/cs_xop.cpp | 39 | ||||
-rw-r--r-- | modules/commands/hs_request.cpp | 9 | ||||
-rw-r--r-- | modules/commands/ns_ajoin.cpp | 9 | ||||
-rw-r--r-- | modules/commands/ns_set_misc.cpp | 9 | ||||
-rw-r--r-- | modules/commands/ns_suspend.cpp | 11 | ||||
-rw-r--r-- | modules/commands/os_forbid.cpp | 6 | ||||
-rw-r--r-- | modules/commands/os_forbid.h | 10 | ||||
-rw-r--r-- | modules/commands/os_ignore.cpp | 5 | ||||
-rw-r--r-- | modules/commands/os_ignore.h | 7 | ||||
-rw-r--r-- | modules/commands/os_news.cpp | 6 | ||||
-rw-r--r-- | modules/commands/os_news.h | 7 | ||||
-rw-r--r-- | modules/commands/os_oper.cpp | 9 | ||||
-rw-r--r-- | modules/commands/os_session.cpp | 5 | ||||
-rw-r--r-- | modules/commands/os_session.h | 10 |
21 files changed, 85 insertions, 183 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; |