]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/mode.h
Valgrind cleanup: deallocate RFC modes, clientlist, and uuidlist
[user/henk/code/inspircd.git] / include / mode.h
index 280284bfa8c77b775f2e6009dfacf0a758ba1857..da202c2364c5f09e2a2703f36ef72d878a3bc50c 100644 (file)
@@ -91,7 +91,7 @@ typedef std::pair<bool,std::string> ModePair;
  * mode is expected to have a parameter, then this is
  * equivalent to returning MODEACTION_DENY.
  */
-class CoreExport ModeHandler : public Extensible
+class CoreExport ModeHandler : public classbase
 {
  protected:
        /**
@@ -266,14 +266,12 @@ class CoreExport ModeHandler : public Extensible
         * override this function and use it to return true or false. The default implementation just returns true if
         * theirs < ours. This will only be called for non-listmodes with parameters, when adding the mode and where
         * theirs == ours (therefore the default implementation will always return false).
-        * @param theirs The timestamp of the remote side
-        * @param ours The timestamp of the local side
         * @param their_param Their parameter if the mode has a parameter
         * @param our_param Our parameter if the mode has a parameter
         * @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(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, Channel* channel);
+       virtual bool CheckTimeStamp(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
@@ -347,7 +345,7 @@ class CoreExport SimpleChannelModeHandler : public ModeHandler
  * and attach it to the mode using Server::AddModeWatcher and Server::DelModeWatcher.
  * A ModeWatcher will be called both before and after the mode change.
  */
-class CoreExport ModeWatcher : public Extensible
+class CoreExport ModeWatcher : public classbase
 {
  protected:
        /**
@@ -440,13 +438,22 @@ class CoreExport ModeParser : public classbase
         * Used by ModeParser::Process.
         */
        void DisplayCurrentModes(User *user, User* targetuser, Channel* targetchannel, const char* text);
+       /** Displays the value of a list mode
+        * Used by ModeParser::Process.
+        */
+       void DisplayListModes(User* user, Channel* chan, std::string &mode_sequence);
+
+       /**
+        * Attempts to apply a mode change to a user or channel
+        */
+       ModeAction TryMode(User* user, User* targu, Channel* targc, bool adding, unsigned char mode, std::string &param, bool servermode, bool SkipACL);
 
        /** The string representing the last set of modes to be parsed.
         * Use GetLastParse() to get this value, to be used for  display purposes.
         */
        std::string LastParse;
-       std::deque<std::string> LastParseParams;
-       std::deque<TranslateType> LastParseTranslate;
+       std::vector<std::string> LastParseParams;
+       std::vector<TranslateType> LastParseTranslate;
 
        unsigned int sent[256];
 
@@ -457,6 +464,7 @@ class CoreExport ModeParser : public classbase
        /** The constructor initializes all the RFC basic modes by using ModeParserAddMode().
         */
        ModeParser(InspIRCd* Instance);
+       ~ModeParser();
 
        /** Used to check if user 'd' should be allowed to do operation 'MASK' on channel 'chan'.
         * for example, should 'user A' be able to 'op' on 'channel B'.
@@ -488,8 +496,8 @@ class CoreExport ModeParser : public classbase
         * @return Last parsed string, as seen by users.
         */
        const std::string& GetLastParse();
-       const std::deque<std::string>& GetLastParseParams() { return LastParseParams; }
-       const std::deque<TranslateType>& GetLastParseTranslate() { return LastParseTranslate; }
+       const std::vector<std::string>& GetLastParseParams() { return LastParseParams; }
+       const std::vector<TranslateType>& GetLastParseTranslate() { return LastParseTranslate; }
        /** Add a mode to the mode parser.
         * @return True if the mode was successfully added.
         */
@@ -527,7 +535,7 @@ class CoreExport ModeParser : public classbase
         * and *user->server == NULL.
         * @param servermode True if a server is setting the mode.
         */
-       void Process(const std::vector<std::string>& parameters, User *user, bool servermode);
+       void Process(const std::vector<std::string>& parameters, User *user, bool servermode, bool merge = false);
 
        /** Find the mode handler for a given mode and type.
         * @param modeletter mode letter to search for