QXmpp Version:0.3.91
|
00001 /* 00002 * Copyright (C) 2008-2011 The QXmpp developers 00003 * 00004 * Authors: 00005 * Manjeet Dahiya 00006 * Jeremy Lainé 00007 * 00008 * Source: 00009 * http://code.google.com/p/qxmpp 00010 * 00011 * This file is a part of QXmpp library. 00012 * 00013 * This library is free software; you can redistribute it and/or 00014 * modify it under the terms of the GNU Lesser General Public 00015 * License as published by the Free Software Foundation; either 00016 * version 2.1 of the License, or (at your option) any later version. 00017 * 00018 * This library is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00021 * Lesser General Public License for more details. 00022 * 00023 */ 00024 00025 00026 #ifndef QXMPPROSTERIQ_H 00027 #define QXMPPROSTERIQ_H 00028 00029 #include "QXmppIq.h" 00030 #include <QList> 00031 #include <QSet> 00032 00036 00037 class QXmppRosterIq : public QXmppIq 00038 { 00039 public: 00040 00042 class Item 00043 { 00044 public: 00046 enum SubscriptionType 00047 { 00048 None = 0, 00049 00050 00051 From = 1, 00052 00053 To = 2, 00054 00055 Both = 3, 00056 00057 Remove = 4, 00058 NotSet = 8 00059 }; 00060 00061 QString bareJid() const; 00062 QSet<QString> groups() const; 00063 QString name() const; 00064 QString subscriptionStatus() const; 00065 SubscriptionType subscriptionType() const; 00066 00067 void setBareJid(const QString&); 00068 void setGroups(const QSet<QString>&); 00069 void setName(const QString&); 00070 void setSubscriptionStatus(const QString&); 00071 void setSubscriptionType(SubscriptionType); 00072 00074 void parse(const QDomElement &element); 00075 void toXml(QXmlStreamWriter *writer) const; 00077 00078 private: 00079 QString getSubscriptionTypeStr() const; 00080 void setSubscriptionTypeFromStr(const QString&); 00081 00082 QString m_bareJid; 00083 SubscriptionType m_type; 00084 QString m_name; 00085 // can be subscribe/unsubscribe (attribute "ask") 00086 QString m_subscriptionStatus; 00087 QSet<QString> m_groups; 00088 }; 00089 00090 void addItem(const Item&); 00091 QList<Item> items() const; 00092 00094 static bool isRosterIq(const QDomElement &element); 00096 00097 protected: 00099 void parseElementFromChild(const QDomElement &element); 00100 void toXmlElementFromChild(QXmlStreamWriter *writer) const; 00102 00103 private: 00104 QList<Item> m_items; 00105 }; 00106 00107 #endif // QXMPPROSTERIQ_H