summaryrefslogtreecommitdiff
path: root/modules/nickserv/ns_ajoin.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2025-03-12 10:29:11 +0000
committerSadie Powell <sadie@witchery.services>2025-03-12 15:53:52 +0000
commitcdcf0e2f9a8fb0e1c363fc65f71f3131fc6c5ea5 (patch)
tree3a665673235bb4dea58b99474492d90e0f711697 /modules/nickserv/ns_ajoin.cpp
parent718f2e922a6e1113d66fc6e96131213942d507b2 (diff)
Move serialization from Serializable to a Serialize::Type child.
Diffstat (limited to 'modules/nickserv/ns_ajoin.cpp')
-rw-r--r--modules/nickserv/ns_ajoin.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/modules/nickserv/ns_ajoin.cpp b/modules/nickserv/ns_ajoin.cpp
index a169022b1..d60e30f07 100644
--- a/modules/nickserv/ns_ajoin.cpp
+++ b/modules/nickserv/ns_ajoin.cpp
@@ -39,18 +39,28 @@ struct AJoinEntry final
(*channels)->erase(it);
}
}
+};
- void Serialize(Serialize::Data &data) const override
+struct AJoinEntryType final
+ : public Serialize::Type
+{
+ AJoinEntryType()
+ : Serialize::Type("AJoinEntry")
{
- if (!this->owner)
+ }
+
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override
+ {
+ const auto *aj = static_cast<const AJoinEntry *>(obj);
+ if (!aj->owner)
return;
- data.Store("owner", this->owner->display);
- data.Store("channel", this->channel);
- data.Store("key", this->key);
+ data.Store("owner", aj->owner->display);
+ data.Store("channel", aj->channel);
+ data.Store("key", aj->key);
}
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &sd)
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &sd) const override
{
Anope::string sowner;
@@ -305,17 +315,16 @@ class NSAJoin final
{
CommandNSAJoin commandnsajoin;
ExtensibleItem<AJoinList> ajoinlist;
- Serialize::Type ajoinentry_type;
+ AJoinEntryType ajoinentry_type;
public:
- NSAJoin(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
- commandnsajoin(this), ajoinlist(this, "ajoinlist"),
- ajoinentry_type("AJoinEntry", AJoinEntry::Unserialize)
+ NSAJoin(const Anope::string &modname, const Anope::string &creator)
+ : Module(modname, creator, VENDOR)
+ , commandnsajoin(this)
+ , ajoinlist(this, "ajoinlist")
{
-
if (!IRCD || !IRCD->CanSVSJoin)
throw ModuleException("Your IRCd does not support SVSJOIN");
-
}
void OnUserLogin(User *u) override