QXmppPresence Class

The QXmppPresence class represents an XMPP presence stanza. More...

Header: #include <QXmppPresence.h>
Inherits: QXmppStanza

Public Types

enum AvailableStatusType { Online, Away, XA, DND, Chat, Invisible }
enum Type { Error, Available, Unavailable, Subscribe, Subscribed, …, Probe }
enum VCardUpdateType { VCardUpdateNone, VCardUpdateNoPhoto, VCardUpdateValidPhoto, VCardUpdateNotReady }

Public Functions

QXmppPresence(QXmppPresence::Type type = QXmppPresence::Available)
QXmppPresence(const QXmppPresence &other)
QXmppPresence(QXmppPresence &&)
virtual ~QXmppPresence() override
QXmppPresence::AvailableStatusType availableStatusType() const
QString capabilityHash() const
QString capabilityNode() const
QByteArray capabilityVer() const
(since QXmpp 1.16) QXmpp::Xml::Extensions &extensions()
const QXmpp::Xml::Extensions &extensions() const
bool isMucSupported() const
(since QXmpp 1.5) bool isPreparingMujiSession() const
(since QXmpp 1.0) QDateTime lastUserInteraction() const
(since QXmpp 1.1) QString mixUserJid() const
(since QXmpp 1.1) QString mixUserNick() const
std::optional<QXmpp::Muc::Destroy> mucDestroy() const
std::optional<QXmpp::Muc::HistoryOptions> mucHistory() const
(since QXmpp 1.13) QString mucOccupantId() const
(since QXmpp 1.16) QXmpp::Muc::Item mucParticipantItem() const
QString mucPassword() const
QList<int> mucStatusCodes() const
(since QXmpp 1.5) QList<QXmppJingleIq::Content> mujiContents() const
(since QXmpp 1.9) QString oldJid() const
QByteArray photoHash() const
int priority() const
void setAvailableStatusType(QXmppPresence::AvailableStatusType type)
void setCapabilityHash(const QString &hash)
void setCapabilityNode(const QString &node)
void setCapabilityVer(const QByteArray &ver)
(since QXmpp 1.5) void setIsPreparingMujiSession(bool isPreparingMujiSession)
(since QXmpp 1.0) void setLastUserInteraction(const QDateTime &lastUserInteraction)
(since QXmpp 1.1) void setMixUserJid(const QString &mixUserJid)
(since QXmpp 1.1) void setMixUserNick(const QString &mixUserNick)
void setMucDestroy(std::optional<QXmpp::Muc::Destroy> destroy)
void setMucHistory(std::optional<QXmpp::Muc::HistoryOptions> history)
(since QXmpp 1.13) void setMucOccupantId(const QString &id)
(since QXmpp 1.16) void setMucParticipantItem(const QXmpp::Muc::Item &newItem)
void setMucPassword(const QString &password)
void setMucStatusCodes(const QList<int> &codes)
void setMucSupported(bool supported)
(since QXmpp 1.5) void setMujiContents(const QList<QXmppJingleIq::Content> &mujiContents)
(since QXmpp 1.9) void setOldJid(const QString &oldJid)
void setPhotoHash(const QByteArray &photoHash)
void setPriority(int priority)
void setStatusText(const QString &statusText)
void setType(QXmppPresence::Type type)
void setVCardUpdateType(QXmppPresence::VCardUpdateType type)
QString statusText() const
QXmppPresence::Type type() const
QXmppPresence::VCardUpdateType vCardUpdateType() const
QXmppPresence &operator=(QXmppPresence &&)
QXmppPresence &operator=(const QXmppPresence &other)

Reimplemented Public Functions

(since QXmpp 1.0) virtual bool isXmppStanza() const override

Detailed Description

Member Type Documentation

enum QXmppPresence::AvailableStatusType

This enum is used to describe an availability status.

ConstantValueDescription
QXmppPresence::Online0The entity or resource is online.
QXmppPresence::Away1The entity or resource is temporarily away.
QXmppPresence::XA2The entity or resource is away for an extended period.
QXmppPresence::DND3The entity or resource is busy ("Do Not Disturb").
QXmppPresence::Chat4The entity or resource is actively interested in chatting.
QXmppPresence::Invisible5obsolete XEP-0018: Invisible Presence.

enum QXmppPresence::Type

This enum is used to describe a presence type.

ConstantValueDescription
QXmppPresence::Error0An error has occurred regarding processing or delivery of a previously-sent presence stanza.
QXmppPresence::Available1Signals that the sender is online and available for communication.
QXmppPresence::Unavailable2Signals that the sender is no longer available for communication.
QXmppPresence::Subscribe3The sender wishes to subscribe to the recipient's presence.
QXmppPresence::Subscribed4The sender has allowed the recipient to receive their presence.
QXmppPresence::Unsubscribe5The sender is unsubscribing from another entity's presence.
QXmppPresence::Unsubscribed6The subscription request has been denied or a previously-granted subscription has been cancelled.
QXmppPresence::Probe7A request for an entity's current presence; SHOULD be generated only by a server on behalf of a user.

enum QXmppPresence::VCardUpdateType

This enum is used to describe vCard updates as defined by XEP-0153: vCard-Based Avatars

ConstantValueDescription
QXmppPresence::VCardUpdateNone0Protocol is not supported.
QXmppPresence::VCardUpdateNoPhoto1User is not using any image.
QXmppPresence::VCardUpdateValidPhoto2User is advertising an image.
QXmppPresence::VCardUpdateNotReady3User is not ready to advertise an image.

Member Function Documentation

QXmppPresence::QXmppPresence(QXmppPresence::Type type = QXmppPresence::Available)

Constructs a QXmppPresence.

QXmppPresence::QXmppPresence(const QXmppPresence &other)

Copy-constructor.

QXmppPresence::QXmppPresence(QXmppPresence &&)

Move-constructor.

[override virtual noexcept] QXmppPresence::~QXmppPresence()

Destroys a QXmppPresence.

QXmppPresence::AvailableStatusType QXmppPresence::availableStatusType() const

Returns the availability status type, for instance busy or away.

This will not tell you whether a contact is connected, check whether type() is QXmppPresence::Available instead.

See also setAvailableStatusType().

QString QXmppPresence::capabilityHash() const

XEP-0115: Entity Capabilities

See also setCapabilityHash().

QString QXmppPresence::capabilityNode() const

XEP-0115: Entity Capabilities

See also setCapabilityNode().

QByteArray QXmppPresence::capabilityVer() const

XEP-0115: Entity Capabilities

See also setCapabilityVer().

[since QXmpp 1.16] QXmpp::Xml::Extensions &QXmppPresence::extensions()

Returns the typed extension container for this presence.

Extensions parsed via QXmpp::Xml::Registry and unknown elements stored as QXmpp::Xml::Element are accessible here. This method hides QXmppStanza::extensions(); application code should migrate to this API.

This function was introduced in QXmpp 1.16.

const QXmpp::Xml::Extensions &QXmppPresence::extensions() const

This is an overloaded function.

bool QXmppPresence::isMucSupported() const

Returns true if the sender has indicated MUC support.

[since QXmpp 1.5] bool QXmppPresence::isPreparingMujiSession() const

Returns whether a XEP-0272: Multiparty Jingle (Muji) session is being prepared.

This function was introduced in QXmpp 1.5.

See also setIsPreparingMujiSession().

[override virtual, since QXmpp 1.0] bool QXmppPresence::isXmppStanza() const

Reimplements: QXmppNonza::isXmppStanza() const.

Returns whether the QXmppStanza is a stanza in the XMPP sence (i. e. a message, iq or presence)

This function was introduced in QXmpp 1.0.

[since QXmpp 1.0] QDateTime QXmppPresence::lastUserInteraction() const

Returns when the last user interaction with the client took place. See XEP-0319: Last User Interaction in Presence for details.

This function was introduced in QXmpp 1.0.

See also setLastUserInteraction().

[since QXmpp 1.1] QString QXmppPresence::mixUserJid() const

Returns the actual (full) JID of the MIX channel participant.

This function was introduced in QXmpp 1.1.

See also setMixUserJid().

[since QXmpp 1.1] QString QXmppPresence::mixUserNick() const

Returns the MIX participant's nickname.

This function was introduced in QXmpp 1.1.

See also setMixUserNick().

std::optional<QXmpp::Muc::Destroy> QXmppPresence::mucDestroy() const

Returns the MUC room destruction info, or std::nullopt if none.

See also setMucDestroy().

std::optional<QXmpp::Muc::HistoryOptions> QXmppPresence::mucHistory() const

Returns the MUC history options for joining, or std::nullopt if not set.

See also setMucHistory().

[since QXmpp 1.13] QString QXmppPresence::mucOccupantId() const

Returns the MUC Occupant ID as defined in XEP-0421: Occupant identifiers for semi-anonymous MUCs.

This function was introduced in QXmpp 1.13.

See also setMucOccupantId().

[since QXmpp 1.16] QXmpp::Muc::Item QXmppPresence::mucParticipantItem() const

Returns the MUC participant item containing role and affiliation data.

This is the modern replacement for mucItem(). It is populated from the <item/> element inside the muc#user <x/> block of incoming MUC presences.

This function was introduced in QXmpp 1.16.

See also setMucParticipantItem().

QString QXmppPresence::mucPassword() const

Returns the password used to join a MUC room.

See also setMucPassword().

QList<int> QXmppPresence::mucStatusCodes() const

Returns the MUC status codes.

See also setMucStatusCodes().

[since QXmpp 1.5] QList<QXmppJingleIq::Content> QXmppPresence::mujiContents() const

Returns the XEP-0272: Multiparty Jingle (Muji) contents.

This function was introduced in QXmpp 1.5.

See also setMujiContents().

[since QXmpp 1.9] QString QXmppPresence::oldJid() const

Returns the XEP-0283: Moved user's old jid.

This function was introduced in QXmpp 1.9.

See also setOldJid().

QByteArray QXmppPresence::photoHash() const

Returns the photo-hash of the VCardUpdate.

See also setPhotoHash().

int QXmppPresence::priority() const

Returns the priority level of the resource.

See also setPriority().

void QXmppPresence::setAvailableStatusType(QXmppPresence::AvailableStatusType type)

Sets the availability status type, for instance busy or away.

See also availableStatusType().

void QXmppPresence::setCapabilityHash(const QString &hash)

XEP-0115: Entity Capabilities

hash.

See also capabilityHash().

void QXmppPresence::setCapabilityNode(const QString &node)

XEP-0115: Entity Capabilities

node.

See also capabilityNode().

void QXmppPresence::setCapabilityVer(const QByteArray &ver)

XEP-0115: Entity Capabilities

ver.

See also capabilityVer().

[since QXmpp 1.5] void QXmppPresence::setIsPreparingMujiSession(bool isPreparingMujiSession)

Sets whether a XEP-0272: Multiparty Jingle (Muji) session is being prepared via isPreparingMujiSession.

This function was introduced in QXmpp 1.5.

See also isPreparingMujiSession().

[since QXmpp 1.0] void QXmppPresence::setLastUserInteraction(const QDateTime &lastUserInteraction)

Sets the time of the last user interaction as defined in XEP-0319: Last User Interaction in Presence.

lastUserInteraction.

This function was introduced in QXmpp 1.0.

See also lastUserInteraction().

[since QXmpp 1.1] void QXmppPresence::setMixUserJid(const QString &mixUserJid)

Sets the actual (full) JID of the MIX channel participant.

mixUserJid.

This function was introduced in QXmpp 1.1.

See also mixUserJid().

[since QXmpp 1.1] void QXmppPresence::setMixUserNick(const QString &mixUserNick)

Sets the MIX participant's nickname.

mixUserNick.

This function was introduced in QXmpp 1.1.

See also mixUserNick().

void QXmppPresence::setMucDestroy(std::optional<QXmpp::Muc::Destroy> destroy)

Sets the MUC room destroy info. Pass std::nullopt to clear.

See also mucDestroy().

void QXmppPresence::setMucHistory(std::optional<QXmpp::Muc::HistoryOptions> history)

Sets the MUC history options for joining. Pass std::nullopt to clear.

See also mucHistory().

[since QXmpp 1.13] void QXmppPresence::setMucOccupantId(const QString &id)

Sets the MUC Occupant ID as defined in XEP-0421: Occupant identifiers for semi-anonymous MUCs.

id.

This function was introduced in QXmpp 1.13.

See also mucOccupantId().

[since QXmpp 1.16] void QXmppPresence::setMucParticipantItem(const QXmpp::Muc::Item &newItem)

Sets the MUC participant newItem.

This function was introduced in QXmpp 1.16.

See also mucParticipantItem().

void QXmppPresence::setMucPassword(const QString &password)

Sets the password used to join a MUC room.

See also mucPassword().

void QXmppPresence::setMucStatusCodes(const QList<int> &codes)

Sets the MUC status codes.

See also mucStatusCodes().

void QXmppPresence::setMucSupported(bool supported)

Sets whether MUC is supported.

See also isMucSupported().

[since QXmpp 1.5] void QXmppPresence::setMujiContents(const QList<QXmppJingleIq::Content> &mujiContents)

Sets the XEP-0272: Multiparty Jingle (Muji) mujiContents.

This function was introduced in QXmpp 1.5.

See also mujiContents().

[since QXmpp 1.9] void QXmppPresence::setOldJid(const QString &oldJid)

Sets the XEP-0283: Moved user's old jid.

oldJid.

This function was introduced in QXmpp 1.9.

See also oldJid().

void QXmppPresence::setPhotoHash(const QByteArray &photoHash)

Sets the photoHash of the VCardUpdate.

See also photoHash().

void QXmppPresence::setPriority(int priority)

Sets the priority level of the resource.

See also priority().

void QXmppPresence::setStatusText(const QString &statusText)

Sets the statusText, a textual description of the user's status, for example "Gone fishing".

See also statusText().

void QXmppPresence::setType(QXmppPresence::Type type)

Sets the presence type.

See also type().

void QXmppPresence::setVCardUpdateType(QXmppPresence::VCardUpdateType type)

Sets the type of VCardUpdate

See also vCardUpdateType().

QString QXmppPresence::statusText() const

Returns the status text, a textual description of the user's status.

See also setStatusText().

QXmppPresence::Type QXmppPresence::type() const

Returns the presence type.

You can use this method to determine the action which needs to be taken in response to receiving the presence. For instance, if the type is QXmppPresence::Available or QXmppPresence::Unavailable, you could update the icon representing a contact's availability.

See also setType().

QXmppPresence::VCardUpdateType QXmppPresence::vCardUpdateType() const

Returns the type of VCardUpdate

See also setVCardUpdateType().

QXmppPresence &QXmppPresence::operator=(QXmppPresence &&)

Move-assignemnt operator.

QXmppPresence &QXmppPresence::operator=(const QXmppPresence &other)

Assignemnt operator.