diff options
author | Sadie Powell <sadie@witchery.services> | 2025-03-12 10:29:11 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2025-03-12 15:53:52 +0000 |
commit | cdcf0e2f9a8fb0e1c363fc65f71f3131fc6c5ea5 (patch) | |
tree | 3a665673235bb4dea58b99474492d90e0f711697 /src/bots.cpp | |
parent | 718f2e922a6e1113d66fc6e96131213942d507b2 (diff) |
Move serialization from Serializable to a Serialize::Type child.
Diffstat (limited to 'src/bots.cpp')
-rw-r--r-- | src/bots.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/bots.cpp b/src/bots.cpp index 35a4ccb05..fa9042733 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -84,19 +84,25 @@ BotInfo::~BotInfo() BotListByUID->erase(this->uid); } -void BotInfo::Serialize(Serialize::Data &data) const +BotInfo::Type::Type() + : Serialize::Type("BotInfo") { - data.Store("nick", this->nick); - data.Store("user", this->ident); - data.Store("host", this->host); - data.Store("realname", this->realname); - data.Store("created", this->created); - data.Store("oper_only", this->oper_only); - - Extensible::ExtensibleSerialize(this, this, data); } -Serializable *BotInfo::Unserialize(Serializable *obj, Serialize::Data &data) +void BotInfo::Type::Serialize(const Serializable *obj, Serialize::Data &data) const +{ + const auto *bi = static_cast<const BotInfo *>(obj); + data.Store("nick", bi->nick); + data.Store("user", bi->ident); + data.Store("host", bi->host); + data.Store("realname", bi->realname); + data.Store("created", bi->created); + data.Store("oper_only", bi->oper_only); + + Extensible::ExtensibleSerialize(bi, bi, data); +} + +Serializable *BotInfo::Type::Unserialize(Serializable *obj, Serialize::Data &data) const { Anope::string nick, user, host, realname, flags; |