QXmpp Version: 1.10.0
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
21class QXMPP_EXPORT QXmppPresence : public QXmppStanza
22{
23public:
25 enum Type {
26 Error = 0,
33 Probe
34 };
35
38 Online = 0,
43 Invisible
44 };
45
49 VCardUpdateNone = 0,
52 VCardUpdateNotReady
53
56 };
57
61 ~QXmppPresence() override;
62
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 QStringList capabilityExt() const;
111
112 // XEP-0272: Multiparty Jingle (Muji)
113 bool isPreparingMujiSession() const;
114 void setIsPreparingMujiSession(bool isPreparingMujiSession);
115
116 QVector<QXmppJingleIq::Content> mujiContents() const;
117 void setMujiContents(const QVector<QXmppJingleIq::Content> &mujiContents);
118
119 // XEP-0283: Moved
120 QString oldJid() const;
121 void setOldJid(const QString &oldJid);
122
123 // XEP-0319: Last User Interaction in Presence
124 QDateTime lastUserInteraction() const;
125 void setLastUserInteraction(const QDateTime &);
126
127 // XEP-0405: Mediated Information eXchange (MIX): Participant Server Requirements
128 QString mixUserJid() const;
129 void setMixUserJid(const QString &);
130
131 QString mixUserNick() const;
132 void setMixUserNick(const QString &);
133
135 void parse(const QDomElement &element) override;
136 void toXml(QXmlStreamWriter *writer) const override;
138
139private:
141 void parseExtension(const QDomElement &element, QXmppElementList &unknownElements);
143
144 QSharedDataPointer<QXmppPresencePrivate> d;
145};
146
147#endif // QXMPPPRESENCE_H
The QXmppMucItem class represents a chat room "item".
Definition: QXmppMucIq.h:18
virtual void parse(const QDomElement &)=0
virtual bool isXmppStanza() const
Definition: QXmppNonza.h:19
virtual void toXml(QXmlStreamWriter *writer) const =0
The QXmppPresence class represents an XMPP presence stanza.
Definition: QXmppPresence.h:22
QXmppPresence & operator=(const QXmppPresence &other)
Assignemnt operator.
Type
This enum is used to describe a presence type.
Definition: QXmppPresence.h:25
@ Unsubscribe
The sender is unsubscribing from another entity's presence.
Definition: QXmppPresence.h:31
@ Subscribe
The sender wishes to subscribe to the recipient's presence.
Definition: QXmppPresence.h:29
@ Subscribed
The sender has allowed the recipient to receive their presence.
Definition: QXmppPresence.h:30
@ Unavailable
Signals that the sender is no longer available for communication.
Definition: QXmppPresence.h:28
@ Unsubscribed
The subscription request has been denied or a previously-granted subscription has been cancelled.
Definition: QXmppPresence.h:32
@ Available
Signals that the sender is online and available for communication.
Definition: QXmppPresence.h:27
VCardUpdateType
Definition: QXmppPresence.h:48
@ VCardUpdateNoPhoto
User is not using any image.
Definition: QXmppPresence.h:50
@ VCardUpdateValidPhoto
User is advertising an image.
Definition: QXmppPresence.h:51
QXmppPresence(const QXmppPresence &other)
Copy-constructor.
QXmppPresence(QXmppPresence &&)
Move-constructor.
QXmppPresence & operator=(QXmppPresence &&)
Move-assignemnt operator.
~QXmppPresence() override
Destroys a QXmppPresence.
AvailableStatusType
This enum is used to describe an availability status.
Definition: QXmppPresence.h:37
@ Chat
The entity or resource is actively interested in chatting.
Definition: QXmppPresence.h:42
@ DND
The entity or resource is busy ("Do Not Disturb").
Definition: QXmppPresence.h:41
@ Away
The entity or resource is temporarily away.
Definition: QXmppPresence.h:39
@ XA
The entity or resource is away for an extended period.
Definition: QXmppPresence.h:40
The Error class represents a stanza error.
Definition: QXmppStanza.h:94
The QXmppStanza class is the base class for all XMPP stanzas.
Definition: QXmppStanza.h:88