QXmpp: QXmppPresence.h Source File

QXmpp Version: 1.14.2

Loading...
Searching...
No Matches
QXmppPresence.h
1// SPDX-FileCopyrightText: 2009 Manjeet Dahiya <manjeetdahiya@gmail.com>
2// SPDX-FileCopyrightText: 2022 Melvin Keskin <melvo@olomono.de>
3// SPDX-FileCopyrightText: 2024 Filipe Azevedo <pasnox@gmail.com>
4//
5// SPDX-License-Identifier: LGPL-2.1-or-later
6
7#ifndef QXMPPPRESENCE_H
8#define QXMPPPRESENCE_H
9
10#include "QXmppJingleIq.h"
11#include "QXmppMucIq.h"
12#include "QXmppStanza.h"
13
14class QXmppPresencePrivate;
15
21 class QXMPP_EXPORT QXmppPresence : public QXmppStanza
22{
23public:
25 enum Type {
26 Error = 0,
27 Available,
28 Unavailable,
29 Subscribe,
30 Subscribed,
31 Unsubscribe,
32 Unsubscribed,
33 Probe
34 };
35
37 enum AvailableStatusType {
38 Online = 0,
39 Away,
40 XA,
41 DND,
42 Chat,
43 Invisible
44 };
45
48 enum VCardUpdateType {
49 VCardUpdateNone = 0,
50 VCardUpdateNoPhoto,
51 VCardUpdateValidPhoto,
52 VCardUpdateNotReady
53
56 };
57
58 QXmppPresence(QXmppPresence::Type type = QXmppPresence::Available);
59 QXmppPresence(const QXmppPresence &other);
60 QXmppPresence(QXmppPresence &&);
61 ~QXmppPresence() override;
62
63 QXmppPresence &operator=(const QXmppPresence &other);
64 QXmppPresence &operator=(QXmppPresence &&);
65
66 bool isXmppStanza() const override;
67
68 AvailableStatusType availableStatusType() const;
69 void setAvailableStatusType(AvailableStatusType type);
70
71 int priority() const;
72 void setPriority(int priority);
73
74 QXmppPresence::Type type() const;
75 void setType(QXmppPresence::Type);
76
77 QString statusText() const;
78 void setStatusText(const QString &statusText);
79
80 // XEP-0045: Multi-User Chat
81 QXmppMucItem mucItem() const;
82 void setMucItem(const QXmppMucItem &item);
83
84 QString mucPassword() const;
85 void setMucPassword(const QString &password);
86
87 QList<int> mucStatusCodes() const;
88 void setMucStatusCodes(const QList<int> &codes);
89
90 bool isMucSupported() const;
91 void setMucSupported(bool supported);
92
93 // XEP-0153: vCard-Based Avatars
94 QByteArray photoHash() const;
95 void setPhotoHash(const QByteArray &);
96
97 VCardUpdateType vCardUpdateType() const;
98 void setVCardUpdateType(VCardUpdateType type);
99
100 // XEP-0115: Entity Capabilities
101 QString capabilityHash() const;
102 void setCapabilityHash(const QString &);
103
104 QString capabilityNode() const;
105 void setCapabilityNode(const QString &);
106
107 QByteArray capabilityVer() const;
108 void setCapabilityVer(const QByteArray &);
109
110 // XEP-0272: Multiparty Jingle (Muji)
111 bool isPreparingMujiSession() const;
112 void setIsPreparingMujiSession(bool isPreparingMujiSession);
113
114 QVector<QXmppJingleIq::Content> mujiContents() const;
115 void setMujiContents(const QVector<QXmppJingleIq::Content> &mujiContents);
116
117 // XEP-0283: Moved
118 QString oldJid() const;
119 void setOldJid(const QString &oldJid);
120
121 // XEP-0319: Last User Interaction in Presence
122 QDateTime lastUserInteraction() const;
123 void setLastUserInteraction(const QDateTime &);
124
125 // XEP-0405: Mediated Information eXchange (MIX): Participant Server Requirements
126 QString mixUserJid() const;
127 void setMixUserJid(const QString &);
128
129 QString mixUserNick() const;
130 void setMixUserNick(const QString &);
131
132 // XEP-0421: Occupant identifiers for semi-anonymous MUCs
133 QString mucOccupantId() const;
134 void setMucOccupantId(const QString &);
135
137 void parse(const QDomElement &element) override;
138 void toXml(QXmlStreamWriter *writer) const override;
139
140#if QXMPP_DEPRECATED_SINCE(1, 12)
141 [[deprecated("Legacy entity capabilities (used 2003-2007)")]]
142 QStringList capabilityExt() const;
143#endif
145
146private:
148 void parseExtension(const QDomElement &element, QXmppElementList &unknownElements);
150
151 QSharedDataPointer<QXmppPresencePrivate> d;
152};
153
154#endif // QXMPPPRESENCE_H
QXmppMucItem
The QXmppMucItem class represents a chat room "item".
Definition QXmppMucIq.h:19
QXmppNonza::parse
virtual void parse(const QDomElement &)=0
QXmppNonza::toXml
virtual void toXml(QXmlStreamWriter *writer) const =0
QXmppNonza::isXmppStanza
virtual bool isXmppStanza() const
Definition QXmppNonza.h:19
QXmppPresence
The QXmppPresence class represents an XMPP presence stanza.
Definition QXmppPresence.h:22
QXmppPresence::setType
void setType(QXmppPresence::Type)
Sets the presence type.
Definition QXmppPresence.cpp:199
QXmppPresence::setMixUserNick
void setMixUserNick(const QString &)
Definition QXmppPresence.cpp:441
QXmppPresence::setCapabilityNode
void setCapabilityNode(const QString &)
XEP-0115: Entity Capabilities
Definition QXmppPresence.cpp:251
QXmppPresence::setVCardUpdateType
void setVCardUpdateType(VCardUpdateType type)
Sets the type of VCardUpdate.
Definition QXmppPresence.cpp:227
QXmppPresence::mucItem
QXmppMucItem mucItem() const
Returns the MUC item.
Definition QXmppPresence.cpp:317
QXmppPresence::priority
int priority() const
Returns the priority level of the resource.
Definition QXmppPresence.cpp:158
QXmppPresence::operator=
QXmppPresence & operator=(const QXmppPresence &other)
Assignemnt operator.
QXmppPresence::isPreparingMujiSession
bool isPreparingMujiSession() const
Definition QXmppPresence.cpp:275
QXmppPresence::setMucStatusCodes
void setMucStatusCodes(const QList< int > &codes)
Sets the MUC status codes.
Definition QXmppPresence.cpp:347
QXmppPresence::setMucSupported
void setMucSupported(bool supported)
Sets whether MUC is supported.
Definition QXmppPresence.cpp:359
QXmppPresence::setMucItem
void setMucItem(const QXmppMucItem &item)
Sets the MUC item.
Definition QXmppPresence.cpp:323
QXmppPresence::availableStatusType
AvailableStatusType availableStatusType() const
Definition QXmppPresence.cpp:146
QXmppPresence::setStatusText
void setStatusText(const QString &statusText)
Definition QXmppPresence.cpp:180
QXmppPresence::type
QXmppPresence::Type type() const
Definition QXmppPresence.cpp:193
QXmppPresence::Type
Type
This enum is used to describe a presence type.
Definition QXmppPresence.h:25
QXmppPresence::Unsubscribe
@ Unsubscribe
The sender is unsubscribing from another entity's presence.
Definition QXmppPresence.h:31
QXmppPresence::Subscribe
@ Subscribe
The sender wishes to subscribe to the recipient's presence.
Definition QXmppPresence.h:29
QXmppPresence::Subscribed
@ Subscribed
The sender has allowed the recipient to receive their presence.
Definition QXmppPresence.h:30
QXmppPresence::Unavailable
@ Unavailable
Signals that the sender is no longer available for communication.
Definition QXmppPresence.h:28
QXmppPresence::Unsubscribed
@ Unsubscribed
The subscription request has been denied or a previously-granted subscription has been cancelled.
Definition QXmppPresence.h:32
QXmppPresence::Probe
@ Probe
A request for an entity's current presence; SHOULD be generated only by a server on behalf of a user.
Definition QXmppPresence.h:33
QXmppPresence::Available
@ Available
Signals that the sender is online and available for communication.
Definition QXmppPresence.h:27
QXmppPresence::Error
@ Error
An error has occurred regarding processing or delivery of a previously-sent presence stanza.
Definition QXmppPresence.h:26
QXmppPresence::capabilityVer
QByteArray capabilityVer() const
XEP-0115: Entity Capabilities
Definition QXmppPresence.cpp:257
QXmppPresence::setCapabilityHash
void setCapabilityHash(const QString &)
XEP-0115: Entity Capabilities
Definition QXmppPresence.cpp:239
QXmppPresence::photoHash
QByteArray photoHash() const
Returns the photo-hash of the VCardUpdate.
Definition QXmppPresence.cpp:205
QXmppPresence::setMixUserJid
void setMixUserJid(const QString &)
Definition QXmppPresence.cpp:421
QXmppPresence::VCardUpdateType
VCardUpdateType
Definition QXmppPresence.h:48
QXmppPresence::VCardUpdateNoPhoto
@ VCardUpdateNoPhoto
User is not using any image.
Definition QXmppPresence.h:50
QXmppPresence::VCardUpdateNotReady
@ VCardUpdateNotReady
User is not ready to advertise an image.
Definition QXmppPresence.h:52
QXmppPresence::VCardUpdateValidPhoto
@ VCardUpdateValidPhoto
User is advertising an image.
Definition QXmppPresence.h:51
QXmppPresence::VCardUpdateNone
@ VCardUpdateNone
Protocol is not supported.
Definition QXmppPresence.h:49
QXmppPresence::setOldJid
void setOldJid(const QString &oldJid)
Definition QXmppPresence.cpp:379
QXmppPresence::setLastUserInteraction
void setLastUserInteraction(const QDateTime &)
Definition QXmppPresence.cpp:401
QXmppPresence::mucStatusCodes
QList< int > mucStatusCodes() const
Returns the MUC status codes.
Definition QXmppPresence.cpp:341
QXmppPresence::QXmppPresence
QXmppPresence(const QXmppPresence &other)
Copy-constructor.
QXmppPresence::setMucPassword
void setMucPassword(const QString &password)
Sets the password used to join a MUC room.
Definition QXmppPresence.cpp:335
QXmppPresence::setMujiContents
void setMujiContents(const QVector< QXmppJingleIq::Content > &mujiContents)
Definition QXmppPresence.cpp:311
QXmppPresence::QXmppPresence
QXmppPresence(QXmppPresence &&)
Move-constructor.
QXmppPresence::setIsPreparingMujiSession
void setIsPreparingMujiSession(bool isPreparingMujiSession)
Definition QXmppPresence.cpp:287
QXmppPresence::operator=
QXmppPresence & operator=(QXmppPresence &&)
Move-assignemnt operator.
QXmppPresence::setAvailableStatusType
void setAvailableStatusType(AvailableStatusType type)
Sets the availability status type, for instance busy or away.
Definition QXmppPresence.cpp:152
QXmppPresence::lastUserInteraction
QDateTime lastUserInteraction() const
Definition QXmppPresence.cpp:390
QXmppPresence::capabilityHash
QString capabilityHash() const
XEP-0115: Entity Capabilities
Definition QXmppPresence.cpp:233
QXmppPresence::QXmppPresence
QXmppPresence(QXmppPresence::Type type=QXmppPresence::Available)
Definition QXmppPresence.cpp:112
QXmppPresence::setCapabilityVer
void setCapabilityVer(const QByteArray &)
XEP-0115: Entity Capabilities
Definition QXmppPresence.cpp:263
QXmppPresence::~QXmppPresence
~QXmppPresence() override
Destroys a QXmppPresence.
QXmppPresence::setMucOccupantId
void setMucOccupantId(const QString &)
Definition QXmppPresence.cpp:463
QXmppPresence::mixUserJid
QString mixUserJid() const
Definition QXmppPresence.cpp:411
QXmppPresence::setPhotoHash
void setPhotoHash(const QByteArray &)
Definition QXmppPresence.cpp:215
QXmppPresence::capabilityNode
QString capabilityNode() const
XEP-0115: Entity Capabilities
Definition QXmppPresence.cpp:245
QXmppPresence::AvailableStatusType
AvailableStatusType
This enum is used to describe an availability status.
Definition QXmppPresence.h:37
QXmppPresence::Invisible
@ Invisible
obsolete XEP-0018: Invisible Presence
Definition QXmppPresence.h:43
QXmppPresence::Online
@ Online
The entity or resource is online.
Definition QXmppPresence.h:38
QXmppPresence::Chat
@ Chat
The entity or resource is actively interested in chatting.
Definition QXmppPresence.h:42
QXmppPresence::DND
@ DND
The entity or resource is busy ("Do Not Disturb").
Definition QXmppPresence.h:41
QXmppPresence::Away
@ Away
The entity or resource is temporarily away.
Definition QXmppPresence.h:39
QXmppPresence::XA
@ XA
The entity or resource is away for an extended period.
Definition QXmppPresence.h:40
QXmppPresence::mucOccupantId
QString mucOccupantId() const
Definition QXmppPresence.cpp:452
QXmppPresence::mujiContents
QVector< QXmppJingleIq::Content > mujiContents() const
Definition QXmppPresence.cpp:299
QXmppPresence::setPriority
void setPriority(int priority)
Sets the priority level of the resource.
Definition QXmppPresence.cpp:164
QXmppPresence::vCardUpdateType
VCardUpdateType vCardUpdateType() const
Returns the type of VCardUpdate.
Definition QXmppPresence.cpp:221
QXmppPresence::mixUserNick
QString mixUserNick() const
Definition QXmppPresence.cpp:431
QXmppPresence::mucPassword
QString mucPassword() const
Returns the password used to join a MUC room.
Definition QXmppPresence.cpp:329
QXmppPresence::oldJid
QString oldJid() const
Definition QXmppPresence.cpp:369
QXmppPresence::statusText
QString statusText() const
Returns the status text, a textual description of the user's status.
Definition QXmppPresence.cpp:170
QXmppPresence::isMucSupported
bool isMucSupported() const
Returns true if the sender has indicated MUC support.
Definition QXmppPresence.cpp:353
QXmppStanza::QXmppStanza
QXmppStanza(const QString &from=QString(), const QString &to=QString())
Definition QXmppStanza.cpp:693