* 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:
/**
* 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
* 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:
/**
* 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 ¶m, 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];
/** 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'.
* @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.
*/
* 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