QXmpp Version:0.3.91
QXmppPresence.h
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         };
00080 
00081         Status(QXmppPresence::Status::Type type = QXmppPresence::Status::Online,
00082             const QString statusText = "", int priority = 0);
00083 
00084         QXmppPresence::Status::Type type() const;
00085         void setType(QXmppPresence::Status::Type);
00086 
00087         QString statusText() const;
00088         void setStatusText(const QString&);
00089 
00090         int priority() const;
00091         void setPriority(int);
00092 
00094         void parse(const QDomElement &element);
00095         void toXml(QXmlStreamWriter *writer) const;
00097 
00098     private:
00099         QString getTypeStr() const;
00100         void setTypeFromStr(const QString&);
00101 
00102         QXmppPresence::Status::Type m_type;
00103         QString m_statusText;
00104         int m_priority;
00105     };
00106 
00107     QXmppPresence(QXmppPresence::Type type = QXmppPresence::Available,
00108         const QXmppPresence::Status& status = QXmppPresence::Status());
00109     ~QXmppPresence();
00110 
00111     QXmppPresence::Type type() const;
00112     void setType(QXmppPresence::Type);
00113 
00114     QXmppPresence::Status& status();
00115     const QXmppPresence::Status& status() const;
00116     void setStatus(const QXmppPresence::Status&);
00117 
00119     void parse(const QDomElement &element);
00120     void toXml(QXmlStreamWriter *writer) const;
00122 
00123     // XEP-0045: Multi-User Chat
00124     QXmppMucItem mucItem() const;
00125     void setMucItem(const QXmppMucItem &item);
00126 
00127     QList<int> mucStatusCodes() const;
00128     void setMucStatusCodes(const QList<int> &codes);
00129 
00131     QByteArray photoHash() const;
00132     void setPhotoHash(const QByteArray&);
00133 
00134     VCardUpdateType vCardUpdateType() const;
00135     void setVCardUpdateType(VCardUpdateType type);
00136 
00137     // XEP-0115: Entity Capabilities
00138     QString capabilityHash() const;
00139     void setCapabilityHash(const QString&);
00140 
00141     QString capabilityNode() const;
00142     void setCapabilityNode(const QString&);
00143 
00144     QByteArray capabilityVer() const;
00145     void setCapabilityVer(const QByteArray&);
00146 
00147     QStringList capabilityExt() const;
00148 
00149 private:
00150     QString getTypeStr() const;
00151     void setTypeFromStr(const QString&);
00152 
00153     Type m_type;
00154     QXmppPresence::Status m_status;
00155 
00156 
00158 
00161     QByteArray m_photoHash;
00162     VCardUpdateType m_vCardUpdateType;
00163 
00164     // XEP-0115: Entity Capabilities
00165     QString m_capabilityHash;
00166     QString m_capabilityNode;
00167     QByteArray m_capabilityVer;
00168     // Legacy XEP-0115: Entity Capabilities
00169     QStringList m_capabilityExt;
00170 
00171     // XEP-0045: Multi-User Chat
00172     QXmppMucItem m_mucItem;
00173     QList<int> m_mucStatusCodes;
00174 };
00175 
00176 #endif // QXMPPPRESENCE_H
 All Classes Functions Enumerations Enumerator Properties