QXmpp  Version:0.4.92
 All Classes Functions Enumerations Enumerator Properties Groups
QXmppPresence.h
1 /*
2  * Copyright (C) 2008-2011 The QXmpp developers
3  *
4  * Author:
5  * Manjeet Dahiya
6  *
7  * Source:
8  * http://code.google.com/p/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 
25 #ifndef QXMPPPRESENCE_H
26 #define QXMPPPRESENCE_H
27 
28 #include "QXmppStanza.h"
29 #include "QXmppMucIq.h"
30 
34 class QXMPP_EXPORT QXmppPresence : public QXmppStanza
35 {
36 public:
38  enum Type
39  {
40  Error = 0,
47  Probe
48  };
49 
53  {
54  VCardUpdateNone = 0,
57  VCardUpdateNotReady
58 
61  };
62 
67 
68  class QXMPP_EXPORT Status
69  {
70  public:
72  enum Type
73  {
74  Offline = 0,
76  Away,
77  XA,
78  DND,
79  Chat,
80  };
81 
83  const QString statusText = "", int priority = 0);
84 
85  QXmppPresence::Status::Type type() const;
86  void setType(QXmppPresence::Status::Type);
87 
88  QString statusText() const;
89  void setStatusText(const QString&);
90 
91  int priority() const;
92  void setPriority(int);
93 
95  void parse(const QDomElement &element);
96  void toXml(QXmlStreamWriter *writer) const;
98 
99  private:
100  QString getTypeStr() const;
101  void setTypeFromStr(const QString&);
102 
104  QString m_statusText;
105  int m_priority;
106  };
107 
109  const QXmppPresence::Status& status = QXmppPresence::Status());
110  ~QXmppPresence();
111 
112  QXmppPresence::Type type() const;
113  void setType(QXmppPresence::Type);
114 
115  QXmppPresence::Status& status();
116  const QXmppPresence::Status& status() const;
117  void setStatus(const QXmppPresence::Status&);
118 
120  void parse(const QDomElement &element);
121  void toXml(QXmlStreamWriter *writer) const;
123 
124  // XEP-0045: Multi-User Chat
125  QXmppMucItem mucItem() const;
126  void setMucItem(const QXmppMucItem &item);
127 
128  QList<int> mucStatusCodes() const;
129  void setMucStatusCodes(const QList<int> &codes);
130 
132  QByteArray photoHash() const;
133  void setPhotoHash(const QByteArray&);
134 
135  VCardUpdateType vCardUpdateType() const;
136  void setVCardUpdateType(VCardUpdateType type);
137 
138  // XEP-0115: Entity Capabilities
139  QString capabilityHash() const;
140  void setCapabilityHash(const QString&);
141 
142  QString capabilityNode() const;
143  void setCapabilityNode(const QString&);
144 
145  QByteArray capabilityVer() const;
146  void setCapabilityVer(const QByteArray&);
147 
148  QStringList capabilityExt() const;
149 
150 private:
151  QString getTypeStr() const;
152  void setTypeFromStr(const QString&);
153 
154  Type m_type;
155  QXmppPresence::Status m_status;
156 
157 
159 
162  QByteArray m_photoHash;
163  VCardUpdateType m_vCardUpdateType;
164 
165  // XEP-0115: Entity Capabilities
166  QString m_capabilityHash;
167  QString m_capabilityNode;
168  QByteArray m_capabilityVer;
169  // Legacy XEP-0115: Entity Capabilities
170  QStringList m_capabilityExt;
171 
172  // XEP-0045: Multi-User Chat
173  QXmppMucItem m_mucItem;
174  QList<int> m_mucStatusCodes;
175 };
176 
177 #endif // QXMPPPRESENCE_H