Presence
Presence
#include <icy/symple/presence.h>class PresenceDefined 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
| Name | Kind | Owner |
|---|---|---|
Presence | function | Declared here |
Presence | function | Declared here |
Presence | function | Declared here |
~Presence | function | Declared here |
isProbe | function | Declared here |
setProbe | function | Declared here |
Message | function | Inherited from Message |
Message | function | Inherited from Message |
Message | function | Inherited from Message |
operator= | function | Inherited from Message |
~Message | function | Inherited from Message |
clone | function | Inherited from Message |
valid | function | Inherited from Message |
clear | function | Inherited from Message |
clearData | function | Inherited from Message |
clearNotes | function | Inherited from Message |
type | function | Inherited from Message |
id | function | Inherited from Message |
to | function | Inherited from Message |
from | function | Inherited from Message |
toUser | function | Inherited from Message |
toId | function | Inherited from Message |
fromUser | function | Inherited from Message |
fromId | function | Inherited from Message |
status | function | Inherited from Message |
setType | function | Inherited from Message |
setTo | function | Inherited from Message |
setTo | function | Inherited from Message |
setTo | function | Inherited from Message |
setFrom | function | Inherited from Message |
setFrom | function | Inherited from Message |
setFrom | function | Inherited from Message |
setStatus | function | Inherited from Message |
notes | function | Inherited from Message |
setNote | function | Inherited from Message |
addNote | function | Inherited from Message |
data | function | Inherited from Message |
data | function | Inherited from Message |
setData | function | Inherited from Message |
setData | function | Inherited from Message |
setData | function | Inherited from Message |
setData | function | Inherited from Message |
setData | function | Inherited from Message |
removeData | function | Inherited from Message |
hasData | function | Inherited from Message |
read | function | Inherited from Message |
read | function | Inherited from Message |
write | function | Inherited from Message |
isRequest | function | Inherited from Message |
size | function | Inherited from Message |
print | function | Inherited from Message |
className | function | Inherited from Message |
data | function | Inherited from Message |
hasData | function | Inherited from Message |
operator<< | friend | Inherited from IPacket |
opaque | variable | Inherited from IPacket |
info | variable | Inherited from IPacket |
flags | variable | Inherited from IPacket |
IPacket | function | Inherited from IPacket |
IPacket | function | Inherited from IPacket |
operator= | function | Inherited from IPacket |
clone | function | Inherited from IPacket |
~IPacket | function | Inherited from IPacket |
read | function | Inherited from IPacket |
write | function | Inherited from IPacket |
size | function | Inherited from IPacket |
hasData | function | Inherited from IPacket |
data | function | Inherited from IPacket |
constData | function | Inherited from IPacket |
className | function | Inherited from IPacket |
print | function | Inherited from IPacket |
Inherited from Message
| Kind | Name | Description |
|---|---|---|
function | Message | Constructs a new message with a random ID and type set to "message". |
function | Message | Constructs a message from a JSON value; sets missing id/type fields. |
function | Message | Copy constructor; preserves or generates id/type fields. |
function | operator= | Defaulted assignment operator. |
function | ~Message virtual | |
function | clone virtual const override | Returns a heap-allocated copy of this message. |
function | valid virtual const | Returns true if the message has both type and id fields. |
function | clear virtual | Clears all JSON fields from this message. |
function | clearData virtual | Clears the data sub-object. |
function | clearNotes virtual | Clears the notes array. |
function | type const | Returns the message type string (defaults to "message"). |
function | id const | Returns the message ID string. |
function | to const | Returns the recipient address parsed from the to field. |
function | from const | Returns the sender address parsed from the from field. |
function | toUser const | Returns the user component of the to address without constructing an Address. |
function | toId const | Returns the id component of the to address without constructing an Address. |
function | fromUser const | Returns the user component of the from address without constructing an Address. |
function | fromId const | Returns the id component of the from address without constructing an Address. |
function | status const | Returns the HTTP status code, or -1 if not set. |
function | setType | Sets the message type field. |
function | setTo | Sets the to field from a peer's address. |
function | setTo | Sets the to field from an address object. |
function | setTo | Sets the to field from an address string. |
function | setFrom | Sets the from field from a peer's address. |
function | setFrom | Sets the from field from an address object. |
function | setFrom | Sets the from field from an address string. |
function | setStatus | HTTP status codes are used to describe the message response. Throws std::invalid_argument if code is outside [101, 504]. |
function | notes | Returns a reference to the notes JSON array. |
function | setNote | Replaces all notes with a single note. |
function | addNote | Appends a note to the notes array. |
function | data const | Returns a copy of the named data field. |
function | data | Returns a reference to the named data field (creates it if absent). |
function | setData | Creates or replaces a named data field; returns a reference to it. |
function | setData | Sets a named data field to a C-string value. |
function | setData | Sets a named data field to a string value. |
function | setData | Sets a named data field to a JSON value. |
function | setData | Sets a named data field to an integer value. |
function | removeData | Removes a named field from the data sub-object. |
function | hasData | Returns true if the named field exists in the data sub-object. |
function | read virtual override | Deserialises the message from a raw buffer. |
function | read virtual | Deserialises the message from a JSON string. |
function | write virtual const override | Serialises the message as JSON into a buffer. |
function | isRequest const | Returns true if no status code has been set (i.e. status() == -1). |
function | size virtual const override | Returns the serialised JSON size in bytes. |
function | print virtual const override | Pretty-prints the message JSON to the given stream. |
function | className virtual const inline override | Returns the class name of this packet type for logging and diagnostics. |
function | data virtual const inline | The packet data pointer for buffered packets. |
function | hasData virtual const inline | Returns true if the packet has a non-null data pointer. |
Inherited from IPacket
| Kind | Name | Description |
|---|---|---|
friend | operator<< inline | Stream insertion operator; delegates to print(). |
variable | opaque | Optional type-safe context data. Use std::any_cast to retrieve. Lifetime of the stored value is tied to the packet's lifetime. |
variable | info | Optional extra information about the packet. |
variable | flags | Provides basic information about the packet. |
function | IPacket inline | |
function | IPacket inline | Copy constructor; clones the info object if present. |
function | operator= inline | Copy assignment; clones the info object if present. |
function | clone virtual const | Returns a heap-allocated deep copy of this packet. |
function | ~IPacket virtual | Defaulted destructor. |
function | read virtual | Read/parse to the packet from the given input buffer. The number of bytes read is returned. |
function | write virtual const | Copy/generate to the packet given output buffer. The number of bytes written can be obtained from the buffer. |
function | size virtual const inline | The size of the packet in bytes. |
function | hasData virtual const inline | Returns true if the packet has a non-null data pointer. |
function | data virtual const inline | The packet data pointer for buffered packets. |
function | constData virtual const inline | The const packet data pointer for buffered packets. |
function | className virtual const | Returns the class name of this packet type for logging and diagnostics. |
function | print virtual const inline | Prints a human-readable representation to the given stream. |
Public Methods
| Return | Name | Description |
|---|---|---|
Presence | Constructs a presence message with type set to "presence". | |
Presence | Constructs a presence message from a JSON value. | |
Presence | Copy constructor. | |
bool | isProbe | Returns true if this is a presence probe request. Recipients of a probe should send back their own presence. |
void | setProbe | Sets 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
rootJSON object to initialise from.
Presence
Presence(const Presence & root)Defined in src/symple/include/icy/symple/presence.h:39
Copy constructor.
Parameters
rootSource 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
flagTrue to mark this as a probe.
