X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fbuiltinmodes.h;h=ce73a78171c374cbf3c4f44ee72f2ff7deb63200;hb=11916574f67962dce1d7a2fdf7ef6a3d2d1fa49f;hp=ab1da8740a6890742729bb2fc9bbab52d3a38718;hpb=1bf6cf727da706d821bc4cf84055e27be5ed7f7c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/builtinmodes.h b/include/builtinmodes.h index ab1da8740..ce73a7817 100644 --- a/include/builtinmodes.h +++ b/include/builtinmodes.h @@ -22,22 +22,17 @@ #include "mode.h" #include "channels.h" +#include "listmode.h" /** Channel mode +b */ -class ModeChannelBan : public ModeHandler +class ModeChannelBan : public ListModeBase { - private: - BanItem b; public: - ModeChannelBan(); - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); - std::string& AddBan(User *user,std::string& dest,Channel *chan,int status); - std::string& DelBan(User *user,std::string& dest,Channel *chan,int status); - void DisplayList(User* user, Channel* channel); - void DisplayEmptyList(User* user, Channel* channel); - void RemoveMode(User* user, irc::modestacker* stack = NULL); - void RemoveMode(Channel* channel, irc::modestacker* stack = NULL); + ModeChannelBan() + : ListModeBase(NULL, "ban", 'b', "End of channel ban list", 367, 368, true, "maxbans") + { + } }; /** Channel mode +i @@ -57,11 +52,8 @@ class ModeChannelKey : public ModeHandler public: ModeChannelKey(); ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding); - void RemoveMode(Channel* channel, irc::modestacker* stack = NULL); - void RemoveMode(User* user, irc::modestacker* stack = NULL); }; - /** Channel mode +l */ class ModeChannelLimit : public ParamChannelModeHandler @@ -94,15 +86,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 ¶meter, bool adding); - unsigned int GetPrefixRank(); - void RemoveMode(Channel* channel, irc::modestacker* stack = NULL); - void RemoveMode(User* user, irc::modestacker* stack = NULL); }; /** Channel mode +p @@ -137,15 +124,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 ¶meter, bool adding); - unsigned int GetPrefixRank(); - void RemoveMode(User* user, irc::modestacker* stack = NULL); - void RemoveMode(Channel* channel, irc::modestacker* stack = NULL); }; /** User mode +i @@ -158,14 +140,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 ¶meter, 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); };