diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-04-09 20:40:47 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-04-09 20:40:47 +0000 |
commit | 772d6f16c0c474d2b66121c618c0273c26ca574e (patch) | |
tree | 1a535f64d6c3ed328a7424666506a8bb5df75d1a /include | |
parent | aa21503f06e3a32945c003ce4193a766ea58642b (diff) |
Start of mode parser refactoring
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3855 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r-- | include/mode.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/include/mode.h b/include/mode.h index 08ac33597..cfac562e6 100644 --- a/include/mode.h +++ b/include/mode.h @@ -35,6 +35,66 @@ enum UserModeBits { UM_WALLOPS = 4 }; +enum ModeType { + MODETYPE_USER = 0, + MODETYPE_CHANNEL = 1 +}; + +enum ModeAction { + MODEACTION_DENY = 0, /* Drop the mode change, AND a parameter if its a parameterized mode */ + MODEACTION_ALLOW = 1 /* Allow the mode */ +}; + +class ModeOutput +{ + private: + std::string par; + ModeAction act; + public: + ModeOutput(std::string parameter, ModeAction action); + ModeAction GetAction(); + std::string& GetParameter(); +}; + +class ModeHandler +{ + char mode; + int n_params; + bool list; + ModeType m_type; + bool oper; + + public: + ModeHandler(char modeletter, int parameters, bool listmode, ModeType type, bool operonly); + virtual ~ModeHandler(); + + bool IsListMode(); + ModeType GetModeType(); + bool NeedsOper(); + int GetNumParams(); + char GetModeChar(); + + virtual ModeOutput OnModeChange(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter, bool adding); + virtual void DisplayList(userrec* user, chanrec* channel); + virtual bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel); +}; + +class ModeWatcher +{ + char mode; + ModeType m_type; + + public: + ModeWatcher(char modeletter, ModeType type); + virtual ~ModeWatcher(); + + char GetModeChar(); + ModeType GetModeType(); + + virtual bool BeforeMode(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter, bool adding); + virtual void AfterMode(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter, bool adding); +}; + class ModeParser { private: |