summaryrefslogtreecommitdiff
path: root/include/mode.h
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-06-13 18:15:34 +0200
committerattilamolnar <attilamolnar@hush.com>2013-06-13 18:15:34 +0200
commit3624c137a6db85eaab0372550c9dca79d6d21e55 (patch)
treecdfd14b2522583e057db26a2104397c05dc56c68 /include/mode.h
parentb390ded3f3924cbd16a5dab53a981be279360124 (diff)
Introduce ModeProcessFlags, can be passed to ModeParser::Process() to indicate local only mode changes and mode merges
Change ProtocolInterface::SendMode() to take source and destination parameters, and call it from the mode parser whenever the mode change is global This deprecates the ambiguous InspIRCd::SendMode() and InspIRCd::SendGlobalMode() interface (the latter sent mode changes originating from local users twice, etc.)
Diffstat (limited to 'include/mode.h')
-rw-r--r--include/mode.h32
1 files changed, 27 insertions, 5 deletions
diff --git a/include/mode.h b/include/mode.h
index 3805b174b..9b8d07877 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -471,6 +471,29 @@ class CoreExport ModeParser
std::string Cached004ModeList;
public:
+ typedef unsigned int ModeProcessFlag;
+ enum ModeProcessFlags
+ {
+ /** If only this flag is specified, the mode change will be global
+ * and parameter modes will have their parameters explicitly set
+ * (not merged). This is the default.
+ */
+ MODE_NONE = 0,
+
+ /** If this flag is set then the parameters of non-listmodes will be
+ * merged according to their conflict resolution rules.
+ * Does not affect user modes, channel modes without a parameter and
+ * listmodes.
+ */
+ MODE_MERGE = 1,
+
+ /** If this flag is set then the mode change won't be handed over to
+ * the linking module to be sent to other servers, but will be processed
+ * locally and sent to local user(s) as usual.
+ */
+ MODE_LOCALONLY = 2
+ };
+
ModeParser();
~ModeParser();
@@ -533,12 +556,11 @@ class CoreExport ModeParser
/** Process a set of mode changes from a server or user.
* @param parameters The parameters of the mode change, in the format
* they would be from a MODE command.
- * @param user The user setting or removing the modes. When the modes are set
- * by a server, an 'uninitialized' User is used, where *user\::nick == NULL
- * and *user->server == NULL.
- * @param merge Should the mode parameters be merged?
+ * @param user The source of the mode change, can be a server user.
+ * @param flags Optional flags controlling how the mode change is processed,
+ * defaults to MODE_NONE.
*/
- void Process(const std::vector<std::string>& parameters, User *user, bool merge = false);
+ void Process(const std::vector<std::string>& parameters, User* user, ModeProcessFlag flags = MODE_NONE);
/** Find the mode handler for a given mode and type.
* @param modeletter mode letter to search for