Home
Symple module

Presence

Symple presence message indicating a peer's online status.

Presence

#include <icy/symple/presence.h>
class Presence

Defined in src/symple/include/icy/symple/presence.h:27

Inherits: Message

Symple presence message indicating a peer's online status.

Presence messages carry peer data in the data field. When probe is true the recipient should respond with their own presence.

List of all members

NameKindOwner
PresencefunctionDeclared here
PresencefunctionDeclared here
PresencefunctionDeclared here
~PresencefunctionDeclared here
isProbefunctionDeclared here
setProbefunctionDeclared here
MessagefunctionInherited from Message
MessagefunctionInherited from Message
MessagefunctionInherited from Message
operator=functionInherited from Message
~MessagefunctionInherited from Message
clonefunctionInherited from Message
validfunctionInherited from Message
clearfunctionInherited from Message
clearDatafunctionInherited from Message
clearNotesfunctionInherited from Message
typefunctionInherited from Message
idfunctionInherited from Message
tofunctionInherited from Message
fromfunctionInherited from Message
toUserfunctionInherited from Message
toIdfunctionInherited from Message
fromUserfunctionInherited from Message
fromIdfunctionInherited from Message
statusfunctionInherited from Message
setTypefunctionInherited from Message
setTofunctionInherited from Message
setTofunctionInherited from Message
setTofunctionInherited from Message
setFromfunctionInherited from Message
setFromfunctionInherited from Message
setFromfunctionInherited from Message
setStatusfunctionInherited from Message
notesfunctionInherited from Message
setNotefunctionInherited from Message
addNotefunctionInherited from Message
datafunctionInherited from Message
datafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
removeDatafunctionInherited from Message
hasDatafunctionInherited from Message
readfunctionInherited from Message
readfunctionInherited from Message
writefunctionInherited from Message
isRequestfunctionInherited from Message
sizefunctionInherited from Message
printfunctionInherited from Message
classNamefunctionInherited from Message
datafunctionInherited from Message
hasDatafunctionInherited from Message
operator<<friendInherited from IPacket
opaquevariableInherited from IPacket
infovariableInherited from IPacket
flagsvariableInherited from IPacket
IPacketfunctionInherited from IPacket
IPacketfunctionInherited from IPacket
operator=functionInherited from IPacket
clonefunctionInherited from IPacket
~IPacketfunctionInherited from IPacket
readfunctionInherited from IPacket
writefunctionInherited from IPacket
sizefunctionInherited from IPacket
hasDatafunctionInherited from IPacket
datafunctionInherited from IPacket
constDatafunctionInherited from IPacket
classNamefunctionInherited from IPacket
printfunctionInherited from IPacket

Inherited from Message

KindNameDescription
functionMessageConstructs a new message with a random ID and type set to "message".
functionMessageConstructs a message from a JSON value; sets missing id/type fields.
functionMessageCopy constructor; preserves or generates id/type fields.
functionoperator=Defaulted assignment operator.
function~Message virtual
functionclone virtual const overrideReturns a heap-allocated copy of this message.
functionvalid virtual constReturns true if the message has both type and id fields.
functionclear virtualClears all JSON fields from this message.
functionclearData virtualClears the data sub-object.
functionclearNotes virtualClears the notes array.
functiontype constReturns the message type string (defaults to "message").
functionid constReturns the message ID string.
functionto constReturns the recipient address parsed from the to field.
functionfrom constReturns the sender address parsed from the from field.
functiontoUser constReturns the user component of the to address without constructing an Address.
functiontoId constReturns the id component of the to address without constructing an Address.
functionfromUser constReturns the user component of the from address without constructing an Address.
functionfromId constReturns the id component of the from address without constructing an Address.
functionstatus constReturns the HTTP status code, or -1 if not set.
functionsetTypeSets the message type field.
functionsetToSets the to field from a peer's address.
functionsetToSets the to field from an address object.
functionsetToSets the to field from an address string.
functionsetFromSets the from field from a peer's address.
functionsetFromSets the from field from an address object.
functionsetFromSets the from field from an address string.
functionsetStatusHTTP status codes are used to describe the message response. Throws std::invalid_argument if code is outside [101, 504].
functionnotesReturns a reference to the notes JSON array.
functionsetNoteReplaces all notes with a single note.
functionaddNoteAppends a note to the notes array.
functiondata constReturns a copy of the named data field.
functiondataReturns a reference to the named data field (creates it if absent).
functionsetDataCreates or replaces a named data field; returns a reference to it.
functionsetDataSets a named data field to a C-string value.
functionsetDataSets a named data field to a string value.
functionsetDataSets a named data field to a JSON value.
functionsetDataSets a named data field to an integer value.
functionremoveDataRemoves a named field from the data sub-object.
functionhasDataReturns true if the named field exists in the data sub-object.
functionread virtual overrideDeserialises the message from a raw buffer.
functionread virtualDeserialises the message from a JSON string.
functionwrite virtual const overrideSerialises the message as JSON into a buffer.
functionisRequest constReturns true if no status code has been set (i.e. status() == -1).
functionsize virtual const overrideReturns the serialised JSON size in bytes.
functionprint virtual const overridePretty-prints the message JSON to the given stream.
functionclassName virtual const inline overrideReturns the class name of this packet type for logging and diagnostics.
functiondata virtual const inlineThe packet data pointer for buffered packets.
functionhasData virtual const inlineReturns true if the packet has a non-null data pointer.

Inherited from IPacket

KindNameDescription
friendoperator<< inlineStream insertion operator; delegates to print().
variableopaqueOptional type-safe context data. Use std::any_cast to retrieve. Lifetime of the stored value is tied to the packet's lifetime.
variableinfoOptional extra information about the packet.
variableflagsProvides basic information about the packet.
functionIPacket inline
functionIPacket inlineCopy constructor; clones the info object if present.
functionoperator= inlineCopy assignment; clones the info object if present.
functionclone virtual constReturns a heap-allocated deep copy of this packet.
function~IPacket virtualDefaulted destructor.
functionread virtualRead/parse to the packet from the given input buffer. The number of bytes read is returned.
functionwrite virtual constCopy/generate to the packet given output buffer. The number of bytes written can be obtained from the buffer.
functionsize virtual const inlineThe size of the packet in bytes.
functionhasData virtual const inlineReturns true if the packet has a non-null data pointer.
functiondata virtual const inlineThe packet data pointer for buffered packets.
functionconstData virtual const inlineThe const packet data pointer for buffered packets.
functionclassName virtual constReturns the class name of this packet type for logging and diagnostics.
functionprint virtual const inlinePrints a human-readable representation to the given stream.

Public Methods

ReturnNameDescription
PresenceConstructs a presence message with type set to "presence".
PresenceConstructs a presence message from a JSON value.
PresenceCopy constructor.
boolisProbeReturns true if this is a presence probe request. Recipients of a probe should send back their own presence.
voidsetProbeSets or clears the probe flag on this presence message.

Presence

Presence()

Defined in src/symple/include/icy/symple/presence.h:31

Constructs a presence message with type set to "presence".


Presence

Presence(const json::Value & root)

Defined in src/symple/include/icy/symple/presence.h:35

Constructs a presence message from a JSON value.

Parameters

  • root JSON object to initialise from.

Presence

Presence(const Presence & root)

Defined in src/symple/include/icy/symple/presence.h:39

Copy constructor.

Parameters

  • root Source presence message.

isProbe

bool isProbe()

Defined in src/symple/include/icy/symple/presence.h:45

Returns true if this is a presence probe request. Recipients of a probe should send back their own presence.


setProbe

void setProbe(bool flag)

Defined in src/symple/include/icy/symple/presence.h:49

Sets or clears the probe flag on this presence message.

Parameters

  • flag True to mark this as a probe.