diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-05-26 22:40:45 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-06-01 23:41:42 +0200 |
commit | d16a4554002e915f4512dc8b72e4a49073931e63 (patch) | |
tree | ea6c893523fe885f053f6b45185be56611088d9f /include | |
parent | ca838821e7c53da0ddaee35d9a401e3a5eaf8c8c (diff) |
Watch mode names with ModeWatchers instead of mode letters
Diffstat (limited to 'include')
-rw-r--r-- | include/mode.h | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/include/mode.h b/include/mode.h index 32c87d8b0..fc0122788 100644 --- a/include/mode.h +++ b/include/mode.h @@ -342,11 +342,12 @@ class CoreExport ParamChannelModeHandler : public ModeHandler */ class CoreExport ModeWatcher : public classbase { - protected: + private: /** - * The mode letter this class is watching + * The mode name this class is watching */ - char mode; + const std::string mode; + /** * The mode type being watched (user or channel) */ @@ -357,17 +358,18 @@ class CoreExport ModeWatcher : public classbase /** * The constructor initializes the mode and the mode type */ - ModeWatcher(Module* creator, char modeletter, ModeType type); + ModeWatcher(Module* creator, const std::string& modename, ModeType type); /** * The default destructor does nothing. */ virtual ~ModeWatcher(); /** - * Get the mode character being watched - * @return The mode character being watched + * Get the mode name being watched + * @return The mode name being watched */ - char GetModeChar(); + const std::string& GetModeName() const { return mode; } + /** * Get the mode type being watched * @return The mode type being watched (user or channel) @@ -399,7 +401,7 @@ class CoreExport ModeWatcher : public classbase virtual void AfterMode(User* source, User* dest, Channel* channel, const std::string& parameter, bool adding); }; -typedef std::vector<ModeWatcher*>::iterator ModeWatchIter; +typedef std::multimap<std::string, ModeWatcher*>::iterator ModeWatchIter; /** The mode parser handles routing of modes and handling of mode strings. * It marshalls, controls and maintains both ModeWatcher and ModeHandler classes, @@ -415,11 +417,11 @@ class CoreExport ModeParser * or a channel mode, so we have 256 of them not 64. */ ModeHandler* modehandlers[256]; - /** Mode watcher classes arranged in the same way as the - * mode handlers, except for instead of having 256 of them - * we have 256 lists of them. + + /** Mode watcher classes */ - std::vector<ModeWatcher*> modewatchers[256]; + std::multimap<std::string, ModeWatcher*> modewatchermap; + /** Displays the current modes of a channel or user. * Used by ModeParser::Process. */ @@ -512,9 +514,9 @@ class CoreExport ModeParser * triggered. See the documentation of class ModeWatcher for more * information. * @param mw The ModeWatcher you want to add - * @return True if the ModeWatcher was added correctly */ - bool AddModeWatcher(ModeWatcher* mw); + void AddModeWatcher(ModeWatcher* mw); + /** Delete a mode watcher. * A mode watcher is triggered before and after a mode handler is * triggered. See the documentation of class ModeWatcher for more |