]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/mode.h
Add support for the IRCv3 extensions to the SETNAME command.
[user/henk/code/inspircd.git] / include / mode.h
index 683f4b55b27502556940ba4207bcccbd917723cf..a7d6ff2b0a8be8c3e44e26325e95fee8f82b9428 100644 (file)
@@ -1,10 +1,14 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
+ *   Copyright (C) 2013-2016 Attila Molnar <attilamolnar@hush.com>
+ *   Copyright (C) 2012-2013, 2017-2020 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2012 Robby <robby@chatbelgie.be>
  *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
- *   Copyright (C) 2004-2006, 2008 Craig Edwards <craigedwards@brainbox.cc>
- *   Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
+ *   Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org>
+ *   Copyright (C) 2007-2008 Robin Burchell <robin+git@viroteck.net>
  *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
+ *   Copyright (C) 2006-2008, 2010 Craig Edwards <brain@inspircd.org>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
  * redistribute it and/or modify it under the terms of the GNU General Public
@@ -451,8 +455,12 @@ class CoreExport PrefixMode : public ModeHandler
 class CoreExport SimpleUserModeHandler : public ModeHandler
 {
  public:
-       SimpleUserModeHandler(Module* Creator, const std::string& Name, char modeletter)
-               : ModeHandler(Creator, Name, modeletter, PARAM_NONE, MODETYPE_USER) {}
+       SimpleUserModeHandler(Module* Creator, const std::string& Name, char modeletter, bool operonly = false)
+               : ModeHandler(Creator, Name, modeletter, PARAM_NONE, MODETYPE_USER)
+       {
+               oper = operonly;
+       }
+
        ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding) CXX11_OVERRIDE;
 };
 
@@ -464,8 +472,12 @@ class CoreExport SimpleUserModeHandler : public ModeHandler
 class CoreExport SimpleChannelModeHandler : public ModeHandler
 {
  public:
-       SimpleChannelModeHandler(Module* Creator, const std::string& Name, char modeletter)
-               : ModeHandler(Creator, Name, modeletter, PARAM_NONE, MODETYPE_CHANNEL) {}
+       SimpleChannelModeHandler(Module* Creator, const std::string& Name, char modeletter, bool operonly = false)
+               : ModeHandler(Creator, Name, modeletter, PARAM_NONE, MODETYPE_CHANNEL)
+       {
+               oper = operonly;
+       }
+
        ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding) CXX11_OVERRIDE;
 };
 
@@ -544,8 +556,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;
@@ -712,7 +728,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.
@@ -731,11 +747,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);