diff options
author | Adam <Adam@anope.org> | 2014-04-25 16:51:06 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-04-25 16:51:06 -0400 |
commit | 6a03eb69ebbe773f1d4139ff88d74ecdb2b0af4b (patch) | |
tree | d370fbc4a1dd55b72dbcda9f2aff24678d5626f3 /include/modes.h | |
parent | 4fa2a00bd595eb120e6acde5eb167759c2018e33 (diff) |
Add "virtual mode" support
This allows fully tracking extbans and other modes set by a different
underlying mode, such as InspIRCd's namedmodes
Add two configuration options to cs_ban to configure which mode is set
and whether or not to kick banned users.
Add default "mute" fantasy command to botserv.example.conf
Diffstat (limited to 'include/modes.h')
-rw-r--r-- | include/modes.h | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/include/modes.h b/include/modes.h index 8f67959e8..3ba54c439 100644 --- a/include/modes.h +++ b/include/modes.h @@ -96,6 +96,9 @@ class CoreExport UserModeParam : public UserMode class CoreExport ChannelMode : public Mode { public: + /* channel modes that can posssibly unwrap this mode */ + std::vector<ChannelMode *> listeners; + /** constructor * @param name The mode name * @param mc The mode char @@ -103,6 +106,18 @@ class CoreExport ChannelMode : public Mode ChannelMode(const Anope::string &name, char mc); bool CanSet(User *u) const anope_override; + + /** 'wrap' this channel mode and param to the underlying mode and param + */ + virtual ChannelMode *Wrap(Anope::string ¶m); + + /** 'unwrap' this mode to our internal representation + */ + ChannelMode *Unwrap(Anope::string ¶m); + + /** called when a mode is being unwrapped, and is asking us if we can unwrap it + */ + virtual ChannelMode *Unwrap(ChannelMode *, Anope::string ¶m); }; /** This is a mode for lists, eg b/e/I. These modes should inherit from this @@ -186,6 +201,25 @@ class CoreExport ChannelModeStatus : public ChannelMode ChannelModeStatus(const Anope::string &name, char mc, char msymbol, short mlevel); }; +/** A virtual mode. This mode doesn't natively exist on the IRCd (like extbans), + * but we still have a representation for it. + */ +template<typename T> +class ChannelModeVirtual : public T +{ + Anope::string base; + ChannelMode *basech; + + public: + ChannelModeVirtual(const Anope::string &mname, const Anope::string &basename); + + ~ChannelModeVirtual(); + + ChannelMode *Wrap(Anope::string ¶m) anope_override; + + ChannelMode *Unwrap(ChannelMode *cm, Anope::string ¶m) = 0; +}; + /* The status a user has on a channel (+v, +h, +o) etc */ class CoreExport ChannelStatus { @@ -257,13 +291,6 @@ class CoreExport ChannelModeNoone : public ChannelMode */ class CoreExport ModeManager { - protected: - /* Array of all modes Anope knows about. Modes are in this array at position - * modechar. Additionally, status modes are in this array (again) at statuschar. - */ - static std::vector<ChannelMode *> ChannelModes; - static std::vector<UserMode *> UserModes; - public: /* Number of generic channel and user modes we are tracking */ |