summaryrefslogtreecommitdiff
path: root/modules/hostserv/hs_request.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/hostserv/hs_request.cpp')
-rw-r--r--modules/hostserv/hs_request.cpp34
1 files changed, 24 insertions, 10 deletions
diff --git a/modules/hostserv/hs_request.cpp b/modules/hostserv/hs_request.cpp
index 7b2da2425..65c92ea9b 100644
--- a/modules/hostserv/hs_request.cpp
+++ b/modules/hostserv/hs_request.cpp
@@ -29,16 +29,26 @@ struct HostRequestImpl final
: Serializable("HostRequest")
{
}
+};
+
+struct HostRequestTypeImpl final
+ : Serialize::Type
+{
+ HostRequestTypeImpl()
+ : Serialize::Type("HostRequest")
+ {
+ }
- void Serialize(Serialize::Data &data) const override
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override
{
- data.Store("nick", this->nick);
- data.Store("ident", this->ident);
- data.Store("host", this->host);
- data.Store("time", this->time);
+ const auto *req = static_cast<const HostRequestImpl *>(obj);
+ data.Store("nick", req->nick);
+ data.Store("ident", req->ident);
+ data.Store("host", req->host);
+ data.Store("time", req->time);
}
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override
{
Anope::string snick;
data["nick"] >> snick;
@@ -360,12 +370,16 @@ class HSRequest final
CommandHSReject commandhsreject;
CommandHSWaiting commandhswaiting;
ExtensibleItem<HostRequestImpl> hostrequest;
- Serialize::Type request_type;
+ HostRequestTypeImpl request_type;
public:
- HSRequest(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
- commandhsrequest(this), commandhsactive(this),
- commandhsreject(this), commandhswaiting(this), hostrequest(this, "hostrequest"), request_type("HostRequest", HostRequestImpl::Unserialize)
+ HSRequest(const Anope::string &modname, const Anope::string &creator)
+ : Module(modname, creator, VENDOR)
+ , commandhsrequest(this)
+ , commandhsactive(this)
+ , commandhsreject(this)
+ , commandhswaiting(this)
+ , hostrequest(this, "hostrequest")
{
if (!IRCD || !IRCD->CanSetVHost)
throw ModuleException("Your IRCd does not support vhosts");