QXmpp  Version:1.0.0
Public Types | Public Member Functions | List of all members
QXmppPresence Class Reference

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

#include <QXmppPresence.h>

Inheritance diagram for QXmppPresence:
Inheritance graph
Collaboration diagram for QXmppPresence:
Collaboration graph

Public Types

enum  Type {
  Error = 0, Available, Unavailable, Subscribe,
  Subscribed, Unsubscribe, Unsubscribed, Probe
 This enum is used to describe a presence type. More...
enum  AvailableStatusType {
  Online = 0, Away, XA, DND,
  Chat, Invisible
 This enum is used to describe an availability status. More...
enum  VCardUpdateType { VCardUpdateNone = 0, VCardUpdateNoPhoto, VCardUpdateValidPhoto, VCardUpdateNotReady }

Public Member Functions

 QXmppPresence (QXmppPresence::Type type=QXmppPresence::Available)
 QXmppPresence (const QXmppPresence &other)
 Constructs a copy of other.
 ~QXmppPresence ()
 Destroys a QXmppPresence.
QXmppPresenceoperator= (const QXmppPresence &other)
 Assigns other to this presence.
AvailableStatusType availableStatusType () const
void setAvailableStatusType (AvailableStatusType type)
 Sets the availability status type, for instance busy or away.
int priority () const
 Returns the priority level of the resource.
void setPriority (int priority)
 Sets the priority level of the resource.
QXmppPresence::Type type () const
void setType (QXmppPresence::Type)
QString statusText () const
 Returns the status text, a textual description of the user's status.
void setStatusText (const QString &statusText)
QXmppMucItem mucItem () const
 Returns the MUC item.
void setMucItem (const QXmppMucItem &item)
QString mucPassword () const
 Returns the password used to join a MUC room.
void setMucPassword (const QString &password)
 Sets the password used to join a MUC room.
QList< int > mucStatusCodes () const
 Returns the MUC status codes.
void setMucStatusCodes (const QList< int > &codes)
bool isMucSupported () const
 Returns true if the sender has indicated MUC support.
void setMucSupported (bool supported)
 Sets whether MUC is supported.
QByteArray photoHash () const
 XEP-0153: vCard-Based Avatars. More...
void setPhotoHash (const QByteArray &)
VCardUpdateType vCardUpdateType () const
void setVCardUpdateType (VCardUpdateType type)
QString capabilityHash () const
 XEP-0115: Entity Capabilities.
void setCapabilityHash (const QString &)
 XEP-0115: Entity Capabilities.
QString capabilityNode () const
 XEP-0115: Entity Capabilities.
void setCapabilityNode (const QString &)
 XEP-0115: Entity Capabilities.
QByteArray capabilityVer () const
 XEP-0115: Entity Capabilities.
void setCapabilityVer (const QByteArray &)
 XEP-0115: Entity Capabilities.
QStringList capabilityExt () const
 Legacy XEP-0115: Entity Capabilities.
QDateTime lastUserInteraction () const
void setLastUserInteraction (const QDateTime &)
bool isXmppStanza () const
- Public Member Functions inherited from QXmppStanza
 QXmppStanza (const QString &from=QString(), const QString &to=QString())
 QXmppStanza (const QXmppStanza &other)
 Constructs a copy of other.
virtual ~QXmppStanza ()
 Destroys a QXmppStanza.
QXmppStanzaoperator= (const QXmppStanza &other)
 Assigns other to this stanza.
QString to () const
void setTo (const QString &)
QString from () const
 Returns the stanza's sender JID.
void setFrom (const QString &)
QString id () const
 Returns the stanza's identifier.
void setId (const QString &)
QString lang () const
 Returns the stanza's language.
void setLang (const QString &)
QXmppStanza::Error error () const
 Returns the stanza's error.
void setError (const QXmppStanza::Error &error)
QXmppElementList extensions () const
void setExtensions (const QXmppElementList &elements)
QList< QXmppExtendedAddressextendedAddresses () const
void setExtendedAddresses (const QList< QXmppExtendedAddress > &extendedAddresses)

Detailed Description

The QXmppPresence class represents an XMPP presence stanza.

Member Enumeration Documentation

◆ AvailableStatusType

This enum is used to describe an availability status.


The entity or resource is online.


The entity or resource is temporarily away.


The entity or resource is away for an extended period.


The entity or resource is busy ("Do Not Disturb").


The entity or resource is actively interested in chatting.


obsolete XEP-0018: Invisible Presence

◆ Type

This enum is used to describe a presence type.


An error has occurred regarding processing or delivery of a previously-sent presence stanza.


Signals that the sender is online and available for communication.


Signals that the sender is no longer available for communication.


The sender wishes to subscribe to the recipient's presence.


The sender has allowed the recipient to receive their presence.


The sender is unsubscribing from another entity's presence.


The subscription request has been denied or a previously-granted subscription has been cancelled.


A request for an entity's current presence; SHOULD be generated only by a server on behalf of a user.

◆ VCardUpdateType

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


Protocol is not supported.


User is not using any image.


User is advertising an image.


User is not ready to advertise an image.

This enables recipients to distinguish between the absence of an image (empty photo element) and mere support for the protocol (empty update child).

Constructor & Destructor Documentation

◆ QXmppPresence()

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

Constructs a QXmppPresence.


Member Function Documentation

◆ availableStatusType()

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.

◆ isXmppStanza()

bool QXmppPresence::isXmppStanza ( ) const

Indicates if the QXmppStanza is a stanza in the XMPP sense (i. e. a message, iq or presence)

Reimplemented from QXmppStanza.

◆ lastUserInteraction()

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.

◆ photoHash()

QByteArray QXmppPresence::photoHash ( ) const

XEP-0153: vCard-Based Avatars.


Returns the photo-hash of the VCardUpdate.


◆ setLastUserInteraction()

void QXmppPresence::setLastUserInteraction ( const QDateTime &  lastUserInteraction)

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

◆ setMucItem()

void QXmppPresence::setMucItem ( const QXmppMucItem item)

Sets the MUC item.


◆ setMucStatusCodes()

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

Sets the MUC status codes.


◆ setPhotoHash()

void QXmppPresence::setPhotoHash ( const QByteArray &  photoHash)

Sets the photo-hash of the VCardUpdate.

photoHashas QByteArray

◆ setStatusText()

void QXmppPresence::setStatusText ( const QString &  statusText)

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

statusTextThe status text, for example "Gone fishing".

◆ setType()

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

Sets the presence type.


◆ setVCardUpdateType()

void QXmppPresence::setVCardUpdateType ( VCardUpdateType  type)

Sets the type of VCardUpdate


◆ type()

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.

◆ vCardUpdateType()

QXmppPresence::VCardUpdateType QXmppPresence::vCardUpdateType ( ) const

Returns the type of VCardUpdate


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