]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/mode.h
Run DelMode and DelModeWatcher in RemoveModule
[user/henk/code/inspircd.git] / include / mode.h
index c0cb5b0fc15308c21b3a137a48bc8ff878427ad7..1b02efeaaf10a6b29e11fd423307ee71dc537499 100644 (file)
@@ -105,13 +105,29 @@ class CoreExport ModeHandler : public classbase
 {
  protected:
        /**
-        * The mode letter you're implementing.
+        * The mode parameter translation type
         */
-       char mode;
+       TranslateType m_paramtype;
 
        /** What kind of parameters does the mode take?
         */
        ParamSpec parameters_taken;
+
+       /**
+        * The mode letter you're implementing.
+        */
+       char mode;
+
+       /** Mode prefix, or 0
+        */
+       char prefix;
+
+       /**
+        * True if the mode requires oper status
+        * to set.
+        */
+       bool oper;
+
        /**
         * Mode is a 'list' mode. The behaviour
         * of your mode is now set entirely within
@@ -123,24 +139,12 @@ class CoreExport ModeHandler : public classbase
         * (e.g. banlists, etc)
         */
        bool list;
+
        /**
         * The mode type, either MODETYPE_USER or
         * MODETYPE_CHANNEL.
         */
        ModeType m_type;
-       /**
-        * The mode parameter translation type
-        */
-       TranslateType m_paramtype;
-       /**
-        * True if the mode requires oper status
-        * to set.
-        */
-       bool oper;
-
-       /** Mode prefix, or 0
-        */
-       char prefix;
 
        /** Number of items with this mode set on them
         */
@@ -153,7 +157,7 @@ class CoreExport ModeHandler : public classbase
 
  public:
        /** Module that created this mode. NULL for core modes */
-       Module* creator;
+       Module* const creator;
 
        /**
         * The constructor for ModeHandler initalizes the mode handler.
@@ -286,7 +290,7 @@ class CoreExport ModeHandler : public classbase
         * @param channel The channel we are checking against
         * @return True if the other side wins the merge, false if we win the merge for this mode.
         */
-       virtual bool CheckTimeStamp(std::string &their_param, const std::string &our_param, Channel* channel);
+       virtual bool ResolveModeConflict(std::string &their_param, const std::string &our_param, Channel* channel);
 
        /**
         * When a remote server needs to bounce a set of modes, it will call this method for every mode
@@ -348,7 +352,7 @@ class CoreExport SimpleUserModeHandler : public ModeHandler
 class CoreExport SimpleChannelModeHandler : public ModeHandler
 {
  public:
-       SimpleChannelModeHandler(InspIRCd* Instance, Module* Creator, char modeletter)
+       SimpleChannelModeHandler(Module* Creator, char modeletter)
                : ModeHandler(Creator, modeletter, PARAM_NONE, MODETYPE_CHANNEL) {}
        virtual ~SimpleChannelModeHandler() {}
        virtual ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
@@ -363,10 +367,6 @@ class CoreExport SimpleChannelModeHandler : public ModeHandler
 class CoreExport ModeWatcher : public classbase
 {
  protected:
-       /**
-        * Creator/owner pointer
-        */
-       InspIRCd* ServerInstance;
        /**
         * The mode letter this class is watching
         */
@@ -377,10 +377,11 @@ class CoreExport ModeWatcher : public classbase
        ModeType m_type;
 
  public:
+       Module* const creator;
        /**
         * The constructor initializes the mode and the mode type
         */
-       ModeWatcher(InspIRCd* Instance, char modeletter, ModeType type);
+       ModeWatcher(Module* creator, char modeletter, ModeType type);
        /**
         * The default destructor does nothing.
         */
@@ -474,7 +475,7 @@ class CoreExport ModeParser : public classbase
 
        /** The constructor initializes all the RFC basic modes by using ModeParserAddMode().
         */
-       ModeParser(InspIRCd* Instance);
+       ModeParser();
        ~ModeParser();
 
        /** Used to check if user 'd' should be allowed to do operation 'MASK' on channel 'chan'.
@@ -516,6 +517,10 @@ class CoreExport ModeParser : public classbase
         * @return True if the mode was successfully removed.
         */
        bool DelMode(ModeHandler* mh);
+
+       /** Delete all modes and mode watchers associated with a given module
+        */
+       void RemoveModes(Module* mod);
        /** Add a mode watcher.
         * A mode watcher is triggered before and after a mode handler is
         * triggered. See the documentation of class ModeWatcher for more