summaryrefslogtreecommitdiff
path: root/include/modes.h
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-06-23 09:45:15 -0400
committerAdam <Adam@anope.org>2014-06-23 09:45:15 -0400
commitfd9bb0ea7e3c8a39f1632c2ebbdc25d0fac192a0 (patch)
tree1d68e86065e0b012aee41533d4f9b289ee0707ac /include/modes.h
parent148b26f687ce85dc01e852a2358b03d493757ada (diff)
parent9a947fa4359c667be58ebae4634d9ac0e53d5db4 (diff)
Merge branch '2.0' into 2.1
Conflicts: cmake/Anope.cmake cmake/FindGettext.cmake include/access.h include/messages.h include/modes.h include/modules.h include/users.h modules/CMakeLists.txt modules/commands/bs_bot.cpp modules/commands/cs_access.cpp modules/commands/cs_ban.cpp modules/commands/cs_clone.cpp modules/commands/cs_flags.cpp modules/commands/cs_info.cpp modules/commands/cs_list.cpp modules/commands/cs_log.cpp modules/commands/cs_mode.cpp modules/commands/cs_status.cpp modules/commands/cs_suspend.cpp modules/commands/cs_updown.cpp modules/commands/cs_xop.cpp modules/commands/ms_check.cpp modules/commands/ns_access.cpp modules/commands/ns_cert.cpp modules/commands/ns_group.cpp modules/commands/ns_register.cpp modules/commands/ns_set.cpp modules/commands/ns_suspend.cpp modules/commands/os_session.cpp modules/commands/os_svs.cpp modules/extra/m_ldap_authentication.cpp modules/extra/m_regex_pcre.cpp modules/extra/m_sql_authentication.cpp modules/extra/stats/m_chanstats.cpp modules/protocol/bahamut.cpp modules/protocol/hybrid.cpp modules/protocol/inspircd12.cpp modules/protocol/inspircd20.cpp modules/protocol/unreal.cpp modules/pseudoclients/chanserv.cpp modules/pseudoclients/chanserv/channel.cpp modules/pseudoclients/nickserv/nickserv.cpp modules/webcpanel/pages/chanserv/access.cpp src/access.cpp src/bots.cpp src/channels.cpp src/language.cpp src/modes.cpp src/modulemanager.cpp src/process.cpp src/users.cpp src/version.sh
Diffstat (limited to 'include/modes.h')
-rw-r--r--include/modes.h51
1 files changed, 40 insertions, 11 deletions
diff --git a/include/modes.h b/include/modes.h
index e13470669..1858da5e4 100644
--- a/include/modes.h
+++ b/include/modes.h
@@ -87,7 +87,7 @@ class CoreExport UserModeParam : public UserMode
* @param value The param
* @return true or false
*/
- virtual bool IsValid(const Anope::string &value) const { return true; }
+ virtual bool IsValid(Anope::string &value) const { return true; }
};
/** This class is a channel mode, all channel modes use this/inherit from this
@@ -95,6 +95,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
@@ -102,6 +105,18 @@ class CoreExport ChannelMode : public Mode
ChannelMode(const Anope::string &name, char mc);
bool CanSet(User *u) const override;
+
+ /** 'wrap' this channel mode and param to the underlying mode and param
+ */
+ virtual ChannelMode *Wrap(Anope::string &param);
+
+ /** 'unwrap' this mode to our internal representation
+ */
+ ChannelMode *Unwrap(Anope::string &param);
+
+ /** called when a mode is being unwrapped, and is asking us if we can unwrap it
+ */
+ virtual ChannelMode *Unwrap(ChannelMode *, Anope::string &param);
};
/** This is a mode for lists, eg b/e/I. These modes should inherit from this
@@ -119,7 +134,7 @@ class CoreExport ChannelModeList : public ChannelMode
* @param mask The mask
* @return true for yes, false for no
*/
- virtual bool IsValid(const Anope::string &mask) const { return true; }
+ virtual bool IsValid(Anope::string &mask) const;
/** Checks if mask affects user
* Should only be used for extbans or other weird ircd-specific things.
@@ -161,7 +176,7 @@ class CoreExport ChannelModeParam : public ChannelMode
* @param value The param
* @return true for yes, false for no
*/
- virtual bool IsValid(const Anope::string &value) const { return true; }
+ virtual bool IsValid(Anope::string &value) const { return true; }
};
/** This is a mode that is a channel status, eg +v/h/o/a/q.
@@ -185,6 +200,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 CoreExport ChannelModeVirtual : public T
+{
+ Anope::string base;
+ ChannelMode *basech;
+
+ public:
+ ChannelModeVirtual(const Anope::string &mname, const Anope::string &basename);
+
+ ~ChannelModeVirtual();
+
+ ChannelMode *Wrap(Anope::string &param) override;
+
+ ChannelMode *Unwrap(ChannelMode *cm, Anope::string &param) = 0;
+};
+
/* The status a user has on a channel (+v, +h, +o) etc */
class CoreExport ChannelStatus
{
@@ -224,7 +258,7 @@ class CoreExport ChannelModeKey : public ChannelModeParam
public:
ChannelModeKey(char mc) : ChannelModeParam("KEY", mc) { }
- bool IsValid(const Anope::string &value) const override;
+ bool IsValid(Anope::string &value) const override;
};
/** This class is used for oper only channel modes
@@ -256,13 +290,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 */
@@ -376,6 +403,8 @@ class CoreExport Entry
*/
const Anope::string GetMask() const;
+ const Anope::string GetNUHMask() const;
+
/** Check if this entry matches a user
* @param u The user
* @param full True to match against a users real host and IP