From ca28f9cfcbff0fbdb2afe96f1427245f83db7c47 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 1 Dec 2016 09:25:53 -0500 Subject: 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 --- modules/chanserv/access.cpp | 2 +- modules/chanserv/akick.cpp | 11 ++++----- modules/chanserv/entrymsg.cpp | 9 ++++---- modules/chanserv/flags.cpp | 2 +- modules/chanserv/log.cpp | 9 ++++---- modules/chanserv/main/channel.h | 51 ++++++++++++++++++++--------------------- modules/chanserv/main/level.h | 9 ++++---- modules/chanserv/main/mode.h | 7 +++--- modules/chanserv/mode.cpp | 11 ++++----- modules/chanserv/set_misc.cpp | 7 +++--- modules/chanserv/suspend.cpp | 9 ++++---- modules/chanserv/xop.cpp | 2 +- 12 files changed, 60 insertions(+), 69 deletions(-) (limited to 'modules/chanserv') 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 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 channel; + Serialize::Storage account; + Serialize::Storage mask, reason, creator; + Serialize::Storage 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 channel; + Serialize::Storage creator, message; + Serialize::Storage 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 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 channel; + Serialize::Storage service_name, command_service, command_name, method, extra, creator; + Serialize::Storage 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 founder, successor; + Serialize::Storage name, desc; + Serialize::Storage time_registered, last_used; + Serialize::Storage last_topic, last_topic_setter; + Serialize::Storage last_topic_time; + Serialize::Storage bantype; + Serialize::Storage banexpire; + Serialize::Storage bi; + Serialize::Storage greet; + Serialize::Storage fantasy; + Serialize::Storage noautoop; + Serialize::Storage peace; + Serialize::Storage securefounder; + Serialize::Storage restricted; + Serialize::Storage secure; + Serialize::Storage secureops; + Serialize::Storage signkick; + Serialize::Storage signkicklevel; + Serialize::Storage noexpire; + Serialize::Storage keepmodes; + Serialize::Storage persist; + Serialize::Storage topiclock; + Serialize::Storage keeptopic; + Serialize::Storage _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 channel; + Serialize::Storage name; + Serialize::Storage 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 channel; + Serialize::Storage 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 channel; + Serialize::Storage set; + Serialize::Storage name, param, setter; + Serialize::Storage 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 channel; + Serialize::Storage 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 channel; + Serialize::Storage by, reason; + Serialize::Storage 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 type; public: using XOPChanAccess::XOPChanAccess; -- cgit