X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=include%2Fmode.h;h=7dc7feaec88234d323e6888bec449aec03e4e5f2;hb=9982ec4e5b027ed24b1fda5e6fd3ab35b98de1a7;hp=fe02838b2fc80aef7b47d98deab905818e718cef;hpb=c6e40d36b42a7ebf832c3a57d2816a47ee9c9a76;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/mode.h b/include/mode.h index fe02838b2..7dc7feaec 100644 --- a/include/mode.h +++ b/include/mode.h @@ -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 { 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 ModeHandlerMap; @@ -706,7 +716,7 @@ class CoreExport ModeParser : public fakederef * @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 * 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& parameters, Modes::ChangeList& changelist, unsigned int beginindex = 1, unsigned int endindex = UINT_MAX);