diff options
| author | Adam <Adam@anope.org> | 2016-12-01 09:25:53 -0500 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2016-12-01 09:25:53 -0500 |
| commit | ca28f9cfcbff0fbdb2afe96f1427245f83db7c47 (patch) | |
| tree | ac5de801a4db01a7cb689ec670537ad74c7c53e6 /modules/chanserv | |
| parent | 2f512281029fbf4f7ef9832e05804831ad2d9ba2 (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/chanserv')
| -rw-r--r-- | modules/chanserv/access.cpp | 2 | ||||
| -rw-r--r-- | modules/chanserv/akick.cpp | 11 | ||||
| -rw-r--r-- | modules/chanserv/entrymsg.cpp | 9 | ||||
| -rw-r--r-- | modules/chanserv/flags.cpp | 2 | ||||
| -rw-r--r-- | modules/chanserv/log.cpp | 9 | ||||
| -rw-r--r-- | modules/chanserv/main/channel.h | 51 | ||||
| -rw-r--r-- | modules/chanserv/main/level.h | 9 | ||||
| -rw-r--r-- | modules/chanserv/main/mode.h | 7 | ||||
| -rw-r--r-- | modules/chanserv/mode.cpp | 11 | ||||
| -rw-r--r-- | modules/chanserv/set_misc.cpp | 7 | ||||
| -rw-r--r-- | modules/chanserv/suspend.cpp | 9 | ||||
| -rw-r--r-- | modules/chanserv/xop.cpp | 2 |
12 files changed, 60 insertions, 69 deletions
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; |
