]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/builtinmodes.h
Move {prefix|suffix|fixed}{quit|part} into core_user
[user/henk/code/inspircd.git] / include / builtinmodes.h
index a4a9509221ad0bac156b4df04a145e64dc160f66..6aab727cca448390852774ff7085a593bdf8a43d 100644 (file)
@@ -47,24 +47,24 @@ class ModeChannelInviteOnly : public SimpleChannelModeHandler
 
 /** Channel mode +k
  */
-class ModeChannelKey : public ModeHandler
+class ModeChannelKey : public ParamMode<ModeChannelKey, LocalStringExt>
 {
  public:
        ModeChannelKey();
        ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
-       void RemoveMode(Channel* channel, irc::modestacker* stack = NULL);
-       void RemoveMode(User* user, irc::modestacker* stack = NULL);
+       void SerializeParam(Channel* chan, const std::string* key, std::string& out);
+       ModeAction OnSet(User* source, Channel* chan, std::string& param);
 };
 
-
 /** Channel mode +l
  */
-class ModeChannelLimit : public ParamChannelModeHandler
+class ModeChannelLimit : public ParamMode<ModeChannelLimit, LocalIntExt>
 {
  public:
        ModeChannelLimit();
-       bool ParamValidate(std::string& parameter);
        bool ResolveModeConflict(std::string &their_param, const std::string &our_param, Channel* channel);
+       void SerializeParam(Channel* chan, intptr_t n, std::string& out);
+       ModeAction OnSet(User* source, Channel* channel, std::string& parameter);
 };
 
 /** Channel mode +m
@@ -89,15 +89,10 @@ class ModeChannelNoExternal : public SimpleChannelModeHandler
 
 /** Channel mode +o
  */
-class ModeChannelOp : public ModeHandler
+class ModeChannelOp : public PrefixMode
 {
- private:
  public:
        ModeChannelOp();
-       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
-       unsigned int GetPrefixRank();
-       void RemoveMode(Channel* channel, irc::modestacker* stack = NULL);
-       void RemoveMode(User* user, irc::modestacker* stack = NULL);
 };
 
 /** Channel mode +p
@@ -132,15 +127,10 @@ class ModeChannelTopicOps : public SimpleChannelModeHandler
 
 /** Channel mode +v
  */
-class ModeChannelVoice : public ModeHandler
+class ModeChannelVoice : public PrefixMode
 {
- private:
  public:
        ModeChannelVoice();
-       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
-       unsigned int GetPrefixRank();
-       void RemoveMode(User* user, irc::modestacker* stack = NULL);
-       void RemoveMode(Channel* channel, irc::modestacker* stack = NULL);
 };
 
 /** User mode +i
@@ -153,14 +143,28 @@ class ModeUserInvisible : public SimpleUserModeHandler
        }
 };
 
-/** User mode +n
+/** User mode +s
  */
 class ModeUserServerNoticeMask : public ModeHandler
 {
+       /** Process a snomask modifier string, e.g. +abc-de
+        * @param user The target user
+        * @param input A sequence of notice mask characters
+        * @return The cleaned mode sequence which can be output,
+        * e.g. in the above example if masks c and e are not
+        * valid, this function will return +ab-d
+        */
+       std::string ProcessNoticeMasks(User* user, const std::string& input);
+
  public:
        ModeUserServerNoticeMask();
        ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
        void OnParameterMissing(User* user, User* dest, Channel* channel);
+
+       /** Create a displayable mode string of the snomasks set on a given user
+        * @param user The user whose notice masks to format
+        * @return The notice mask character sequence
+        */
        std::string GetUserParameter(User* user);
 };