QXmpp  Version: 1.5.1
QXmppPresence.h
1 // SPDX-FileCopyrightText: 2009 Manjeet Dahiya <manjeetdahiya@gmail.com>
2 // SPDX-FileCopyrightText: 2022 Melvin Keskin <melvo@olomono.de>
3 //
4 // SPDX-License-Identifier: LGPL-2.1-or-later
5 
6 #ifndef QXMPPPRESENCE_H
7 #define QXMPPPRESENCE_H
8 
9 #include "QXmppJingleIq.h"
10 #include "QXmppMucIq.h"
11 #include "QXmppStanza.h"
12 
13 class QXmppPresencePrivate;
14 
20 class QXMPP_EXPORT QXmppPresence : public QXmppStanza
21 {
22 public:
24  enum Type {
25  Error = 0,
32  Probe
33  };
34 
37  Online = 0,
38  Away,
39  XA,
40  DND,
41  Chat,
42  Invisible
43  };
44 
48  VCardUpdateNone = 0,
51  VCardUpdateNotReady
52 
55  };
56 
60  ~QXmppPresence() override;
61 
64 
65  bool isXmppStanza() const override;
66 
67  AvailableStatusType availableStatusType() const;
68  void setAvailableStatusType(AvailableStatusType type);
69 
70  int priority() const;
71  void setPriority(int priority);
72 
73  QXmppPresence::Type type() const;
74  void setType(QXmppPresence::Type);
75 
76  QString statusText() const;
77  void setStatusText(const QString &statusText);
78 
79  // XEP-0045: Multi-User Chat
80  QXmppMucItem mucItem() const;
81  void setMucItem(const QXmppMucItem &item);
82 
83  QString mucPassword() const;
84  void setMucPassword(const QString &password);
85 
86  QList<int> mucStatusCodes() const;
87  void setMucStatusCodes(const QList<int> &codes);
88 
89  bool isMucSupported() const;
90  void setMucSupported(bool supported);
91 
92  // XEP-0153: vCard-Based Avatars
93  QByteArray photoHash() const;
94  void setPhotoHash(const QByteArray &);
95 
96  VCardUpdateType vCardUpdateType() const;
97  void setVCardUpdateType(VCardUpdateType type);
98 
99  // XEP-0115: Entity Capabilities
100  QString capabilityHash() const;
101  void setCapabilityHash(const QString &);
102 
103  QString capabilityNode() const;
104  void setCapabilityNode(const QString &);
105 
106  QByteArray capabilityVer() const;
107  void setCapabilityVer(const QByteArray &);
108 
109  QStringList capabilityExt() const;
110 
111  // XEP-0272: Multiparty Jingle (Muji)
112  bool isPreparingMujiSession() const;
113  void setIsPreparingMujiSession(bool isPreparingMujiSession);
114 
115  QVector<QXmppJingleIq::Content> mujiContents() const;
116  void setMujiContents(const QVector<QXmppJingleIq::Content> &mujiContents);
117 
118  // XEP-0319: Last User Interaction in Presence
119  QDateTime lastUserInteraction() const;
120  void setLastUserInteraction(const QDateTime &);
121 
122  // XEP-0405: Mediated Information eXchange (MIX): Participant Server Requirements
123  QString mixUserJid() const;
124  void setMixUserJid(const QString &);
125 
126  QString mixUserNick() const;
127  void setMixUserNick(const QString &);
128 
130  void parse(const QDomElement &element) override;
131  void toXml(QXmlStreamWriter *writer) const override;
133 
134 private:
136  void parseExtension(const QDomElement &element, QXmppElementList &unknownElements);
138 
139  QSharedDataPointer<QXmppPresencePrivate> d;
140 };
141 
142 #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:21
QXmppPresence & operator=(const QXmppPresence &other)
Assignemnt operator.
Type
This enum is used to describe a presence type.
Definition: QXmppPresence.h:24
@ Unsubscribe
The sender is unsubscribing from another entity's presence.
Definition: QXmppPresence.h:30
@ Subscribe
The sender wishes to subscribe to the recipient's presence.
Definition: QXmppPresence.h:28
@ Subscribed
The sender has allowed the recipient to receive their presence.
Definition: QXmppPresence.h:29
@ Unavailable
Signals that the sender is no longer available for communication.
Definition: QXmppPresence.h:27
@ Unsubscribed
The subscription request has been denied or a previously-granted subscription has been cancelled.
Definition: QXmppPresence.h:31
@ Available
Signals that the sender is online and available for communication.
Definition: QXmppPresence.h:26
VCardUpdateType
Definition: QXmppPresence.h:47
@ VCardUpdateNoPhoto
User is not using any image.
Definition: QXmppPresence.h:49
@ VCardUpdateValidPhoto
User is advertising an image.
Definition: QXmppPresence.h:50
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:36
@ Chat
The entity or resource is actively interested in chatting.
Definition: QXmppPresence.h:41
@ DND
The entity or resource is busy ("Do Not Disturb").
Definition: QXmppPresence.h:40
@ Away
The entity or resource is temporarily away.
Definition: QXmppPresence.h:38
@ XA
The entity or resource is away for an extended period.
Definition: QXmppPresence.h:39
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