X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=include%2Fmodules%2Fcap.h;h=5f63b58ce29d24de185cfdee3f0c890a3800c00f;hb=65f74be719bf249f4bc93e09670ee07410ecec96;hp=e6f9340e83b0177669d3d398bd1acfd7a32c79e7;hpb=c933f324085d025d4b1b96f4405cdffff52e9256;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/modules/cap.h b/include/modules/cap.h index e6f9340e8..5f63b58ce 100644 --- a/include/modules/cap.h +++ b/include/modules/cap.h @@ -32,8 +32,9 @@ namespace Cap { public: ExtItem(Module* mod); - std::string serialize(SerializeFormat format, const Extensible* container, void* item) const; - void unserialize(SerializeFormat format, Extensible* container, const std::string& value); + void FromInternal(Extensible* container, const std::string& value) CXX11_OVERRIDE; + std::string ToHuman(const Extensible* container, void* item) const CXX11_OVERRIDE; + std::string ToInternal(const Extensible* container, void* item) const CXX11_OVERRIDE; }; class Capability; @@ -197,7 +198,7 @@ namespace Cap if (!IsRegistered()) return false; Ext caps = extitem->get(user); - return (caps & GetMask()); + return ((caps & GetMask()) != 0); } /** Turn the capability on/off for a user. If the cap is not registered this method has no effect. @@ -313,4 +314,23 @@ namespace Cap return false; } }; + + class MessageBase : public ClientProtocol::Message + { + public: + MessageBase(const std::string& subcmd) + : ClientProtocol::Message("CAP", ServerInstance->Config->ServerName) + { + PushParamPlaceholder(); + PushParam(subcmd); + } + + void SetUser(LocalUser* user) + { + if (user->registered & REG_NICK) + ReplaceParamRef(0, user->nick); + else + ReplaceParam(0, "*"); + } + }; }