QXmpp Version:0.3.0
|
00001 /* 00002 * Copyright (C) 2008-2011 The QXmpp developers 00003 * 00004 * Author: 00005 * Manjeet Dahiya 00006 * 00007 * Source: 00008 * http://code.google.com/p/qxmpp 00009 * 00010 * This file is a part of QXmpp library. 00011 * 00012 * This library is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU Lesser General Public 00014 * License as published by the Free Software Foundation; either 00015 * version 2.1 of the License, or (at your option) any later version. 00016 * 00017 * This library is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 * Lesser General Public License for more details. 00021 * 00022 */ 00023 00024 00025 #ifndef QXMPPPRESENCE_H 00026 #define QXMPPPRESENCE_H 00027 00028 #include "QXmppStanza.h" 00029 #include "QXmppMucIq.h" 00030 00034 class QXmppPresence : public QXmppStanza 00035 { 00036 public: 00038 enum Type 00039 { 00040 Error = 0, 00041 Available, 00042 Unavailable, 00043 Subscribe, 00044 Subscribed, 00045 Unsubscribe, 00046 Unsubscribed, 00047 Probe 00048 }; 00049 00050 // XEP-0153: vCard-Based Avatars 00051 enum VCardUpdateType 00052 { 00053 VCardUpdateNone = 0, 00054 VCardUpdateNoPhoto, 00055 VCardUpdateValidPhoto, 00056 VCardUpdateNotReady 00057 00060 }; 00061 00066 00067 class Status 00068 { 00069 public: 00071 enum Type 00072 { 00073 Offline = 0, 00074 Online, 00075 Away, 00076 XA, 00077 DND, 00078 Chat, 00079 Invisible 00080 }; 00081 00082 Status(QXmppPresence::Status::Type type = QXmppPresence::Status::Online, 00083 const QString statusText = "", int priority = 0); 00084 00085 QXmppPresence::Status::Type type() const; 00086 void setType(QXmppPresence::Status::Type); 00087 00088 QString statusText() const; 00089 void setStatusText(const QString&); 00090 00091 int priority() const; 00092 void setPriority(int); 00093 00095 void parse(const QDomElement &element); 00096 void toXml(QXmlStreamWriter *writer) const; 00098 00099 private: 00100 QString getTypeStr() const; 00101 void setTypeFromStr(const QString&); 00102 00103 QXmppPresence::Status::Type m_type; 00104 QString m_statusText; 00105 int m_priority; 00106 }; 00107 00108 QXmppPresence(QXmppPresence::Type type = QXmppPresence::Available, 00109 const QXmppPresence::Status& status = QXmppPresence::Status()); 00110 ~QXmppPresence(); 00111 00112 QXmppPresence::Type type() const; 00113 void setType(QXmppPresence::Type); 00114 00115 QXmppPresence::Status& status(); 00116 const QXmppPresence::Status& status() const; 00117 void setStatus(const QXmppPresence::Status&); 00118 00120 void parse(const QDomElement &element); 00121 void toXml(QXmlStreamWriter *writer) const; 00123 00124 // XEP-0045: Multi-User Chat 00125 QXmppMucItem mucItem() const; 00126 void setMucItem(const QXmppMucItem &item); 00127 00128 QList<int> mucStatusCodes() const; 00129 void setMucStatusCodes(const QList<int> &codes); 00130 00132 QByteArray photoHash() const; 00133 void setPhotoHash(const QByteArray&); 00134 00135 VCardUpdateType vCardUpdateType() const; 00136 void setVCardUpdateType(VCardUpdateType type); 00137 00138 // XEP-0115: Entity Capabilities 00139 QString capabilityHash() const; 00140 void setCapabilityHash(const QString&); 00141 00142 QString capabilityNode() const; 00143 void setCapabilityNode(const QString&); 00144 00145 QByteArray capabilityVer() const; 00146 void setCapabilityVer(const QByteArray&); 00147 00148 QStringList capabilityExt() const; 00149 00150 private: 00151 QString getTypeStr() const; 00152 void setTypeFromStr(const QString&); 00153 00154 Type m_type; 00155 QXmppPresence::Status m_status; 00156 00157 00159 00162 QByteArray m_photoHash; 00163 VCardUpdateType m_vCardUpdateType; 00164 00165 // XEP-0115: Entity Capabilities 00166 QString m_capabilityHash; 00167 QString m_capabilityNode; 00168 QByteArray m_capabilityVer; 00169 // Legacy XEP-0115: Entity Capabilities 00170 QStringList m_capabilityExt; 00171 00172 // XEP-0045: Multi-User Chat 00173 QXmppMucItem m_mucItem; 00174 QList<int> m_mucStatusCodes; 00175 }; 00176 00177 #endif // QXMPPPRESENCE_H