InspIRCd
3.0
|
#include <clientprotocol.h>
Classes | |
class | Param |
struct | SerializedInfo |
Public Types | |
typedef std::vector< Param > | ParamList |
Public Member Functions | |
Message (const char *cmd, User *Sourceuser=NULL) | |
Message (const char *cmd, const std::string &Sourcestr, User *Sourceuser=NULL) | |
const ParamList & | GetParams () const |
const TagMap & | GetTags () const |
const char * | GetCommand () const |
void | PushParam (const char *str) |
void | PushParam (const std::string &str) |
void | PushParamRef (const std::string &str) |
void | PushParamPlaceholder () |
void | ReplaceParam (unsigned int index, const char *str) |
void | ReplaceParam (unsigned int index, const std::string &str) |
void | ReplaceParamRef (unsigned int index, const std::string &str) |
void | AddTag (const std::string &tagname, MessageTagProvider *tagprov, const std::string &val, void *tagdata=NULL) |
void | AddTags (const ClientProtocol::TagMap &newtags) |
const SerializedMessage & | GetSerialized (const SerializedInfo &serializeinfo) const |
void | ClearParams () |
void | InvalidateCache () |
void | CopyAll () |
void | SetSideEffect (bool Sideeffect) |
bool | IsSideEffect () const |
Protected Member Functions | |
void | SetCommand (const char *cmd) |
Friends | |
class | Serializer |
Outgoing client protocol message. Represents a high level client protocol message which is turned into raw or wire format by a Serializer. Messages can be serialized into different format by different serializers.
Messages are created on demand and are disposed of after they have been sent.
All messages have a command name, a list of parameters and a map of tags, the last two can be empty. They also always have a source, see class MessageSource.
|
inline |
Constructor.
cmd | Command name, e.g. "JOIN", "NICK". May be NULL. If NULL, the command must be set with SetCommand() before the message is serialized. |
Sourceuser | See the one parameter constructor of MessageSource for description. |
|
inline |
Constructor.
cmd | Command name, e.g. "JOIN", "NICK". May be NULL. If NULL, the command must be set with SetCommand() before the message is serialized. |
Sourcestr | See the two parameter constructor of MessageSource for description. Must remain valid as long as this object is alive. |
Sourceuser | See the two parameter constructor of MessageSource for description. |
|
inline |
Add a tag.
tagname | Raw name of the tag to use in the protocol. |
tagprov | Provider of the tag. |
val | Tag value. If empty no value will be sent with the tag. |
tagdata | Tag provider specific data, will be passed to MessageTagProvider::ShouldSendTag(). Optional, defaults to NULL. |
|
inline |
Add all tags in a TagMap to the tags in this message. Existing tags will not be overwritten.
newtags | New tags to add. |
|
inline |
Clear the parameter list and tags.
|
inline |
Get the command string.
|
inline |
Get the parameters of this message.
const ClientProtocol::SerializedMessage & ClientProtocol::Message::GetSerialized | ( | const SerializedInfo & | serializeinfo | ) | const |
Get the message in a serialized form.
serializeinfo | Information about which exact serialized form of the message is the caller asking for (which serializer to use and which tags to include). |
|
inline |
Get a map of tags attached to this message. The map contains the tag providers that attached the tag to the message.
|
inline |
Remove all serialized messages. If a parameter is changed after the message has been sent at least once, this method must be called before serializing the message again to ensure the cache won't contain stale data.
|
inline |
Add a parameter to the parameter list.
str | String to add, will be copied. |
|
inline |
Add a parameter to the parameter list.
str | String to add, will be copied. |
|
inline |
Add a placeholder parameter to the parameter list. Placeholder parameters must be filled in later with actual parameters using ReplaceParam() or ReplaceParamRef().
|
inline |
Add a parameter to the parameter list.
str | String to add. The string will NOT be copied, it must remain alive until ClearParams() is called or until the object is destroyed. |
|
inline |
Replace a parameter or a placeholder that is already in the parameter list.
index | Index of the parameter to replace. Must be less than GetParams().size(). |
str | String to replace the parameter or placeholder with, will be copied. |
|
inline |
Replace a parameter or a placeholder that is already in the parameter list.
index | Index of the parameter to replace. Must be less than GetParams().size(). |
str | String to replace the parameter or placeholder with, will be copied. |
|
inline |
Replace a parameter or a placeholder that is already in the parameter list.
index | Index of the parameter to replace. Must be less than GetParams().size(). |
str | String to replace the parameter or placeholder with. The string will NOT be copied, it must remain alive until ClearParams() is called or until the object is destroyed. |
|
inlineprotected |
Set command string.
cmd | Command string to set. |