InspIRCd  3.0
Public Member Functions | List of all members
ClientProtocol::MessageTagProvider Class Referenceabstract

#include <clientprotocol.h>

Inheritance diagram for ClientProtocol::MessageTagProvider:
Events::ModuleEventListener dynamic_reference_base::CaptureHook

Public Member Functions

 MessageTagProvider (Module *mod)
 
virtual void OnClientProtocolPopulateTags (ClientProtocol::Message &msg)
 
virtual ModResult OnProcessTag (User *user, const std::string &tagname, std::string &tagvalue)
 
virtual bool ShouldSendTag (LocalUser *user, const MessageTagData &tagdata)=0
 
- Public Member Functions inherited from Events::ModuleEventListener
 ModuleEventListener (Module *mod, const std::string &eventid, unsigned int eventprio=DefaultPriority)
 

Additional Inherited Members

- Static Public Attributes inherited from Events::ModuleEventListener
static const unsigned int DefaultPriority = 100
 

Detailed Description

Base class for message tag providers. All message tags belong to a message tag provider. Message tag providers can populate messages with tags before the message is sent and they have the job of determining whether a user should get a message tag or be allowed to send one.

Constructor & Destructor Documentation

◆ MessageTagProvider()

ClientProtocol::MessageTagProvider::MessageTagProvider ( Module mod)
inline

Constructor.

Parameters
modModule owning the provider.

Member Function Documentation

◆ OnClientProtocolPopulateTags()

virtual void ClientProtocol::MessageTagProvider::OnClientProtocolPopulateTags ( ClientProtocol::Message msg)
inlinevirtual

Called when a message is ready to be sent to give the tag provider a chance to add tags to the message. To add tags call Message::AddTag(). If the provided tag or tags have been added already elsewhere or if the provider doesn't want its tag(s) to be on the message, the implementation doesn't have to do anything special. The default implementation does nothing.

Parameters
msgMessage to be populated with tags.

◆ OnProcessTag()

virtual ModResult ClientProtocol::MessageTagProvider::OnProcessTag ( User user,
const std::string &  tagname,
std::string &  tagvalue 
)
inlinevirtual

Called for each tag that the server receives from a client in a message.

Parameters
userUser that sent the tag.
tagnameName of the tag.
tagvalueValue of the tag, empty string if the tag has no value. May be modified.
Returns
MOD_RES_ALLOW to accept the tag with the value in 'value', MOD_RES_DENY to reject the tag and act as if it wasn't sent, MOD_RES_PASSTHRU to make no decision. If no hooks accept a tag, the tag is rejected. The default implementation returns MOD_RES_PASSTHRU.

◆ ShouldSendTag()

virtual bool ClientProtocol::MessageTagProvider::ShouldSendTag ( LocalUser user,
const MessageTagData tagdata 
)
pure virtual

Called whenever a user is about to receive a message that has a tag attached which is provided by this provider to determine whether or not the user should get the tag.

Parameters
userUser in question.
tagdataTag in question.
Returns
True if the tag should be sent to the user, false otherwise.

The documentation for this class was generated from the following file: