summaryrefslogtreecommitdiff
path: root/modules
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 /modules
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
Diffstat (limited to 'modules')
-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
36 files changed, 198 insertions, 244 deletions
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;
+ Serialize::Storage<ChanServ::Channel *> channel;
+ Serialize::Storage<Anope::string> name, data;
public:
- CSMiscDataImpl(Serialize::TypeBase *type) : CSMiscData(type) { }
- CSMiscDataImpl(Serialize::TypeBase *type, Serialize::ID id) : CSMiscData(type, id) { }
+ using CSMiscData::CSMiscData;
ChanServ::Channel *GetChannel() override;
void SetChannel(ChanServ::Channel *s) override;
diff --git a/modules/chanserv/suspend.cpp b/modules/chanserv/suspend.cpp
index c825c35f7..c8c451548 100644
--- a/modules/chanserv/suspend.cpp
+++ b/modules/chanserv/suspend.cpp
@@ -27,13 +27,12 @@ class CSSuspendInfoImpl : public CSSuspendInfo
{
friend class CSSuspendType;
- ChanServ::Channel *channel = nullptr;
- Anope::string by, reason;
- time_t when = 0, expires = 0;
+ Serialize::Storage<ChanServ::Channel *> channel;
+ Serialize::Storage<Anope::string> by, reason;
+ Serialize::Storage<time_t> when, expires;
public:
- CSSuspendInfoImpl(Serialize::TypeBase *type) : CSSuspendInfo(type) { }
- CSSuspendInfoImpl(Serialize::TypeBase *type, Serialize::ID id) : CSSuspendInfo(type, id) { }
+ using CSSuspendInfo::CSSuspendInfo;
ChanServ::Channel *GetChannel() override;
void SetChannel(ChanServ::Channel *s) override;
diff --git a/modules/chanserv/xop.cpp b/modules/chanserv/xop.cpp
index 4e113f25e..de5ca0c0b 100644
--- a/modules/chanserv/xop.cpp
+++ b/modules/chanserv/xop.cpp
@@ -35,7 +35,7 @@ class XOPChanAccessImpl : public XOPChanAccess
{
friend class XOPChanAccessType;
- Anope::string type;
+ Serialize::Storage<Anope::string> type;
public:
using XOPChanAccess::XOPChanAccess;
diff --git a/modules/database/sql.cpp b/modules/database/sql.cpp
index 7ca4eb6d7..1739f168d 100644
--- a/modules/database/sql.cpp
+++ b/modules/database/sql.cpp
@@ -30,21 +30,6 @@ class DBSQL : public Module, public Pipe
bool inited = false;
Anope::string prefix;
ServiceReference<Provider> SQL;
- std::unordered_multimap<Serialize::Object *, Serialize::FieldBase *> cache;
-
- void CacheMiss(Serialize::Object *object, Serialize::FieldBase *field)
- {
- cache.insert(std::make_pair(object, field));
- }
-
- bool IsCacheMiss(Serialize::Object *object, Serialize::FieldBase *field)
- {
- auto range = cache.equal_range(object);
- for (auto it = range.first; it != range.second; ++it)
- if (it->second == field)
- return true;
- return false;
- }
Result Run(const Query &query)
{
@@ -91,8 +76,7 @@ class DBSQL : public Module, public Pipe
void OnNotify() override
{
Commit();
- Serialize::Clear();
- cache.clear();
+ Serialize::GC();
}
void OnReload(Configuration::Conf *conf) override
@@ -208,14 +192,8 @@ class DBSQL : public Module, public Pipe
{
SQL::Result::Value v;
- if (IsCacheMiss(object, field))
- return EVENT_CONTINUE;
-
if (!GetValue(object, field, v))
- {
- CacheMiss(object, field);
return EVENT_CONTINUE;
- }
value = v.value;
return EVENT_ALLOW;
diff --git a/modules/hostserv/main/vhost.h b/modules/hostserv/main/vhost.h
index 90ac9140f..bdc6509d7 100644
--- a/modules/hostserv/main/vhost.h
+++ b/modules/hostserv/main/vhost.h
@@ -25,12 +25,12 @@ class VHostImpl : public HostServ::VHost
{
friend class VHostType;
- Serialize::Object *owner = nullptr;
- Anope::string vident;
- Anope::string vhost;
- Anope::string creator;
- time_t created = 0;
- bool default_ = false;
+ Serialize::Storage<Serialize::Object *> owner;
+ Serialize::Storage<Anope::string> vident;
+ Serialize::Storage<Anope::string> vhost;
+ Serialize::Storage<Anope::string> creator;
+ Serialize::Storage<time_t> created;
+ Serialize::Storage<bool> default_;
public:
using HostServ::VHost::VHost;
diff --git a/modules/hostserv/request.cpp b/modules/hostserv/request.cpp
index 7b66eb59c..9508a9abc 100644
--- a/modules/hostserv/request.cpp
+++ b/modules/hostserv/request.cpp
@@ -24,15 +24,14 @@ class HostRequest : public Serialize::Object
{
friend class HostRequestType;
- NickServ::Account *acc = nullptr;
- Anope::string ident, host;
- time_t time = 0;
+ Serialize::Storage<NickServ::Account *> acc;
+ Serialize::Storage<Anope::string> ident, host;
+ Serialize::Storage<time_t> time;
public:
static constexpr const char *const NAME = "hostrequest";
- HostRequest(Serialize::TypeBase *type) : Serialize::Object(type) { }
- HostRequest(Serialize::TypeBase *type, Serialize::ID id) : Serialize::Object(type, id) { }
+ using Serialize::Object::Object;
NickServ::Account *GetAccount();
void SetAccount(NickServ::Account *);
diff --git a/modules/memoserv/main/ignore.h b/modules/memoserv/main/ignore.h
index 3c632a74e..9edca514b 100644
--- a/modules/memoserv/main/ignore.h
+++ b/modules/memoserv/main/ignore.h
@@ -23,12 +23,11 @@ class IgnoreImpl : public MemoServ::Ignore
{
friend class IgnoreType;
- MemoServ::MemoInfo *memoinfo = nullptr;
- Anope::string mask;
+ Serialize::Storage<MemoServ::MemoInfo *> memoinfo;
+ Serialize::Storage<Anope::string> mask;
public:
- IgnoreImpl(Serialize::TypeBase *type) : MemoServ::Ignore(type) { }
- IgnoreImpl(Serialize::TypeBase *type, Serialize::ID id) : MemoServ::Ignore(type, id) { }
+ using MemoServ::Ignore::Ignore;
~IgnoreImpl();
MemoServ::MemoInfo *GetMemoInfo() override;
diff --git a/modules/memoserv/main/memo.h b/modules/memoserv/main/memo.h
index 7f34f90dd..e4f91a1ad 100644
--- a/modules/memoserv/main/memo.h
+++ b/modules/memoserv/main/memo.h
@@ -23,14 +23,13 @@ class MemoImpl : public MemoServ::Memo
{
friend class MemoType;
- MemoServ::MemoInfo *memoinfo = nullptr;
- Anope::string text, sender;
- time_t time = 0;
- bool unread = false, receipt = false;
+ Serialize::Storage<MemoServ::MemoInfo *> memoinfo;
+ Serialize::Storage<Anope::string> text, sender;
+ Serialize::Storage<time_t> time;
+ Serialize::Storage<bool> unread, receipt;
public:
- MemoImpl(Serialize::TypeBase *type) : MemoServ::Memo(type) { }
- MemoImpl(Serialize::TypeBase *type, Serialize::ID id) : MemoServ::Memo(type, id) { }
+ using MemoServ::Memo::Memo;
MemoServ::MemoInfo *GetMemoInfo() override;
void SetMemoInfo(MemoServ::MemoInfo *) override;
diff --git a/modules/memoserv/main/memoinfo.h b/modules/memoserv/main/memoinfo.h
index 3232262a3..cbe37e456 100644
--- a/modules/memoserv/main/memoinfo.h
+++ b/modules/memoserv/main/memoinfo.h
@@ -23,13 +23,12 @@ class MemoInfoImpl : public MemoServ::MemoInfo
{
friend class MemoInfoType;
- Serialize::Object *owner = nullptr;
- int16_t memomax = 0;
- bool hardmax = false;
+ Serialize::Storage<Serialize::Object *> owner;
+ Serialize::Storage<int16_t> memomax;
+ Serialize::Storage<bool> hardmax;
public:
- MemoInfoImpl(Serialize::TypeBase *type) : MemoServ::MemoInfo(type) { }
- MemoInfoImpl(Serialize::TypeBase *type, Serialize::ID id) : MemoServ::MemoInfo(type, id) { }
+ using MemoServ::MemoInfo::MemoInfo;
MemoServ::Memo *GetMemo(unsigned index) override;
unsigned GetIndex(MemoServ::Memo *m) override;
diff --git a/modules/nickserv/access.cpp b/modules/nickserv/access.cpp
index 1f3622afa..e20d81037 100644
--- a/modules/nickserv/access.cpp
+++ b/modules/nickserv/access.cpp
@@ -25,12 +25,11 @@ class NickAccessImpl : public NickAccess
{
friend class NickAccessType;
- NickServ::Account *account = nullptr;
- Anope::string mask;
+ Serialize::Storage<NickServ::Account *> account;
+ Serialize::Storage<Anope::string> mask;
public:
- NickAccessImpl(Serialize::TypeBase *type) : NickAccess(type) { }
- NickAccessImpl(Serialize::TypeBase *type, Serialize::ID id) : NickAccess(type, id) { }
+ using NickAccess::NickAccess;
NickServ::Account *GetAccount() override;
void SetAccount(NickServ::Account *) override;
diff --git a/modules/nickserv/ajoin.cpp b/modules/nickserv/ajoin.cpp
index 91039a019..5973c95ac 100644
--- a/modules/nickserv/ajoin.cpp
+++ b/modules/nickserv/ajoin.cpp
@@ -25,12 +25,11 @@ class AutoJoinImpl : public AutoJoin
{
friend class AutoJoinType;
- NickServ::Account *account = nullptr;
- Anope::string channel, key;
+ Serialize::Storage<NickServ::Account *> account;
+ Serialize::Storage<Anope::string> channel, key;
public:
- AutoJoinImpl(Serialize::TypeBase *type) : AutoJoin(type) { }
- AutoJoinImpl(Serialize::TypeBase *type, Serialize::ID id) : AutoJoin(type, id) { }
+ using AutoJoin::AutoJoin;
NickServ::Account *GetAccount() override;
void SetAccount(NickServ::Account *acc) override;
diff --git a/modules/nickserv/cert.cpp b/modules/nickserv/cert.cpp
index f58515d70..51eae0fb0 100644
--- a/modules/nickserv/cert.cpp
+++ b/modules/nickserv/cert.cpp
@@ -57,12 +57,11 @@ class NSCertEntryImpl : public NSCertEntry
{
friend class NSCertEntryType;
- NickServ::Account *account = nullptr;
- Anope::string cert;
+ Serialize::Storage<NickServ::Account *> account;
+ Serialize::Storage<Anope::string> cert;
public:
- NSCertEntryImpl(Serialize::TypeBase *type) : NSCertEntry(type) { }
- NSCertEntryImpl(Serialize::TypeBase *type, Serialize::ID id) : NSCertEntry(type, id) { }
+ using NSCertEntry::NSCertEntry;
~NSCertEntryImpl();
NickServ::Account *GetAccount() override;
diff --git a/modules/nickserv/main/account.cpp b/modules/nickserv/main/account.cpp
index fa6de8455..a6fa19adf 100644
--- a/modules/nickserv/main/account.cpp
+++ b/modules/nickserv/main/account.cpp
@@ -37,6 +37,11 @@ void AccountImpl::Delete()
return Serialize::Object::Delete();
}
+bool AccountImpl::CanGC()
+{
+ return users.empty();
+}
+
Anope::string AccountImpl::GetDisplay()
{
return Get<Anope::string>(&AccountType::display);
diff --git a/modules/nickserv/main/account.h b/modules/nickserv/main/account.h
index 928213666..ba07a2a13 100644
--- a/modules/nickserv/main/account.h
+++ b/modules/nickserv/main/account.h
@@ -23,26 +23,28 @@ class AccountImpl : public NickServ::Account
{
friend class AccountType;
- Anope::string display, password, email, language;
- Oper *oper = nullptr;
- Anope::string greet;
- bool unconfirmed = false;
- bool _private = false;
- bool autoop = false;
- bool keepmodes = false;
- bool killprotect = false;
- bool killquick = false;
- bool killimmed = false;
- bool msg = false;
- bool secure = false;
- bool memosignon = false, memoreceive = false, memomail = false;
- bool hideemail = false, hidemask = false, hidestatus = false, hidequit = false;
+ Serialize::Storage<Anope::string> display, password, email, language;
+ Serialize::Storage<Oper *> oper;
+ Serialize::Storage<Anope::string> greet;
+ Serialize::Storage<bool> unconfirmed;
+ Serialize::Storage<bool> _private;
+ Serialize::Storage<bool> autoop;
+ Serialize::Storage<bool> keepmodes;
+ Serialize::Storage<bool> killprotect;
+ Serialize::Storage<bool> killquick;
+ Serialize::Storage<bool> killimmed;
+ Serialize::Storage<bool> msg;
+ Serialize::Storage<bool> secure;
+ Serialize::Storage<bool> memosignon, memoreceive, memomail;
+ Serialize::Storage<bool> hideemail, hidemask, hidestatus, hidequit;
public:
using NickServ::Account::Account;
~AccountImpl();
void Delete() override;
+ bool CanGC() override;
+
Anope::string GetDisplay() override;
void SetDisplay(const Anope::string &) override;
diff --git a/modules/nickserv/main/mode.h b/modules/nickserv/main/mode.h
index a8db73b7e..d4246809c 100644
--- a/modules/nickserv/main/mode.h
+++ b/modules/nickserv/main/mode.h
@@ -21,12 +21,11 @@ class ModeImpl : public NickServ::Mode
{
friend class NSModeType;
- NickServ::Account *account = nullptr;
- Anope::string mode;
+ Serialize::Storage<NickServ::Account *> account;
+ Serialize::Storage<Anope::string> mode;
public:
- ModeImpl(Serialize::TypeBase *type) : NickServ::Mode(type) { }
- ModeImpl(Serialize::TypeBase *type, Serialize::ID id) : NickServ::Mode(type, id) { }
+ using NickServ::Mode::Mode;
NickServ::Account *GetAccount() override;
void SetAccount(NickServ::Account *) override;
diff --git a/modules/nickserv/main/nick.h b/modules/nickserv/main/nick.h
index 9df205fb9..df0577d94 100644
--- a/modules/nickserv/main/nick.h
+++ b/modules/nickserv/main/nick.h
@@ -21,14 +21,13 @@ class NickImpl : public NickServ::Nick
{
friend class NickType;
- NickServ::Account *account = nullptr;
- Anope::string nick, last_quit, last_realname, last_usermask, last_realhost;
- time_t time_registered = 0, last_seen = 0;
- bool noexpire = false;
+ Serialize::Storage<NickServ::Account *> account;
+ Serialize::Storage<Anope::string> nick, last_quit, last_realname, last_usermask, last_realhost;
+ Serialize::Storage<time_t> time_registered, last_seen;
+ Serialize::Storage<bool> noexpire;
public:
- NickImpl(Serialize::TypeBase *type) : NickServ::Nick(type) { }
- NickImpl(Serialize::TypeBase *type, Serialize::ID id) : NickServ::Nick(type, id) { }
+ using NickServ::Nick::Nick;
~NickImpl();
void Delete() override;
diff --git a/modules/nickserv/set_misc.cpp b/modules/nickserv/set_misc.cpp
index af0859c6b..fe1859cc7 100644
--- a/modules/nickserv/set_misc.cpp
+++ b/modules/nickserv/set_misc.cpp
@@ -28,12 +28,11 @@ class NSMiscDataImpl : public NSMiscData
{
friend class NSMiscDataType;
- NickServ::Account *account = nullptr;
- Anope::string name, data;
+ Serialize::Storage<NickServ::Account *> account;
+ Serialize::Storage<Anope::string> name, data;
public:
- NSMiscDataImpl(Serialize::TypeBase *type) : NSMiscData(type) { }
- NSMiscDataImpl(Serialize::TypeBase *type, Serialize::ID id) : NSMiscData(type, id) { }
+ using NSMiscData::NSMiscData;
NickServ::Account *GetAccount() override;
void SetAccount(NickServ::Account *s) override;
diff --git a/modules/nickserv/suspend.cpp b/modules/nickserv/suspend.cpp
index 4ac1d7456..90362bcf2 100644
--- a/modules/nickserv/suspend.cpp
+++ b/modules/nickserv/suspend.cpp
@@ -26,13 +26,12 @@ class NSSuspendInfoImpl : public NSSuspendInfo
{
friend class NSSuspendType;
- NickServ::Account *account = nullptr;
- Anope::string by, reason;
- time_t when = 0, expires = 0;
+ Serialize::Storage<NickServ::Account *> account;
+ Serialize::Storage<Anope::string> by, reason;
+ Serialize::Storage<time_t> when, expires;
public:
- NSSuspendInfoImpl(Serialize::TypeBase *type) : NSSuspendInfo(type) { }
- NSSuspendInfoImpl(Serialize::TypeBase *type, Serialize::ID id) : NSSuspendInfo(type, id) { }
+ using NSSuspendInfo::NSSuspendInfo;
NickServ::Account *GetAccount() override;
void SetAccount(NickServ::Account *) override;
diff --git a/modules/operserv/dns.cpp b/modules/operserv/dns.cpp
index e607b1712..1ccb54530 100644
--- a/modules/operserv/dns.cpp
+++ b/modules/operserv/dns.cpp
@@ -27,11 +27,10 @@ class DNSZoneImpl : public DNSZone
{
friend class DNSZoneType;
- Anope::string name;
+ Serialize::Storage<Anope::string> name;
public:
- DNSZoneImpl(Serialize::TypeBase *type) : DNSZone(type) { }
- DNSZoneImpl(Serialize::TypeBase *type, Serialize::ID id) : DNSZone(type, id) { }
+ using DNSZone::DNSZone;
Anope::string GetName() override;
void SetName(const Anope::string &) override;
@@ -72,10 +71,10 @@ class DNSServerImpl : public DNSServer
ServiceReference<DNS::Manager> manager;
- DNSZone *zone = nullptr;
- Anope::string name;
- unsigned int limit = 0;
- bool pooled = false;
+ Serialize::Storage<DNSZone *> zone;
+ Serialize::Storage<Anope::string> name;
+ Serialize::Storage<unsigned int> limit;
+ Serialize::Storage<bool> pooled;
/* is actually in the pool */
bool active = false;
@@ -84,8 +83,7 @@ class DNSServerImpl : public DNSServer
std::set<Anope::string, ci::less> zones;
time_t repool = 0;
- DNSServerImpl(Serialize::TypeBase *type) : DNSServer(type) { }
- DNSServerImpl(Serialize::TypeBase *type, Serialize::ID id) : DNSServer(type, id) { }
+ using DNSServer::DNSServer;
DNSZone *GetZone() override;
void SetZone(DNSZone *) override;
@@ -188,12 +186,11 @@ class DNSZoneMembershipImpl : public DNSZoneMembership
{
friend class DNSZoneMembershipType;
- DNSServer *server = nullptr;
- DNSZone *zone = nullptr;
+ Serialize::Storage<DNSServer *> server;
+ Serialize::Storage<DNSZone *> zone;
public:
- DNSZoneMembershipImpl(Serialize::TypeBase *type) : DNSZoneMembership(type) { }
- DNSZoneMembershipImpl(Serialize::TypeBase *type, Serialize::ID id) : DNSZoneMembership(type, id) { }
+ using DNSZoneMembership::DNSZoneMembership;
DNSServer *GetServer() override;
void SetServer(DNSServer *) override;
@@ -247,8 +244,8 @@ class DNSIPImpl : public DNSIP
{
friend class DNSIPType;
- DNSServer *server = nullptr;
- Anope::string ip;
+ Serialize::Storage<DNSServer *> server;
+ Serialize::Storage<Anope::string> ip;
public:
DNSIPImpl(Serialize::TypeBase *type) : DNSIP(type) { }
diff --git a/modules/operserv/forbid.cpp b/modules/operserv/forbid.cpp
index 1a013ed0d..22d927381 100644
--- a/modules/operserv/forbid.cpp
+++ b/modules/operserv/forbid.cpp
@@ -26,13 +26,12 @@ class ForbidDataImpl : public ForbidData
{
friend class ForbidDataType;
- Anope::string mask, creator, reason;
- time_t created = 0, expires = 0;
- ForbidType type = static_cast<ForbidType>(0);
+ Serialize::Storage<Anope::string> mask, creator, reason;
+ Serialize::Storage<time_t> created, expires;
+ Serialize::Storage<ForbidType> type;
public:
- ForbidDataImpl(Serialize::TypeBase *type) : ForbidData(type) { }
- ForbidDataImpl(Serialize::TypeBase *type, Serialize::ID id) : ForbidData(type, id) { }
+ using ForbidData::ForbidData;
Anope::string GetMask() override;
void SetMask(const Anope::string &) override;
diff --git a/modules/operserv/ignore.cpp b/modules/operserv/ignore.cpp
index a25b0ef8c..397916ca4 100644
--- a/modules/operserv/ignore.cpp
+++ b/modules/operserv/ignore.cpp
@@ -25,12 +25,11 @@ class IgnoreImpl : public Ignore
{
friend class IgnoreType;
- Anope::string mask, creator, reason;
- time_t time = 0;
+ Serialize::Storage<Anope::string> mask, creator, reason;
+ Serialize::Storage<time_t> time;
public:
- IgnoreImpl(Serialize::TypeBase *type) : Ignore(type) { }
- IgnoreImpl(Serialize::TypeBase *type, Serialize::ID id) : Ignore(type, id) { }
+ using Ignore::Ignore;
Anope::string GetMask() override;
void SetMask(const Anope::string &) override;
diff --git a/modules/operserv/info.cpp b/modules/operserv/info.cpp
index 30c0b06ad..c6038af5a 100644
--- a/modules/operserv/info.cpp
+++ b/modules/operserv/info.cpp
@@ -27,13 +27,12 @@ class OperInfoImpl : public OperInfo
{
friend class OperInfoType;
- Serialize::Object *target = nullptr;
- Anope::string info, creator;
- time_t created = 0;
+ Serialize::Storage<Serialize::Object *> target;
+ Serialize::Storage<Anope::string> info, creator;
+ Serialize::Storage<time_t> created;
public:
- OperInfoImpl(Serialize::TypeBase *type) : OperInfo(type) { }
- OperInfoImpl(Serialize::TypeBase *type, Serialize::ID id) : OperInfo(type, id) { }
+ using OperInfo::OperInfo;
Serialize::Object *GetTarget() override;
void SetTarget(Serialize::Object *) override;
diff --git a/modules/operserv/news.cpp b/modules/operserv/news.cpp
index a99063c19..e2119a2de 100644
--- a/modules/operserv/news.cpp
+++ b/modules/operserv/news.cpp
@@ -77,13 +77,12 @@ class NewsItemImpl : public NewsItem
{
friend class NewsItemType;
- NewsType type;
- Anope::string text, who;
- time_t time = 0;
+ Serialize::Storage<NewsType> type;
+ Serialize::Storage<Anope::string> text, who;
+ Serialize::Storage<time_t> time;
public:
- NewsItemImpl(Serialize::TypeBase *type) : NewsItem(type) { }
- NewsItemImpl(Serialize::TypeBase *type, Serialize::ID id) : NewsItem(type, id) { }
+ using NewsItem::NewsItem;
NewsType GetNewsType() override;
void SetNewsType(NewsType) override;
diff --git a/modules/operserv/session.cpp b/modules/operserv/session.cpp
index 0390d9205..cdd230473 100644
--- a/modules/operserv/session.cpp
+++ b/modules/operserv/session.cpp
@@ -47,13 +47,12 @@ class ExceptionImpl : public Exception
{
friend class ExceptionType;
- Anope::string mask, who, reason;
- unsigned int limit = 0;
- time_t time = 0, expires = 0;
+ Serialize::Storage<Anope::string> mask, who, reason;
+ Serialize::Storage<unsigned int> limit;
+ Serialize::Storage<time_t> time, expires;
public:
- ExceptionImpl(Serialize::TypeBase *type) : Exception(type) { }
- ExceptionImpl(Serialize::TypeBase *type, Serialize::ID id) : Exception(type, id) { }
+ using Exception::Exception;
Anope::string GetMask() override;
void SetMask(const Anope::string &) override;
diff --git a/modules/operserv/stats.cpp b/modules/operserv/stats.cpp
index 04b1af6c8..abee79cf6 100644
--- a/modules/operserv/stats.cpp
+++ b/modules/operserv/stats.cpp
@@ -25,11 +25,10 @@ class StatsImpl : public Stats
{
friend class StatsType;
- unsigned int maxusercnt = 0;
- time_t maxusertime = 0;
+ Serialize::Storage<unsigned int> maxusercnt;
+ Serialize::Storage<time_t> maxusertime;
public:
-
using Stats::Stats;
unsigned int GetMaxUserCount() override;