]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/mode.h
Extract command line option parsing to a function.
[user/henk/code/inspircd.git] / include / mode.h
index fe02838b2fc80aef7b47d98deab905818e718cef..7dc7feaec88234d323e6888bec449aec03e4e5f2 100644 (file)
@@ -154,6 +154,9 @@ class CoreExport ModeHandler : public ServiceProvider
        /** The prefix rank required to unset this mode on channels. */
        unsigned int ranktounset;
 
+       /** If non-empty then the syntax of the parameter for this mode. */
+       std::string syntax;
+
  public:
        /**
         * The constructor for ModeHandler initalizes the mode handler.
@@ -329,6 +332,9 @@ class CoreExport ModeHandler : public ServiceProvider
                return adding ? ranktoset : ranktounset;
        }
 
+       /** Retrieves the syntax of the parameter for this mode. */
+       const std::string& GetSyntax() const { return syntax; }
+
        friend class ModeParser;
 };
 
@@ -538,8 +544,12 @@ class CoreExport ModeWatcher : public classbase
 class CoreExport ModeParser : public fakederef<ModeParser>
 {
  public:
+       /** The maximum number of modes which can be created. */
        static const ModeHandler::Id MODEID_MAX = 64;
 
+       /** The maximum length of a mode parameter. */
+       static const size_t MODE_PARAM_MAX = 250;
+
        /** Type of the container that maps mode names to ModeHandlers
         */
        typedef TR1NS::unordered_map<std::string, ModeHandler*, irc::insensitive, irc::StrHashComp> ModeHandlerMap;
@@ -706,7 +716,7 @@ class CoreExport ModeParser : public fakederef<ModeParser>
         * @param user The source of the mode change, can be a server user.
         * @param targetchannel Channel to apply the mode change on. NULL if changing modes on a channel.
         * @param targetuser User to apply the mode change on. NULL if changing modes on a user.
-        * @param changelist Modes to change in form of a Modes::ChangeList. May not process
+        * @param changelist Modes to change in form of a Modes::ChangeList. May not process
         * the entire list due to MODE line length and max modes limitations.
         * @param flags Optional flags controlling how the mode change is processed,
         * defaults to MODE_NONE.
@@ -725,11 +735,11 @@ class CoreExport ModeParser : public fakederef<ModeParser>
         * is a channel mode change.
         * @param parameters List of strings describing the mode change to convert to a ChangeList.
         * Must be using the same format as the parameters of a MODE command.
-        * @param changelist ChangeList object to populate.
-        * @param beginindex Index of the first element that is part of the MODE list in the parameters
-        * container. Defaults to 1.
-        * @param endindex Index of the first element that is not part of the MODE list. By default,
-        * the entire container is considered part of the MODE list.
+        * @param changelist ChangeList object to populate.
+        * @param beginindex Index of the first element that is part of the MODE list in the parameters
+        * container. Defaults to 1.
+        * @param endindex Index of the first element that is not part of the MODE list. By default,
+        * the entire container is considered part of the MODE list.
         */
        void ModeParamsToChangeList(User* user, ModeType type, const std::vector<std::string>& parameters, Modes::ChangeList& changelist, unsigned int beginindex = 1, unsigned int endindex = UINT_MAX);