QXmpp Version: 1.4.0
QXmppPresence.h
1/*
2 * Copyright (C) 2008-2021 The QXmpp developers
3 *
4 * Author:
5 * Manjeet Dahiya
6 *
7 * Source:
8 * https://github.com/qxmpp-project/qxmpp
9 *
10 * This file is a part of QXmpp library.
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 */
23
24#ifndef QXMPPPRESENCE_H
25#define QXMPPPRESENCE_H
26
27#include "QXmppMucIq.h"
28#include "QXmppStanza.h"
29
30class QXmppPresencePrivate;
31
35class QXMPP_EXPORT QXmppPresence : public QXmppStanza
36{
37public:
39 enum Type {
40 Error = 0,
47 Probe
48 };
49
52 Online = 0,
57 Invisible
58 };
59
63 VCardUpdateNone = 0,
66 VCardUpdateNotReady
67
70 };
71
74 ~QXmppPresence() override;
75
77
78 bool isXmppStanza() const override;
79
80 AvailableStatusType availableStatusType() const;
81 void setAvailableStatusType(AvailableStatusType type);
82
83 int priority() const;
84 void setPriority(int priority);
85
86 QXmppPresence::Type type() const;
87 void setType(QXmppPresence::Type);
88
89 QString statusText() const;
90 void setStatusText(const QString &statusText);
91
92 // XEP-0045: Multi-User Chat
93 QXmppMucItem mucItem() const;
94 void setMucItem(const QXmppMucItem &item);
95
96 QString mucPassword() const;
97 void setMucPassword(const QString &password);
98
99 QList<int> mucStatusCodes() const;
100 void setMucStatusCodes(const QList<int> &codes);
101
102 bool isMucSupported() const;
103 void setMucSupported(bool supported);
104
105 // XEP-0153: vCard-Based Avatars
106 QByteArray photoHash() const;
107 void setPhotoHash(const QByteArray &);
108
109 VCardUpdateType vCardUpdateType() const;
110 void setVCardUpdateType(VCardUpdateType type);
111
112 // XEP-0115: Entity Capabilities
113 QString capabilityHash() const;
114 void setCapabilityHash(const QString &);
115
116 QString capabilityNode() const;
117 void setCapabilityNode(const QString &);
118
119 QByteArray capabilityVer() const;
120 void setCapabilityVer(const QByteArray &);
121
122 QStringList capabilityExt() const;
123
124 // XEP-0319: Last User Interaction in Presence
125 QDateTime lastUserInteraction() const;
126 void setLastUserInteraction(const QDateTime &);
127
128 // XEP-0405: Mediated Information eXchange (MIX): Participant Server Requirements
129 QString mixUserJid() const;
130 void setMixUserJid(const QString &);
131
132 QString mixUserNick() const;
133 void setMixUserNick(const QString &);
134
136 void parse(const QDomElement &element) override;
137 void toXml(QXmlStreamWriter *writer) const override;
139
140private:
142 void parseExtension(const QDomElement &element, QXmppElementList &unknownElements);
144
145 QSharedDataPointer<QXmppPresencePrivate> d;
146};
147
148#endif // QXMPPPRESENCE_H
The QXmppMucItem class represents a chat room "item".
Definition: QXmppMucIq.h:37
The QXmppPresence class represents an XMPP presence stanza.
Definition: QXmppPresence.h:36
QXmppPresence & operator=(const QXmppPresence &other)
Assigns other to this presence.
Type
This enum is used to describe a presence type.
Definition: QXmppPresence.h:39
@ Unsubscribe
The sender is unsubscribing from another entity's presence.
Definition: QXmppPresence.h:45
@ Subscribe
The sender wishes to subscribe to the recipient's presence.
Definition: QXmppPresence.h:43
@ Subscribed
The sender has allowed the recipient to receive their presence.
Definition: QXmppPresence.h:44
@ Unavailable
Signals that the sender is no longer available for communication.
Definition: QXmppPresence.h:42
@ Unsubscribed
The subscription request has been denied or a previously-granted subscription has been cancelled.
Definition: QXmppPresence.h:46
@ Available
Signals that the sender is online and available for communication.
Definition: QXmppPresence.h:41
VCardUpdateType
Definition: QXmppPresence.h:62
@ VCardUpdateNoPhoto
User is not using any image.
Definition: QXmppPresence.h:64
@ VCardUpdateValidPhoto
User is advertising an image.
Definition: QXmppPresence.h:65
QXmppPresence(const QXmppPresence &other)
Constructs a copy of other.
~QXmppPresence() override
Destroys a QXmppPresence.
AvailableStatusType
This enum is used to describe an availability status.
Definition: QXmppPresence.h:51
@ Chat
The entity or resource is actively interested in chatting.
Definition: QXmppPresence.h:56
@ DND
The entity or resource is busy ("Do Not Disturb").
Definition: QXmppPresence.h:55
@ Away
The entity or resource is temporarily away.
Definition: QXmppPresence.h:53
@ XA
The entity or resource is away for an extended period.
Definition: QXmppPresence.h:54
The Error class represents a stanza error.
Definition: QXmppStanza.h:106
The QXmppStanza class is the base class for all XMPP stanzas.
Definition: QXmppStanza.h:100
virtual bool isXmppStanza() const
Definition: QXmppStanza.cpp:671