summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2016-12-01 09:25:53 -0500
committerAdam <Adam@anope.org>2016-12-01 09:25:53 -0500
commitca28f9cfcbff0fbdb2afe96f1427245f83db7c47 (patch)
treeac5de801a4db01a7cb689ec670537ad74c7c53e6
parent2f512281029fbf4f7ef9832e05804831ad2d9ba2 (diff)
Allow objects to opt out of gc, don't gc accounts with users logged in
Also store cached state with the field by using Serialize::Storage for field storage
-rw-r--r--include/bots.h6
-rw-r--r--include/modules/chanserv/chanaccess.h10
-rw-r--r--include/modules/nickserv/account.h2
-rw-r--r--include/opertype.h4
-rw-r--r--include/serialize.h106
-rw-r--r--include/xline.h4
-rw-r--r--modules/botserv/badwords.cpp9
-rw-r--r--modules/botserv/kick.cpp67
-rw-r--r--modules/chanserv/access.cpp2
-rw-r--r--modules/chanserv/akick.cpp11
-rw-r--r--modules/chanserv/entrymsg.cpp9
-rw-r--r--modules/chanserv/flags.cpp2
-rw-r--r--modules/chanserv/log.cpp9
-rw-r--r--modules/chanserv/main/channel.h51
-rw-r--r--modules/chanserv/main/level.h9
-rw-r--r--modules/chanserv/main/mode.h7
-rw-r--r--modules/chanserv/mode.cpp11
-rw-r--r--modules/chanserv/set_misc.cpp7
-rw-r--r--modules/chanserv/suspend.cpp9
-rw-r--r--modules/chanserv/xop.cpp2
-rw-r--r--modules/database/sql.cpp24
-rw-r--r--modules/hostserv/main/vhost.h12
-rw-r--r--modules/hostserv/request.cpp9
-rw-r--r--modules/memoserv/main/ignore.h7
-rw-r--r--modules/memoserv/main/memo.h11
-rw-r--r--modules/memoserv/main/memoinfo.h9
-rw-r--r--modules/nickserv/access.cpp7
-rw-r--r--modules/nickserv/ajoin.cpp7
-rw-r--r--modules/nickserv/cert.cpp7
-rw-r--r--modules/nickserv/main/account.cpp5
-rw-r--r--modules/nickserv/main/account.h30
-rw-r--r--modules/nickserv/main/mode.h7
-rw-r--r--modules/nickserv/main/nick.h11
-rw-r--r--modules/nickserv/set_misc.cpp7
-rw-r--r--modules/nickserv/suspend.cpp9
-rw-r--r--modules/operserv/dns.cpp27
-rw-r--r--modules/operserv/forbid.cpp9
-rw-r--r--modules/operserv/ignore.cpp7
-rw-r--r--modules/operserv/info.cpp9
-rw-r--r--modules/operserv/news.cpp9
-rw-r--r--modules/operserv/session.cpp9
-rw-r--r--modules/operserv/stats.cpp5
-rw-r--r--src/serialize.cpp41
43 files changed, 308 insertions, 307 deletions
diff --git a/include/bots.h b/include/bots.h
index 0fa35e8a1..928107ef3 100644
--- a/include/bots.h
+++ b/include/bots.h
@@ -133,9 +133,9 @@ class BotInfo : public Serialize::Object
{
friend class BotInfoType;
- Anope::string nick, user, host, realname;
- time_t created = 0;
- bool operonly = false;
+ Serialize::Storage<Anope::string> nick, user, host, realname;
+ Serialize::Storage<time_t> created;
+ Serialize::Storage<bool> operonly;
public:
static constexpr const char *const NAME = "botinfo";
diff --git a/include/modules/chanserv/chanaccess.h b/include/modules/chanserv/chanaccess.h
index 2d3aec96b..faaf48175 100644
--- a/include/modules/chanserv/chanaccess.h
+++ b/include/modules/chanserv/chanaccess.h
@@ -34,10 +34,10 @@ class CoreExport ChanAccess : public Serialize::Object
public:
static constexpr const char *const NAME = "access";
- Channel *channel = nullptr;
- Serialize::Object *object = nullptr;
- Anope::string creator, mask;
- time_t last_seen = 0, created = 0;
+ Serialize::Storage<Channel *> channel;
+ Serialize::Storage<Serialize::Object *> object;
+ Serialize::Storage<Anope::string> creator, mask;
+ Serialize::Storage<time_t> last_seen, created;
using Serialize::Object::Object;
@@ -131,4 +131,4 @@ class CoreExport ChanAccess : public Serialize::Object
}
};
-} // namespace ChanServ \ No newline at end of file
+} // namespace ChanServ
diff --git a/include/modules/nickserv/account.h b/include/modules/nickserv/account.h
index 511b1220f..ebe1061b6 100644
--- a/include/modules/nickserv/account.h
+++ b/include/modules/nickserv/account.h
@@ -30,7 +30,7 @@ class CoreExport Account : public Serialize::Object
public:
static constexpr const char *const NAME = "account";
-#warning "this gets lost"
+#warning "move lastmail to a field"
/* Last time an email was sent to this user */
time_t lastmail = 0;
/* Users online now logged into this account */
diff --git a/include/opertype.h b/include/opertype.h
index 2d36dfad6..46361d576 100644
--- a/include/opertype.h
+++ b/include/opertype.h
@@ -27,8 +27,8 @@ class Oper : public Serialize::Object
{
friend class OperBlockType;
- Anope::string name, password, certfp, host, vhost, type;
- bool require_oper = false;
+ Serialize::Storage<Anope::string> name, password, certfp, host, vhost, type;
+ Serialize::Storage<bool> require_oper;
public:
static constexpr const char *const NAME = "oper";
diff --git a/include/serialize.h b/include/serialize.h
index 0b420bff0..67be96c0c 100644
--- a/include/serialize.h
+++ b/include/serialize.h
@@ -36,6 +36,8 @@ namespace Serialize
template<typename, typename> class Field;
template<typename, typename> class ObjectField;
+ template<typename> class Storage;
+
template<typename T, typename> class Type;
template<typename T> class Reference;
@@ -60,7 +62,7 @@ namespace Serialize
template<typename T>
inline T New();
- extern void Clear();
+ extern void GC();
extern void Unregister(Module *);
@@ -216,16 +218,21 @@ class CoreExport Serialize::Object : public Extensible, public virtual Base
* which can unset (vs set to the default value)
*/
bool HasFieldS(const Anope::string &name);
+
+ /** Whether or not the object can be garbage collected.
+ * Should be true unless your object holds in-memory only
+ * state.
+ */
+ virtual bool CanGC() { return true; }
+
+ void Wipe();
};
class CoreExport Serialize::TypeBase : public Service
{
Anope::string name;
- /* Owner of this type. Used for placing objects of this type in separate databases
- * based on what module, if any, owns it.
- */
- Module *owner;
+ Module *owner = nullptr;
public:
static constexpr const char *NAME = "typebase";
@@ -396,6 +403,8 @@ class Serialize::FieldBase : public Service
*/
virtual void UnsetS(Object *) anope_abstract;
+ virtual void Uncache(Object *) anope_abstract;
+
virtual Anope::string GetTypeName() { return ""; }
};
@@ -426,18 +435,21 @@ class Serialize::CommonFieldBase : public FieldTypeBase<T>
*/
ExtensibleItem<T> *ext = nullptr;
- /** Field pointer to storage in the TypeImpl object for
- * this field.
+ /** Storage pointer in the TypeImpl object for this field.
*/
- T TypeImpl::*field = nullptr;
+ Serialize::Storage<T> TypeImpl::*storage = nullptr;
protected:
/** Set the value of a field in storage
*/
void Set_(TypeImpl *object, const T &value)
{
- if (field != nullptr)
- object->*field = value;
+ if (storage != nullptr)
+ {
+ Serialize::Storage<T> &s = object->*storage;
+ s.t = value;
+ s.cached = true;
+ }
else if (ext != nullptr)
ext->Set(object, value);
else
@@ -448,8 +460,8 @@ class Serialize::CommonFieldBase : public FieldTypeBase<T>
*/
T* Get_(TypeImpl *object)
{
- if (field != nullptr)
- return &(object->*field);
+ if (storage != nullptr)
+ return &(object->*storage).t;
else if (ext != nullptr)
return ext->Get(object);
else
@@ -460,8 +472,12 @@ class Serialize::CommonFieldBase : public FieldTypeBase<T>
*/
void Unset_(TypeImpl *object)
{
- if (field != nullptr)
- object->*field = T();
+ if (storage != nullptr)
+ {
+ Serialize::Storage<T> &s = object->*storage;
+ s.t = T();
+ s.cached = false;
+ }
else if (ext != nullptr)
ext->Unset(object);
else
@@ -473,7 +489,7 @@ class Serialize::CommonFieldBase : public FieldTypeBase<T>
*/
bool HasField_(TypeImpl *object)
{
- if (field != nullptr)
+ if (storage != nullptr)
return true;
else if (ext != nullptr)
return ext->HasExt(object);
@@ -481,13 +497,17 @@ class Serialize::CommonFieldBase : public FieldTypeBase<T>
throw CoreException("No field or ext");
}
- public:
- CommonFieldBase(Serialize::TypeBase *t, const Anope::string &n, bool d)
- : FieldTypeBase<T>(t->GetOwner(), n, t->GetName(), d)
+ bool Cached_(TypeImpl *object)
{
- ext = new ExtensibleItem<T>(t->GetOwner(), t->GetName(), n);
+ if (storage != nullptr)
+ return (object->*storage).cached;
+ else if (ext != nullptr)
+ return ext->HasExt(object);
+ else
+ throw CoreException("No field or ext");
}
+ public:
CommonFieldBase(Module *creator, const Anope::string &n, bool d)
: FieldTypeBase<T>(creator, n, TypeImpl::NAME, d)
{
@@ -496,10 +516,10 @@ class Serialize::CommonFieldBase : public FieldTypeBase<T>
CommonFieldBase(Serialize::TypeBase *t,
const Anope::string &n,
- T TypeImpl::*f,
+ Serialize::Storage<T> TypeImpl::*s,
bool d)
: FieldTypeBase<T>(t->GetOwner(), n, t->GetName(), d)
- , field(f)
+ , storage(s)
{
}
@@ -547,6 +567,11 @@ class Serialize::CommonFieldBase : public FieldTypeBase<T>
return this->HasField_(s);
}
+
+ void Uncache(Object *s)
+ {
+ Unset_(Upcast(s));
+ }
};
/** Class for all fields that aren't to other serializable objects
@@ -555,15 +580,11 @@ template<typename TypeImpl, typename T>
class Serialize::Field : public CommonFieldBase<TypeImpl, T>
{
public:
- Field(TypeBase *t, const Anope::string &n) : CommonFieldBase<TypeImpl, T>(t, n, false)
- {
- }
-
Field(Module *creator, const Anope::string &n) : CommonFieldBase<TypeImpl, T>(creator, n, false)
{
}
- Field(TypeBase *t, const Anope::string &n, T TypeImpl::*f) : CommonFieldBase<TypeImpl, T>(t, n, f, false)
+ Field(TypeBase *t, const Anope::string &n, Serialize::Storage<T> TypeImpl::*f) : CommonFieldBase<TypeImpl, T>(t, n, f, false)
{
}
@@ -571,8 +592,8 @@ class Serialize::Field : public CommonFieldBase<TypeImpl, T>
{
T* t = this->Get_(s);
- // If we have a non-default value for this field it is up to date and cached
- if (t && *t != T())
+ // If this field is cached
+ if (t && this->Cached_(s))
return *t;
// Query modules
@@ -583,19 +604,14 @@ class Serialize::Field : public CommonFieldBase<TypeImpl, T>
// module returned us data, so we unserialize it
T t2 = this->Unserialize(value);
- // should cache the default value somehow, but can't differentiate not cached from cached and default
-
- // Cache
+ // set & cache
OnSet(s, t2);
this->Set_(s, t2);
return t2;
}
- if (t)
- return *t;
-
- return T();
+ return t ? *t : T();
}
void SetFieldS(Object *s, const T &value) override
@@ -696,12 +712,12 @@ template<typename TypeImpl, typename T>
class Serialize::ObjectField : public CommonFieldBase<TypeImpl, T>
{
public:
- ObjectField(TypeBase *t, const Anope::string &n, bool d = false) : CommonFieldBase<TypeImpl, T>(t, n, d)
+ ObjectField(Module *creator, const Anope::string &n) : CommonFieldBase<TypeImpl, T>(creator, n, false)
{
this->is_object = true;
}
- ObjectField(TypeBase *t, const Anope::string &n, T TypeImpl::*field, bool d = false) : CommonFieldBase<TypeImpl, T>(t, n, field, d)
+ ObjectField(TypeBase *t, const Anope::string &n, Serialize::Storage<T> TypeImpl::*field, bool d = false) : CommonFieldBase<TypeImpl, T>(t, n, field, d)
{
this->is_object = true;
}
@@ -709,7 +725,8 @@ class Serialize::ObjectField : public CommonFieldBase<TypeImpl, T>
T GetField(TypeImpl *s)
{
T *t = this->Get_(s);
- if (t && *t != nullptr)
+
+ if (t && this->Cached_(s))
return *t;
Anope::string type;
@@ -732,10 +749,7 @@ class Serialize::ObjectField : public CommonFieldBase<TypeImpl, T>
return t2;
}
- if (t)
- return *t;
-
- return T();
+ return t ? *t : T();
}
void SetFieldS(Object *s, const T &value) override
@@ -818,6 +832,14 @@ class Serialize::ObjectField : public CommonFieldBase<TypeImpl, T>
};
template<typename T>
+class Serialize::Storage
+{
+ public:
+ T t = T();
+ bool cached = false;
+};
+
+template<typename T>
T Serialize::GetObject()
{
std::vector<T> v = GetObjects<T>();
diff --git a/include/xline.h b/include/xline.h
index 05ddbe2d3..cc4a98d66 100644
--- a/include/xline.h
+++ b/include/xline.h
@@ -32,8 +32,8 @@ class CoreExport XLine : public Serialize::Object
friend class XLineType;
- Anope::string type, mask, by, reason, id;
- time_t created = 0, expires = 0;
+ Serialize::Storage<Anope::string> type, mask, by, reason, id;
+ Serialize::Storage<time_t> created, expires;
public:
static constexpr const char *const NAME = "xline";
diff --git a/modules/botserv/badwords.cpp b/modules/botserv/badwords.cpp
index 914e89ea9..754e202a7 100644
--- a/modules/botserv/badwords.cpp
+++ b/modules/botserv/badwords.cpp
@@ -24,13 +24,12 @@ class BadWordImpl : public BadWord
{
friend class BadWordsType;
- ChanServ::Channel *channel = nullptr;
- Anope::string word;
- BadWordType type;
+ Serialize::Storage<ChanServ::Channel *> channel;
+ Serialize::Storage<Anope::string> word;
+ Serialize::Storage<BadWordType> type;
public:
- BadWordImpl(Serialize::TypeBase *type) : BadWord(type) { }
- BadWordImpl(Serialize::TypeBase *type, Serialize::ID id) : BadWord(type, id) { }
+ using BadWord::BadWord;
ChanServ::Channel *GetChannel() override;
void SetChannel(ChanServ::Channel *c) override;
diff --git a/modules/botserv/kick.cpp b/modules/botserv/kick.cpp
index 4411ee4ed..20af77d1c 100644
--- a/modules/botserv/kick.cpp
+++ b/modules/botserv/kick.cpp
@@ -43,42 +43,41 @@ class KickerDataImpl : public KickerData
{
friend class KickerDataType;
- ChanServ::Channel *channel = nullptr;
-
- bool amsgs = false,
- badwords = false,
- bolds = false,
- caps = false,
- colors = false,
- flood = false,
- italics = false,
- repeat = false,
- reverses = false,
- underlines = false;
-
- int16_t ttb_bolds = 0,
- ttb_colors = 0,
- ttb_reverses = 0,
- ttb_underlines = 0,
- ttb_badwords = 0,
- ttb_caps = 0,
- ttb_flood = 0,
- ttb_repeat = 0,
- ttb_italics = 0,
- ttb_amsgs = 0;
-
- int16_t capsmin = 0,
- capspercent = 0,
- floodlines = 0,
- floodsecs = 0,
- repeattimes = 0;
-
- bool dontkickops = false,
- dontkickvoices = false;
+ Serialize::Storage<ChanServ::Channel *> channel;
+
+ Serialize::Storage<bool> amsgs,
+ badwords,
+ bolds,
+ caps,
+ colors,
+ flood,
+ italics,
+ repeat,
+ reverses,
+ underlines;
+
+ Serialize::Storage<int16_t> ttb_bolds,
+ ttb_colors,
+ ttb_reverses,
+ ttb_underlines,
+ ttb_badwords,
+ ttb_caps,
+ ttb_flood,
+ ttb_repeat,
+ ttb_italics,
+ ttb_amsgs;
+
+ Serialize::Storage<int16_t> capsmin,
+ capspercent,
+ floodlines,
+ floodsecs,
+ repeattimes;
+
+ Serialize::Storage<bool> dontkickops,
+ dontkickvoices;
public:
- KickerDataImpl(Serialize::TypeBase *type) : KickerData(type) { }
- KickerDataImpl(Serialize::TypeBase *type, Serialize::ID id) : KickerData(type, id) { }
+ using KickerData::KickerData;
ChanServ::Channel *GetChannel() override;
void SetChannel(ChanServ::Channel *) override;
diff --git a/modules/chanserv/access.cpp b/modules/chanserv/access.cpp
index 82a11831f..967df9025 100644
--- a/modules/chanserv/access.cpp
+++ b/modules/chanserv/access.cpp
@@ -29,7 +29,7 @@ class AccessChanAccessImpl : public AccessChanAccess
{
friend class AccessChanAccessType;
- int level = 0;
+ Serialize::Storage<int> level;
public:
static constexpr const char *NAME = "accesschanaccess";
diff --git a/modules/chanserv/akick.cpp b/modules/chanserv/akick.cpp
index 1930cb20b..9338a4dd7 100644
--- a/modules/chanserv/akick.cpp
+++ b/modules/chanserv/akick.cpp
@@ -24,14 +24,13 @@ class AutoKickImpl : public AutoKick
{
friend class AutoKickType;
- ChanServ::Channel *channel = nullptr;
- NickServ::Account *account = nullptr;
- Anope::string mask, reason, creator;
- time_t addtime = 0, last_time = 0;
+ Serialize::Storage<ChanServ::Channel *> channel;
+ Serialize::Storage<NickServ::Account *> account;
+ Serialize::Storage<Anope::string> mask, reason, creator;
+ Serialize::Storage<time_t> addtime, last_time;
public:
- AutoKickImpl(Serialize::TypeBase *type) : AutoKick(type) { }
- AutoKickImpl(Serialize::TypeBase *type, Serialize::ID id) : AutoKick(type, id) { }
+ using AutoKick::AutoKick;
ChanServ::Channel *GetChannel() override;
void SetChannel(ChanServ::Channel *ci) override;
diff --git a/modules/chanserv/entrymsg.cpp b/modules/chanserv/entrymsg.cpp
index 4f74834bd..c739ba46a 100644
--- a/modules/chanserv/entrymsg.cpp
+++ b/modules/chanserv/entrymsg.cpp
@@ -24,13 +24,12 @@ class EntryMsgImpl : public EntryMsg
{
friend class EntryMsgType;
- ChanServ::Channel *channel = nullptr;
- Anope::string creator, message;
- time_t when = 0;
+ Serialize::Storage<ChanServ::Channel *> channel;
+ Serialize::Storage<Anope::string> creator, message;
+ Serialize::Storage<time_t> when;
public:
- EntryMsgImpl(Serialize::TypeBase *type) : EntryMsg(type) { }
- EntryMsgImpl(Serialize::TypeBase *type, Serialize::ID id) : EntryMsg(type, id) { }
+ using EntryMsg::EntryMsg;
ChanServ::Channel *GetChannel() override;
void SetChannel(ChanServ::Channel *ci) override;
diff --git a/modules/chanserv/flags.cpp b/modules/chanserv/flags.cpp
index 446eeddd0..4732aff5b 100644
--- a/modules/chanserv/flags.cpp
+++ b/modules/chanserv/flags.cpp
@@ -31,7 +31,7 @@ class FlagsChanAccessImpl : public FlagsChanAccess
{
friend class FlagsChanAccessType;
- Anope::string flags;
+ Serialize::Storage<Anope::string> flags;
public:
using FlagsChanAccess::FlagsChanAccess;
diff --git a/modules/chanserv/log.cpp b/modules/chanserv/log.cpp
index b62e03d0e..f2d782c1c 100644
--- a/modules/chanserv/log.cpp
+++ b/modules/chanserv/log.cpp
@@ -25,13 +25,12 @@ class LogSettingImpl : public LogSetting
{
friend class LogSettingType;
- ChanServ::Channel *channel = nullptr;
- Anope::string service_name, command_service, command_name, method, extra, creator;
- time_t created = 0;
+ Serialize::Storage<ChanServ::Channel *> channel;
+ Serialize::Storage<Anope::string> service_name, command_service, command_name, method, extra, creator;
+ Serialize::Storage<time_t> created;
public:
- LogSettingImpl(Serialize::TypeBase *type) : LogSetting(type) { }
- LogSettingImpl(Serialize::TypeBase *type, Serialize::ID id) : LogSetting(type, id) { }
+ using LogSetting::LogSetting;
ChanServ::Channel *GetChannel() override;
void SetChannel(ChanServ::Channel *) override;
diff --git a/modules/chanserv/main/channel.h b/modules/chanserv/main/channel.h
index fd9a357eb..bb79df3c5 100644
--- a/modules/chanserv/main/channel.h
+++ b/modules/chanserv/main/channel.h
@@ -21,34 +21,33 @@ class ChannelImpl : public ChanServ::Channel
{
friend class ChannelType;
- NickServ::Account *founder = nullptr, *successor = nullptr;
- Anope::string name, desc;
- time_t time_registered = 0, last_used = 0;
- Anope::string last_topic, last_topic_setter;
- time_t last_topic_time = 0;
- int16_t bantype = 0;
- time_t banexpire = 0;
- BotInfo *bi = nullptr;
- bool greet = false;
- bool fantasy = false;
- bool noautoop = false;
- bool peace = false;
- bool securefounder = false;
- bool restricted = false;
- bool secure = false;
- bool secureops = false;
- bool signkick = false;
- bool signkicklevel = false;
- bool noexpire = false;
- bool keepmodes = false;
- bool persist = false;
- bool topiclock = false;
- bool keeptopic = false;
- bool _private = false;
+ Serialize::Storage<NickServ::Account *> founder, successor;
+ Serialize::Storage<Anope::string> name, desc;
+ Serialize::Storage<time_t> time_registered, last_used;
+ Serialize::Storage<Anope::string> last_topic, last_topic_setter;
+ Serialize::Storage<time_t> last_topic_time;
+ Serialize::Storage<int16_t> bantype;
+ Serialize::Storage<time_t> banexpire;
+ Serialize::Storage<BotInfo *> bi;
+ Serialize::Storage<bool> greet;
+ Serialize::Storage<bool> fantasy;
+ Serialize::Storage<bool> noautoop;
+ Serialize::Storage<bool> peace;
+ Serialize::Storage<bool> securefounder;
+ Serialize::Storage<bool> restricted;
+ Serialize::Storage<bool> secure;
+ Serialize::Storage<bool> secureops;
+ Serialize::Storage<bool> signkick;
+ Serialize::Storage<bool> signkicklevel;
+ Serialize::Storage<bool> noexpire;
+ Serialize::Storage<bool> keepmodes;
+ Serialize::Storage<bool> persist;
+ Serialize::Storage<bool> topiclock;
+ Serialize::Storage<bool> keeptopic;
+ Serialize::Storage<bool> _private;
public:
- ChannelImpl(Serialize::TypeBase *type) : ChanServ::Channel(type) { }
- ChannelImpl(Serialize::TypeBase *type, Serialize::ID id) : ChanServ::Channel(type, id) { }
+ using ChanServ::Channel::Channel;
~ChannelImpl();
void Delete() override;
diff --git a/modules/chanserv/main/level.h b/modules/chanserv/main/level.h
index d22dc2831..1da1b26b5 100644
--- a/modules/chanserv/main/level.h
+++ b/modules/chanserv/main/level.h
@@ -21,13 +21,12 @@ class LevelImpl : public ChanServ::Level
{
friend class LevelType;
- ChanServ::Channel *channel = nullptr;
- Anope::string name;
- int level = 0;
+ Serialize::Storage<ChanServ::Channel *> channel;
+ Serialize::Storage<Anope::string> name;
+ Serialize::Storage<int> level;
public:
- LevelImpl(Serialize::TypeBase *type) : ChanServ::Level(type) { }
- LevelImpl(Serialize::TypeBase *type, Serialize::ID id) : ChanServ::Level(type, id) { }
+ using ChanServ::Level::Level;
ChanServ::Channel *GetChannel() override;
void SetChannel(ChanServ::Channel *) override;
diff --git a/modules/chanserv/main/mode.h b/modules/chanserv/main/mode.h
index b56360a22..de3a0315d 100644
--- a/modules/chanserv/main/mode.h
+++ b/modules/chanserv/main/mode.h
@@ -21,12 +21,11 @@ class ModeImpl : public ChanServ::Mode
{
friend class CSModeType;
- ChanServ::Channel *channel = nullptr;
- Anope::string mode, param;
+ Serialize::Storage<ChanServ::Channel *> channel;
+ Serialize::Storage<Anope::string> mode, param;
public:
- ModeImpl(Serialize::TypeBase *type) : ChanServ::Mode(type) { }
- ModeImpl(Serialize::TypeBase *type, Serialize::ID id) : ChanServ::Mode(type, id) { }
+ using ChanServ::Mode::Mode;
ChanServ::Channel *GetChannel() override;
void SetChannel(ChanServ::Channel *) override;
diff --git a/modules/chanserv/mode.cpp b/modules/chanserv/mode.cpp
index b20558bc0..5a22b4be8 100644
--- a/modules/chanserv/mode.cpp
+++ b/modules/chanserv/mode.cpp
@@ -25,14 +25,13 @@ class ModeLockImpl : public ModeLock
{
friend class ModeLockType;
- ChanServ::Channel *channel = nullptr;
- bool set = false;
- Anope::string name, param, setter;
- time_t created = 0;
+ Serialize::Storage<ChanServ::Channel *> channel;
+ Serialize::Storage<bool> set;
+ Serialize::Storage<Anope::string> name, param, setter;
+ Serialize::Storage<time_t> created;
public:
- ModeLockImpl(Serialize::TypeBase *type) : ModeLock(type) { }
- ModeLockImpl(Serialize::TypeBase *type, Serialize::ID id) : ModeLock(type, id) { }
+ using ModeLock::ModeLock;
ChanServ::Channel *GetChannel() override;
void SetChannel(ChanServ::Channel *ci) override;
diff --git a/modules/chanserv/set_misc.cpp b/modules/chanserv/set_misc.cpp
index ade42675d..7bf55dfc6 100644
--- a/modules/chanserv/set_misc.cpp
+++ b/modules/chanserv/set_misc.cpp
@@ -29,12 +29,11 @@ class CSMiscDataImpl : public CSMiscData
{
friend class CSMiscDataType;
- ChanServ::Channel *channel = nullptr;
- Anope::string name, data;