X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmode.h;h=6b481e7796c744a2efbf2e5055401b2899d9c25c;hb=60d92db9a1b71bbfd4230c5eb9f04cd6a87a41d8;hp=09382237262d455a32cf13a0b46458ae9eda731f;hpb=5a5dcfa4f90f4235621b87d93c227566caa0fce1;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/mode.h b/include/mode.h index 093822372..6b481e779 100644 --- a/include/mode.h +++ b/include/mode.h @@ -166,7 +166,7 @@ class CoreExport ModeHandler : public ServiceProvider * @param mclass The object type of this mode handler, one of ModeHandler::Class */ ModeHandler(Module* me, const std::string& name, char modeletter, ParamSpec params, ModeType type, Class mclass = MC_OTHER); - virtual CullResult cull(); + virtual CullResult cull() CXX11_OVERRIDE; virtual ~ModeHandler(); /** Register this object in the ModeParser @@ -184,6 +184,12 @@ class CoreExport ModeHandler : public ServiceProvider */ PrefixMode* IsPrefixMode(); + /** + * Check whether this mode is a prefix mode + * @return non-NULL if this mode is a prefix mode, NULL otherwise + */ + const PrefixMode* IsPrefixMode() const; + /** * Check whether this mode handler inherits from ListModeBase * @return non-NULL if this mode handler inherits from ListModeBase, NULL otherwise @@ -192,10 +198,22 @@ class CoreExport ModeHandler : public ServiceProvider /** * Check whether this mode handler inherits from ListModeBase + * @return non-NULL if this mode handler inherits from ListModeBase, NULL otherwise + */ + const ListModeBase* IsListModeBase() const; + + /** + * Check whether this mode handler inherits from ParamModeBase * @return non-NULL if this mode handler inherits from ParamModeBase, NULL otherwise */ ParamModeBase* IsParameterMode(); + /** + * Check whether this mode handler inherits from ParamModeBase + * @return non-NULL if this mode handler inherits from ParamModeBase, NULL otherwise + */ + const ParamModeBase* IsParameterMode() const; + /** * Returns the mode's type */ @@ -223,7 +241,7 @@ class CoreExport ModeHandler : public ServiceProvider /** For user modes, return the current parameter, if any */ - virtual std::string GetUserParameter(User* useor); + virtual std::string GetUserParameter(const User* user) const; /** * Called when a channel mode change access check for your mode occurs. @@ -362,7 +380,7 @@ class CoreExport PrefixMode : public ModeHandler /** * Removes this prefix mode from all users on the given channel - * @param chan The channel which the server wants to remove your mode from + * @param channel The channel which the server wants to remove your mode from * @param changelist Mode change list to populate with the removal of this mode */ void RemoveMode(Channel* channel, Modes::ChangeList& changelist); @@ -612,6 +630,8 @@ class CoreExport ModeParser : public fakederef */ static void InitBuiltinModes(); + static bool IsModeChar(char chr); + /** Tidy a banmask. This makes a banmask 'acceptable' if fields are left out. * E.g. * @@ -790,12 +810,27 @@ inline PrefixMode* ModeHandler::IsPrefixMode() return (this->type_id == MC_PREFIX ? static_cast(this) : NULL); } +inline const PrefixMode* ModeHandler::IsPrefixMode() const +{ + return (this->type_id == MC_PREFIX ? static_cast(this) : NULL); +} + inline ListModeBase* ModeHandler::IsListModeBase() { return (this->type_id == MC_LIST ? reinterpret_cast(this) : NULL); } +inline const ListModeBase* ModeHandler::IsListModeBase() const +{ + return (this->type_id == MC_LIST ? reinterpret_cast(this) : NULL); +} + inline ParamModeBase* ModeHandler::IsParameterMode() { return (this->type_id == MC_PARAM ? reinterpret_cast(this) : NULL); } + +inline const ParamModeBase* ModeHandler::IsParameterMode() const +{ + return (this->type_id == MC_PARAM ? reinterpret_cast(this) : NULL); +}