diff options
Diffstat (limited to 'modules/botserv')
| -rw-r--r-- | modules/botserv/bs_badwords.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
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") { } }; |
