QXmpp  Version:1.3.1
QXmppPresence.h
1 /*
2  * Copyright (C) 2008-2020 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 
30 class QXmppPresencePrivate;
31 
35 class QXMPP_EXPORT QXmppPresence : public QXmppStanza
36 {
37 public:
39  enum Type {
40  Error = 0,
47  Probe
48  };
49 
52  Online = 0,
53  Away,
54  XA,
55  DND,
56  Chat,
57  Invisible
58  };
59 
63  VCardUpdateNone = 0,
66  VCardUpdateNotReady
67 
70  };
71 
73  QXmppPresence(const QXmppPresence &other);
74  ~QXmppPresence() override;
75 
76  QXmppPresence &operator=(const QXmppPresence &other);
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 
140 private:
142  void parseExtension(const QDomElement &element, QXmppElementList &unknownElements);
144 
145  QSharedDataPointer<QXmppPresencePrivate> d;
146 };
147 
148 #endif // QXMPPPRESENCE_H
QXmppPresence::Unavailable
@ Unavailable
Signals that the sender is no longer available for communication.
Definition: QXmppPresence.h:42
QXmppStanza::operator=
QXmppStanza & operator=(const QXmppStanza &other)
Assigns other to this stanza.
Definition: QXmppStanza.cpp:583
QXmppPresence
The QXmppPresence class represents an XMPP presence stanza.
Definition: QXmppPresence.h:35
QXmppPresence::Subscribe
@ Subscribe
The sender wishes to subscribe to the recipient's presence.
Definition: QXmppPresence.h:43
QXmppPresence::Type
Type
This enum is used to describe a presence type.
Definition: QXmppPresence.h:39
QXmppStanza::Error
The Error class represents a stanza error.
Definition: QXmppStanza.h:105
QXmppMucItem
The QXmppMucItem class represents a chat room "item".
Definition: QXmppMucIq.h:36
QXmppStanza::isXmppStanza
virtual bool isXmppStanza() const
Definition: QXmppStanza.cpp:710
QXmppPresence::AvailableStatusType
AvailableStatusType
This enum is used to describe an availability status.
Definition: QXmppPresence.h:51
QXmppPresence::DND
@ DND
The entity or resource is busy ("Do Not Disturb").
Definition: QXmppPresence.h:55
QXmppPresence::VCardUpdateNoPhoto
@ VCardUpdateNoPhoto
User is not using any image.
Definition: QXmppPresence.h:64
QXmppPresence::Available
@ Available
Signals that the sender is online and available for communication.
Definition: QXmppPresence.h:41
QXmppPresence::VCardUpdateType
VCardUpdateType
Definition: QXmppPresence.h:62
QXmppStanza
The QXmppStanza class is the base class for all XMPP stanzas.
Definition: QXmppStanza.h:99
QXmppPresence::Away
@ Away
The entity or resource is temporarily away.
Definition: QXmppPresence.h:53
QXmppPresence::Chat
@ Chat
The entity or resource is actively interested in chatting.
Definition: QXmppPresence.h:56
QXmppPresence::Subscribed
@ Subscribed
The sender has allowed the recipient to receive their presence.
Definition: QXmppPresence.h:44
QXmppPresence::Unsubscribe
@ Unsubscribe
The sender is unsubscribing from another entity's presence.
Definition: QXmppPresence.h:45
QXmppPresence::XA
@ XA
The entity or resource is away for an extended period.
Definition: QXmppPresence.h:54
QXmppPresence::Unsubscribed
@ Unsubscribed
The subscription request has been denied or a previously-granted subscription has been cancelled.
Definition: QXmppPresence.h:46
QXmppPresence::VCardUpdateValidPhoto
@ VCardUpdateValidPhoto
User is advertising an image.
Definition: QXmppPresence.h:65