QXmpp  Version:0.7.5
 All Classes Functions Variables Enumerations Enumerator Properties Groups
QXmppPresence.h
1 /*
2  * Copyright (C) 2008-2012 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 
31 class QXmppPresencePrivate;
32 
36 class QXMPP_EXPORT QXmppPresence : public QXmppStanza
37 {
38 public:
40  enum Type
41  {
42  Error = 0,
49  Probe
50  };
51 
54  {
55  Online = 0,
56  Away,
57  XA,
58  DND,
59  Chat,
60  Invisible
61  };
62 
66  {
67  VCardUpdateNone = 0,
70  VCardUpdateNotReady
71 
74  };
75 
77  // deprecated since 0.6.2
78  class QXMPP_EXPORT Status
79  {
80  public:
82  enum Type
83  {
84  Online = 0,
85  Away,
86  XA,
87  DND,
88  Chat,
89  Invisible
90  };
91 
92  Status(QXmppPresence::Status::Type type = QXmppPresence::Status::Online,
93  const QString statusText = "", int priority = 0);
94 
95  QXmppPresence::Status::Type type() const;
96  void setType(QXmppPresence::Status::Type);
97 
98  QString statusText() const;
99  void setStatusText(const QString&);
100 
101  int priority() const;
102  void setPriority(int);
103 
104  void parse(const QDomElement &element);
105  void toXml(QXmlStreamWriter *writer) const;
106 
107  private:
108  QXmppPresence::Status::Type m_type;
109  QString m_statusText;
110  int m_priority;
111  };
112 
113  QXmppPresence::Status Q_DECL_DEPRECATED &status();
114  const QXmppPresence::Status Q_DECL_DEPRECATED &status() const;
115  void Q_DECL_DEPRECATED setStatus(const QXmppPresence::Status&);
117 
119  QXmppPresence(const QXmppPresence &other);
120  ~QXmppPresence();
121 
122  QXmppPresence& operator=(const QXmppPresence &other);
123 
124  AvailableStatusType availableStatusType() const;
125  void setAvailableStatusType(AvailableStatusType type);
126 
127  int priority() const;
128  void setPriority(int priority);
129 
130  QXmppPresence::Type type() const;
131  void setType(QXmppPresence::Type);
132 
133  QString statusText() const;
134  void setStatusText(const QString& statusText);
135 
137  void parse(const QDomElement &element);
138  void toXml(QXmlStreamWriter *writer) const;
140 
141  // XEP-0045: Multi-User Chat
142  QXmppMucItem mucItem() const;
143  void setMucItem(const QXmppMucItem &item);
144 
145  QString mucPassword() const;
146  void setMucPassword(const QString &password);
147 
148  QList<int> mucStatusCodes() const;
149  void setMucStatusCodes(const QList<int> &codes);
150 
151  bool isMucSupported() const;
152  void setMucSupported(bool supported);
153 
155  QByteArray photoHash() const;
156  void setPhotoHash(const QByteArray&);
157 
158  VCardUpdateType vCardUpdateType() const;
159  void setVCardUpdateType(VCardUpdateType type);
160 
161  // XEP-0115: Entity Capabilities
162  QString capabilityHash() const;
163  void setCapabilityHash(const QString&);
164 
165  QString capabilityNode() const;
166  void setCapabilityNode(const QString&);
167 
168  QByteArray capabilityVer() const;
169  void setCapabilityVer(const QByteArray&);
170 
171  QStringList capabilityExt() const;
172 
173 private:
174  QSharedDataPointer<QXmppPresencePrivate> d;
175 };
176 
177 #endif // QXMPPPRESENCE_H