]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/ctables.h
Fix indentation of CheckRoot() and error in non-interactive mode.
[user/henk/code/inspircd.git] / include / ctables.h
index c34e4abeb4ab9f1b6336a2b42fa0394068b97daf..1c7d5b4bd5dadd1e45d619323ebab6411b71ca72 100644 (file)
@@ -110,7 +110,40 @@ struct RouteDescriptor
 class CoreExport CommandBase : public ServiceProvider
 {
  public:
-       typedef std::vector<std::string> Params;
+       /** Encapsulates parameters to a command. */
+       class Params : public std::vector<std::string>
+       {
+        private:
+               /* IRCv3 message tags. */
+               ClientProtocol::TagMap tags;
+
+        public:
+               /** Initializes a new instance from parameter and tag references.
+                * @param paramsref Message parameters.
+                * @param tagsref IRCv3 message tags.
+                */
+               Params(const std::vector<std::string>& paramsref, const ClientProtocol::TagMap& tagsref)
+                       : std::vector<std::string>(paramsref)
+                       , tags(tagsref)
+               {
+               }
+
+               /** Initializes a new instance from parameter iterators.
+                * @param first The first element in the parameter array.
+                * @param last The last element in the parameter array.
+                */
+               template<typename Iterator>
+               Params(Iterator first, Iterator last)
+                       : std::vector<std::string>(first, last)
+               {
+               }
+
+               /** Initializes a new empty instance. */
+               Params() { }
+
+               /** Retrieves the IRCv3 message tags. */
+               const ClientProtocol::TagMap& GetTags() const { return tags; }
+       };
 
        /** User flags needed to execute the command or 0
         */
@@ -130,10 +163,6 @@ class CoreExport CommandBase : public ServiceProvider
         */
        unsigned long use_count;
 
-       /** True if the command is disabled to non-opers
-        */
-       bool disabled;
-
        /** True if the command can be issued before registering
         */
        bool works_before_reg;
@@ -179,23 +208,6 @@ class CoreExport CommandBase : public ServiceProvider
         */
        virtual void EncodeParameter(std::string& parameter, unsigned int index);
 
-       /** Disable or enable this command.
-        * @param setting True to disable the command.
-        */
-       void Disable(bool setting)
-       {
-               disabled = setting;
-       }
-
-       /** Obtain this command's disable state.
-        * @return true if the command is currently disabled
-        * (disabled commands can be used only by operators)
-        */
-       bool IsDisabled()
-       {
-               return disabled;
-       }
-
        /** @return true if the command works before registration.
         */
        bool WorksBeforeReg()