diff options
author | Sadie Powell <sadie@witchery.services> | 2025-05-03 17:07:07 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2025-05-03 21:28:56 +0100 |
commit | 010beb52b1f3c697a07f9a130d2ed9335fe1cd98 (patch) | |
tree | 734750a5677afff443f2117dc34ba14d3351fb28 /include/modes.h | |
parent | c95594141346ef6fb65a5af177bed35ed865234d (diff) |
Store the setter and ts for all modes and try to restore them.
This is mostly for preserving channel list mode info.
Diffstat (limited to 'include/modes.h')
-rw-r--r-- | include/modes.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/include/modes.h b/include/modes.h index db84a64fe..3052ab00b 100644 --- a/include/modes.h +++ b/include/modes.h @@ -33,6 +33,20 @@ enum ModeClass MC_USER }; +struct ModeData final +{ + Anope::string value; + Anope::string set_by; + time_t set_at; + + ModeData(const Anope::string &v = "", const Anope::string &s = "", time_t t = 0) + : value(v) + , set_by(s) + , set_at(t) + { + } +}; + /** This class is the basis of all modes in Anope */ class CoreExport Mode @@ -311,6 +325,7 @@ public: class CoreExport ModeManager final { public: + using Change = std::multimap<Mode *, std::pair<bool, ModeData>>; /* Number of generic channel and user modes we are tracking */ static unsigned GenericChannelModes; @@ -378,18 +393,18 @@ public: * @param c The channel * @param cm The channel mode * @param set true for setting, false for removing - * @param param The param, if there is one + * @param data Data about the mode. */ - static void StackerAdd(BotInfo *bi, Channel *c, ChannelMode *cm, bool set, const Anope::string ¶m = ""); + static void StackerAdd(BotInfo *bi, Channel *c, ChannelMode *cm, bool set, const ModeData &data = {}); /** Add a mode to the stacker to be set on a user * @param bi The client to set the modes from * @param u The user * @param um The user mode * @param set true for setting, false for removing - * @param param The param, if there is one + * @param data Data about the mode. */ - static void StackerAdd(BotInfo *bi, User *u, UserMode *um, bool set, const Anope::string ¶m = ""); + static void StackerAdd(BotInfo *bi, User *u, UserMode *um, bool set, const ModeData &data = {}); /** Process all of the modes in the stacker and send them to the IRCd to be set on channels/users */ |