summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/access.h13
-rw-r--r--include/account.h26
-rw-r--r--include/bots.h10
-rw-r--r--include/memo.h11
-rw-r--r--include/modules/operserv/oper.h30
-rw-r--r--include/modules/operserv/session.h34
-rw-r--r--include/regchannel.h24
-rw-r--r--include/serialize.h13
-rw-r--r--include/xline.h13
-rw-r--r--modules/botserv/bs_badwords.cpp30
-rw-r--r--modules/chanserv/cs_entrymsg.cpp33
-rw-r--r--modules/chanserv/cs_log.cpp41
-rw-r--r--modules/chanserv/cs_mode.cpp41
-rw-r--r--modules/chanserv/cs_seen.cpp35
-rw-r--r--modules/chanserv/cs_set_misc.cpp27
-rw-r--r--modules/chanserv/cs_suspend.cpp34
-rw-r--r--modules/database/db_flatfile.cpp2
-rw-r--r--modules/database/db_redis.cpp10
-rw-r--r--modules/database/db_sql.cpp12
-rw-r--r--modules/database/db_sql_live.cpp12
-rw-r--r--modules/hostserv/hs_request.cpp34
-rw-r--r--modules/nickserv/ns_ajoin.cpp33
-rw-r--r--modules/nickserv/ns_set_misc.cpp28
-rw-r--r--modules/nickserv/ns_suspend.cpp34
-rw-r--r--modules/operserv/os_dns.cpp102
-rw-r--r--modules/operserv/os_forbid.cpp40
-rw-r--r--modules/operserv/os_ignore.cpp35
-rw-r--r--modules/operserv/os_info.cpp33
-rw-r--r--modules/operserv/os_news.cpp39
-rw-r--r--modules/operserv/os_oper.cpp48
-rw-r--r--modules/operserv/os_session.cpp51
-rw-r--r--modules/operserv/os_stats.cpp23
-rw-r--r--src/access.cpp27
-rw-r--r--src/bots.cpp26
-rw-r--r--src/memos.cpp22
-rw-r--r--src/nickalias.cpp40
-rw-r--r--src/nickcore.cpp30
-rw-r--r--src/regchannel.cpp75
-rw-r--r--src/serialize.cpp20
-rw-r--r--src/xline.cpp27
40 files changed, 772 insertions, 446 deletions
diff --git a/include/access.h b/include/access.h
index ad420d785..aa1430b7e 100644
--- a/include/access.h
+++ b/include/access.h
@@ -74,6 +74,16 @@ public:
class CoreExport ChanAccess
: public Serializable
{
+public:
+ struct Type final
+ : public Serialize::Type
+ {
+ Type();
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override;
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override;
+ };
+
+private:
Anope::string mask;
/* account this access entry is for, if any */
Serialize::Reference<NickCore> nc;
@@ -97,9 +107,6 @@ public:
const Anope::string &Mask() const;
NickCore *GetAccount() const;
- void Serialize(Serialize::Data &data) const override;
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
-
static const unsigned int MAX_DEPTH = 4;
/** Check if this access entry matches the given user or account
diff --git a/include/account.h b/include/account.h
index 5c2e52fd2..02e71ac38 100644
--- a/include/account.h
+++ b/include/account.h
@@ -32,6 +32,16 @@ class CoreExport NickAlias final
: public Serializable
, public Extensible
{
+public:
+ struct Type final
+ : public Serialize::Type
+ {
+ Type();
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override;
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override;
+ };
+
+private:
Anope::string vhost_ident, vhost_host, vhost_creator;
time_t vhost_created = 0;
@@ -56,9 +66,6 @@ public:
NickAlias(const Anope::string &nickname, NickCore *nickcore);
~NickAlias();
- void Serialize(Serialize::Data &data) const override;
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
-
/** Set a vhost for the user
* @param ident The ident
* @param host The host
@@ -116,6 +123,16 @@ class CoreExport NickCore final
: public Serializable
, public Extensible
{
+public:
+ struct Type final
+ : public Serialize::Type
+ {
+ Type();
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override;
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override;
+ };
+
+private:
/* Channels which reference this core in some way (this is on their access list, akick list, is founder, successor, etc) */
Serialize::Checker<std::map<ChannelInfo *, int> > chanaccess;
/* Unique identifier for the account. */
@@ -159,9 +176,6 @@ public:
NickCore(const Anope::string &nickdisplay, uint64_t nickid = 0);
~NickCore();
- void Serialize(Serialize::Data &data) const override;
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
-
/** Changes the display for this account
* @param na The new display, must be grouped to this account.
*/
diff --git a/include/bots.h b/include/bots.h
index 5a9c54a3e..d5e935d14 100644
--- a/include/bots.h
+++ b/include/bots.h
@@ -23,6 +23,16 @@ class CoreExport BotInfo final
: public User
, public Serializable
{
+public:
+ struct Type final
+ : public Serialize::Type
+ {
+ Type();
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override;
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override;
+ };
+
+private:
/* Channels this bot is assigned to */
Serialize::Checker<std::set<ChannelInfo *> > channels;
public:
diff --git a/include/memo.h b/include/memo.h
index dca35ea8e..4d5a43af2 100644
--- a/include/memo.h
+++ b/include/memo.h
@@ -18,15 +18,20 @@ class CoreExport Memo final
: public Serializable
{
public:
+ struct Type final
+ : public Serialize::Type
+ {
+ Type();
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override;
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override;
+ };
+
MemoInfo *mi;
bool unread;
bool receipt;
Memo();
~Memo();
- void Serialize(Serialize::Data &data) const override;
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
-
Anope::string owner;
/* When it was sent */
time_t time;
diff --git a/include/modules/operserv/oper.h b/include/modules/operserv/oper.h
index 154b6af08..60511d7b5 100644
--- a/include/modules/operserv/oper.h
+++ b/include/modules/operserv/oper.h
@@ -13,34 +13,4 @@ struct MyOper final
, Serializable
{
MyOper(const Anope::string &n, OperType *o) : Oper(n, o), Serializable("Oper") { }
-
- void Serialize(Serialize::Data &data) const override
- {
- data.Store("name", this->name);
- data.Store("type", this->ot->GetName());
- }
-
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
- {
- Anope::string stype, sname;
-
- data["type"] >> stype;
- data["name"] >> sname;
-
- OperType *ot = OperType::Find(stype);
- if (ot == NULL)
- return NULL;
- NickCore *nc = NickCore::Find(sname);
- if (nc == NULL)
- return NULL;
-
- MyOper *myo;
- if (obj)
- myo = anope_dynamic_static_cast<MyOper *>(obj);
- else
- myo = new MyOper(nc->display, ot);
- nc->o = myo;
- Log(LOG_NORMAL, "operserv/oper") << "Tied oper " << nc->display << " to type " << ot->GetName();
- return myo;
- }
};
diff --git a/include/modules/operserv/session.h b/include/modules/operserv/session.h
index 0f25f669e..c7f5a67e7 100644
--- a/include/modules/operserv/session.h
+++ b/include/modules/operserv/session.h
@@ -28,8 +28,6 @@ struct Exception final
time_t expires; /* Time when it expires. 0 == no expiry */
Exception() : Serializable("Exception") { }
- void Serialize(Serialize::Data &data) const override;
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &data);
};
class SessionService
@@ -59,35 +57,3 @@ public:
};
static ServiceReference<SessionService> session_service("SessionService", "session");
-
-void Exception::Serialize(Serialize::Data &data) const
-{
- data.Store("mask", this->mask);
- data.Store("limit", this->limit);
- data.Store("who", this->who);
- data.Store("reason", this->reason);
- data.Store("time", this->time);
- data.Store("expires", this->expires);
-}
-
-Serializable *Exception::Unserialize(Serializable *obj, Serialize::Data &data)
-{
- if (!session_service)
- return NULL;
-
- Exception *ex;
- if (obj)
- ex = anope_dynamic_static_cast<Exception *>(obj);
- else
- ex = new Exception;
- data["mask"] >> ex->mask;
- data["limit"] >> ex->limit;
- data["who"] >> ex->who;
- data["reason"] >> ex->reason;
- data["time"] >> ex->time;
- data["expires"] >> ex->expires;
-
- if (!obj)
- session_service->AddException(ex);
- return ex;
-}
diff --git a/include/regchannel.h b/include/regchannel.h
index 9a7bf9880..22e3a0474 100644
--- a/include/regchannel.h
+++ b/include/regchannel.h
@@ -25,6 +25,14 @@ class CoreExport AutoKick final
: public Serializable
{
public:
+ struct Type final
+ : public Serialize::Type
+ {
+ Type();
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override;
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override;
+ };
+
/* Channel this autokick is on */
Serialize::Reference<ChannelInfo> ci;
@@ -38,8 +46,6 @@ public:
AutoKick();
~AutoKick();
- void Serialize(Serialize::Data &data) const override;
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
};
/* It matters that Base is here before Extensible (it is inherited by Serializable)
@@ -48,9 +54,18 @@ class CoreExport ChannelInfo final
: public Serializable
, public Extensible
{
+public:
+ struct Type final
+ : public Serialize::Type
+ {
+ Type();
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override;
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override;
+ };
+
+private:
/* channels who reference this one */
Anope::map<int> references;
-private:
Serialize::Reference<NickCore> founder; /* Channel founder */
Serialize::Reference<NickCore> successor; /* Who gets the channel if the founder nick is dropped or expires */
Serialize::Checker<std::vector<ChanAccess *> > access; /* List of authorized users */
@@ -97,9 +112,6 @@ public:
~ChannelInfo();
ChannelInfo &operator=(const ChannelInfo &) = default;
- void Serialize(Serialize::Data &data) const override;
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
-
/** Change the founder of the channel
* @params nc The new founder
*/
diff --git a/include/serialize.h b/include/serialize.h
index dd721e693..c212f432f 100644
--- a/include/serialize.h
+++ b/include/serialize.h
@@ -123,8 +123,6 @@ public:
*/
Serialize::Type *GetSerializableType() const { return this->s_type; }
- virtual void Serialize(Serialize::Data &data) const = 0;
-
static const std::list<Serializable *> &GetItems();
};
@@ -132,17 +130,14 @@ public:
* of class that inherits from Serializable. Used for unserializing objects
* of this type, as it requires a function pointer to a static member function.
*/
-class CoreExport Serialize::Type final
+class CoreExport Serialize::Type
: public Base
{
- typedef Serializable *(*unserialize_func)(Serializable *obj, Serialize::Data &);
-
static std::vector<Anope::string> TypeOrder;
static std::map<Anope::string, Serialize::Type *> Types;
/* The name of this type, should be a class name */
Anope::string name;
- unserialize_func unserialize;
/* Owner of this type. Used for placing objects of this type in separate databases
* based on what module, if any, owns it.
*/
@@ -160,10 +155,9 @@ public:
/** Creates a new serializable type
* @param n Type name
- * @param f Func to unserialize objects
* @param owner Owner of this type. Leave NULL for the core.
*/
- Type(const Anope::string &n, unserialize_func f, Module *owner = NULL);
+ Type(const Anope::string &n, Module *owner = NULL);
~Type();
/** Gets the name for this type
@@ -177,7 +171,8 @@ public:
* @param data The data to unserialize
* @return The unserialized object. If obj != NULL this should be obj.
*/
- Serializable *Unserialize(Serializable *obj, Serialize::Data &data);
+ virtual void Serialize(const Serializable *obj, Serialize::Data &data) const = 0;
+ virtual Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const = 0;
/** Check if this object type has any pending changes and update them.
*/
diff --git a/include/xline.h b/include/xline.h
index ebd88e928..2db1d4b4a 100644
--- a/include/xline.h
+++ b/include/xline.h
@@ -16,6 +16,16 @@
class CoreExport XLine final
: public Serializable
{
+public:
+ struct Type final
+ : public Serialize::Type
+ {
+ Type();
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override;
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override;
+ };
+
+private:
void Init();
Anope::string nick, user, host, real;
public:
@@ -43,9 +53,6 @@ public:
bool HasNickOrReal() const;
bool IsRegex() const;
-
- void Serialize(Serialize::Data &data) const override;
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &data);
};
/* Managers XLines. There is one XLineManager per type of XLine. */
diff --git a/modules/botserv/bs_badwords.cpp b/modules/botserv/bs_badwords.cpp
index e1a283eb7..946549713 100644
--- a/modules/botserv/bs_badwords.cpp
+++ b/modules/botserv/bs_badwords.cpp
@@ -18,15 +18,25 @@ struct BadWordImpl final
{
BadWordImpl() : Serializable("BadWord") { }
~BadWordImpl() override;
+};
+
+struct BadWordTypeImpl final
+ : Serialize::Type
+{
+ BadWordTypeImpl()
+ : Serialize::Type("BadWord")
+ {
+ }
- void Serialize(Serialize::Data &data) const override
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override
{
- data.Store("ci", this->chan);
- data.Store("word", this->word);
- data.Store("type", this->type);
+ const auto *bw = static_cast<const BadWordImpl *>(obj);
+ data.Store("ci", bw->chan);
+ data.Store("word", bw->word);
+ data.Store("type", bw->type);
}
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &) const override;
};
struct BadWordsImpl final
@@ -117,7 +127,7 @@ BadWordImpl::~BadWordImpl()
}
}
-Serializable *BadWordImpl::Unserialize(Serializable *obj, Serialize::Data &data)
+Serializable *BadWordTypeImpl::Unserialize(Serializable *obj, Serialize::Data &data) const
{
Anope::string sci, sword;
@@ -464,11 +474,13 @@ class BSBadwords final
{
CommandBSBadwords commandbsbadwords;
ExtensibleItem<BadWordsImpl> badwords;
- Serialize::Type badword_type;
+ BadWordTypeImpl badword_type;
public:
- BSBadwords(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
- commandbsbadwords(this), badwords(this, "badwords"), badword_type("BadWord", BadWordImpl::Unserialize)
+ BSBadwords(const Anope::string &modname, const Anope::string &creator)
+ : Module(modname, creator, VENDOR)
+ , commandbsbadwords(this)
+ , badwords(this, "badwords")
{
}
};
diff --git a/modules/chanserv/cs_entrymsg.cpp b/modules/chanserv/cs_entrymsg.cpp
index 01fa5e445..bbb3f03cb 100644
--- a/modules/chanserv/cs_entrymsg.cpp
+++ b/modules/chanserv/cs_entrymsg.cpp
@@ -29,16 +29,26 @@ struct EntryMsgImpl final
}
~EntryMsgImpl() override;
+};
+
+struct EntryMsgTypeImpl final
+ : Serialize::Type
+{
+ EntryMsgTypeImpl()
+ : Serialize::Type("EntryMsg")
+ {
+ }
- void Serialize(Serialize::Data &data) const override
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override
{
- data.Store("ci", this->chan);
- data.Store("creator", this->creator);
- data.Store("message", this->message);
- data.Store("when", this->when);
+ const auto *msg = static_cast<const EntryMsgImpl *>(obj);
+ data.Store("ci", msg->chan);
+ data.Store("creator", msg->creator);
+ data.Store("message", msg->message);
+ data.Store("when", msg->when);
}
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &data);
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override;
};
struct EntryMessageListImpl final
@@ -68,7 +78,7 @@ EntryMsgImpl::~EntryMsgImpl()
}
-Serializable *EntryMsgImpl::Unserialize(Serializable *obj, Serialize::Data &data)
+Serializable *EntryMsgTypeImpl::Unserialize(Serializable *obj, Serialize::Data &data) const
{
Anope::string sci, screator, smessage;
time_t swhen;
@@ -264,12 +274,13 @@ class CSEntryMessage final
{
CommandEntryMessage commandentrymsg;
ExtensibleItem<EntryMessageListImpl> eml;
- Serialize::Type entrymsg_type;
+ EntryMsgTypeImpl entrymsg_type;
public:
- CSEntryMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
- commandentrymsg(this),
- eml(this, "entrymsg"), entrymsg_type("EntryMsg", EntryMsgImpl::Unserialize)
+ CSEntryMessage(const Anope::string &modname, const Anope::string &creator)
+ : Module(modname, creator, VENDOR)
+ , commandentrymsg(this)
+ , eml(this, "entrymsg")
{
}
diff --git a/modules/chanserv/cs_log.cpp b/modules/chanserv/cs_log.cpp
index 3da80b713..e704b7021 100644
--- a/modules/chanserv/cs_log.cpp
+++ b/modules/chanserv/cs_log.cpp
@@ -34,20 +34,30 @@ struct LogSettingImpl final
}
}
}
+};
+
+struct LogSettingTypeImpl final
+ : Serialize::Type
+{
+ LogSettingTypeImpl()
+ : Serialize::Type("LogSetting")
+ {
+ }
- void Serialize(Serialize::Data &data) const override
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override
{
- data.Store("ci", chan);
- data.Store("service_name", service_name);
- data.Store("command_service", command_service);
- data.Store("command_name", command_name);
- data.Store("method", method);
- data.Store("extra", extra);
- data.Store("creator", creator);
- data.Store("created", created);
+ const auto *ls = static_cast<const LogSettingImpl *>(obj);
+ data.Store("ci", ls->chan);
+ data.Store("service_name", ls->service_name);
+ data.Store("command_service", ls->command_service);
+ data.Store("command_name", ls->command_name);
+ data.Store("method", ls->method);
+ data.Store("extra", ls->extra);
+ data.Store("creator", ls->creator);
+ data.Store("created", ls->created);
}
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override
{
Anope::string sci;
data["ci"] >> sci;
@@ -291,7 +301,7 @@ class CSLog final
ServiceReference<MemoServService> MSService;
CommandCSLog commandcslog;
ExtensibleItem<LogSettingsImpl> logsettings;
- Serialize::Type logsetting_type;
+ LogSettingTypeImpl logsetting_type;
struct LogDefault final
{
@@ -301,11 +311,12 @@ class CSLog final
std::vector<LogDefault> defaults;
public:
- CSLog(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
- MSService("MemoServService", "MemoServ"), commandcslog(this),
- logsettings(this, "logsettings"), logsetting_type("LogSetting", LogSettingImpl::Unserialize)
+ CSLog(const Anope::string &modname, const Anope::string &creator)
+ : Module(modname, creator, VENDOR)
+ , MSService("MemoServService", "MemoServ")
+ , commandcslog(this)
+ , logsettings(this, "logsettings")
{
-
}
void OnReload(Configuration::Conf &conf) override
diff --git a/modules/chanserv/cs_mode.cpp b/modules/chanserv/cs_mode.cpp
index d20d92581..20638973b 100644
--- a/modules/chanserv/cs_mode.cpp
+++ b/modules/chanserv/cs_mode.cpp
@@ -30,9 +30,17 @@ struct ModeLockImpl final
ml->RemoveMLock(this);
}
}
+};
- void Serialize(Serialize::Data &data) const override;
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &data);
+struct ModeLockTypeImpl final
+ : Serialize::Type
+{
+ ModeLockTypeImpl()
+ : Serialize::Type("ModeLock")
+ {
+ }
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override;
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override;
};
struct ModeLocksImpl final
@@ -203,17 +211,18 @@ struct ModeLocksImpl final
}
};
-void ModeLockImpl::Serialize(Serialize::Data &data) const
+void ModeLockTypeImpl::Serialize(const Serializable *obj, Serialize::Data &data) const
{
- data.Store("ci", this->ci);
- data.Store("set", this->set);
- data.Store("name", this->name);
- data.Store("param", this->param);
- data.Store("setter", this->setter);
- data.Store("created", this->created);
+ const auto *ml = static_cast<const ModeLockImpl *>(obj);
+ data.Store("ci", ml->ci);
+ data.Store("set", ml->set);
+ data.Store("name", ml->name);
+ data.Store("param", ml->param);
+ data.Store("setter", ml->setter);
+ data.Store("created", ml->created);
}
-Serializable *ModeLockImpl::Unserialize(Serializable *obj, Serialize::Data &data)
+Serializable *ModeLockTypeImpl::Unserialize(Serializable *obj, Serialize::Data &data) const
{
Anope::string sci;
@@ -935,15 +944,15 @@ class CSMode final
CommandCSMode commandcsmode;
CommandCSModes commandcsmodes;
ExtensibleItem<ModeLocksImpl> modelocks;
- Serialize::Type modelocks_type;
+ ModeLockTypeImpl modelocks_type;
public:
- CSMode(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
- commandcsmode(this), commandcsmodes(this),
- modelocks(this, "modelocks"),
- modelocks_type("ModeLock", ModeLockImpl::Unserialize)
+ CSMode(const Anope::string &modname, const Anope::string &creator)
+ : Module(modname, creator, VENDOR)
+ , commandcsmode(this)
+ , commandcsmodes(this)
+ , modelocks(this, "modelocks")
{
-
}
void OnReload(Configuration::Conf &conf) override
diff --git a/modules/chanserv/cs_seen.cpp b/modules/chanserv/cs_seen.cpp
index d8e4e118b..835e3b124 100644
--- a/modules/chanserv/cs_seen.cpp
+++ b/modules/chanserv/cs_seen.cpp
@@ -43,19 +43,29 @@ struct SeenInfo final
if (iter != database.end() && iter->second == this)
database.erase(iter);
}
+};
+
+struct SeenInfoType final
+ : Serialize::Type
+{
+ SeenInfoType()
+ : Serialize::Type("SeenInfo")
+ {
+ }
- void Serialize(Serialize::Data &data) const override
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override
{
- data.Store("nick", nick);
- data.Store("vhost", vhost);
- data.Store("type", type);
- data.Store("nick2", nick2);
- data.Store("channel", channel);
- data.Store("message", message);
- data.Store("last", last);
+ const auto *s = static_cast<const SeenInfo *>(obj);
+ data.Store("nick", s->nick);
+ data.Store("vhost", s->vhost);
+ data.Store("type", s->type);
+ data.Store("nick2", s->nick2);
+ data.Store("channel", s->channel);
+ data.Store("message", s->message);
+ data.Store("last", s->last);
}
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override
{
Anope::string snick;
@@ -374,11 +384,14 @@ public:
class CSSeen final
: public Module
{
- Serialize::Type seeninfo_type;
+ SeenInfoType seeninfo_type;
CommandSeen commandseen;
CommandOSSeen commandosseen;
public:
- CSSeen(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), seeninfo_type("SeenInfo", SeenInfo::Unserialize), commandseen(this), commandosseen(this)
+ CSSeen(const Anope::string &modname, const Anope::string &creator)
+ : Module(modname, creator, VENDOR)
+ , commandseen(this)
+ , commandosseen(this)
{
}
diff --git a/modules/chanserv/cs_set_misc.cpp b/modules/chanserv/cs_set_misc.cpp
index 4439589a8..71afbe942 100644
--- a/modules/chanserv/cs_set_misc.cpp
+++ b/modules/chanserv/cs_set_misc.cpp
@@ -44,15 +44,25 @@ struct CSMiscData final
name = n;
data = d;
}
+};
+
+struct CSMiscDataType
+ : Serialize::Type
+{
+ CSMiscDataType()
+ : Serialize::Type("CSMiscData")
+ {
+ }
- void Serialize(Serialize::Data &sdata) const override
+ void Serialize(const Serializable *obj, Serialize::Data &sdata) const override
{
- sdata.Store("ci", this->object);
- sdata.Store("name", this->name);
- sdata.Store("data", this->data);
+ const auto *d = static_cast<const CSMiscData *>(obj);
+ sdata.Store("ci", d->object);
+ sdata.Store("name", d->name);
+ sdata.Store("data", d->data);
}
- static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
+ Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override
{
Anope::string sci, sname, sdata;
@@ -172,11 +182,12 @@ class CSSetMisc final
: public Module
{
CommandCSSetMisc commandcssetmisc;
- Serialize::Type csmiscdata_type;
+ CSMiscDataType csmiscdata_type;
public:
- CSSetMisc(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
- commandcssetmisc(this), csmiscdata_type("CSMiscData", CSMiscData::Unserialize)
+ CSSetMisc(const Anope::string &modname, const Anope::string &creator)
+ : Module(modname, creator, VENDOR)
+ , commandcssetmisc(this)
{
me = this;
}
diff --git a/modules/chanserv/cs_suspend.cpp b/modules/chanserv/cs_suspend.cpp
index b06fa195a..bda608481 100644
--- a/modules/chanserv/cs_suspend.cpp
+++ b/modules/chanserv/cs_suspend.cpp
@@ -17,17 +17,27 @@ struct CSSuspendInfo final
, Serializable
{
CSSuspendInfo(Extensible *) : Serializable("CSSuspendInfo") { }
+};
+
+struct CSSuspendInfoType final
+ : Serialize::Type
+{
+ CSSuspendInfoType()
+ : Serialize::Type("CSSuspendInfo")
+ {
+ }
- void Serialize(Serialize::Data &data) const override
+ void Serialize(const Serializable *obj, Serialize::Data &data) const override
{
- data.Store("chan", what);
- d