summaryrefslogtreecommitdiff
path: root/modules/operserv/os_info.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/operserv/os_info.cpp')
-rw-r--r--modules/operserv/os_info.cpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/modules/operserv/os_info.cpp b/modules/operserv/os_info.cpp
index ed111a3cd..05ff6af07 100644
--- a/modules/operserv/os_info.cpp
+++ b/modules/operserv/os_info.cpp
@@ -25,16 +25,26 @@ struct OperInfoImpl final
}
~OperInfoImpl() override;
+};
+
+struct OperInfoTypeImpl
+ : Serialize::Type
+{
+ OperInfoTypeImpl()
+ : Serialize::Type("OperInfo")
+ {
+ }
- void Serialize(Serialize::Data &data) const override
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override
{
- data.Store("target", target);
- data.Store("info", info);
- data.Store("adder", adder);
- data.Store("created", created);
+ const auto *oi = static_cast<const OperInfoImpl *>(obj);
+ data.Store("target", oi->target);
+ data.Store("info", oi->info);
+ data.Store("adder", oi->adder);
+ data.Store("created", oi->created);
}
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &data);
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override;
};
struct OperInfos final
@@ -71,7 +81,7 @@ OperInfoImpl::~OperInfoImpl()
}
}
-Serializable *OperInfoImpl::Unserialize(Serializable *obj, Serialize::Data &data)
+Serializable *OperInfoTypeImpl::Unserialize(Serializable *obj, Serialize::Data &data) const
{
Anope::string starget;
data["target"] >> starget;
@@ -256,7 +266,7 @@ class OSInfo final
{
CommandOSInfo commandosinfo;
ExtensibleItem<OperInfos> oinfo;
- Serialize::Type oinfo_type;
+ OperInfoTypeImpl oinfo_type;
void OnInfo(CommandSource &source, Extensible *e, InfoFormatter &info)
{
@@ -274,10 +284,11 @@ class OSInfo final
}
public:
- OSInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
- commandosinfo(this), oinfo(this, "operinfo"), oinfo_type("OperInfo", OperInfoImpl::Unserialize)
+ OSInfo(const Anope::string &modname, const Anope::string &creator)
+ : Module(modname, creator, VENDOR)
+ , commandosinfo(this)
+ , oinfo(this, "operinfo")
{
-
}
void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) override