QXmpp
Version:0.4.0
|
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 Item(); 00062 QString bareJid() const; 00063 QSet<QString> groups() const; 00064 QString name() const; 00065 QString subscriptionStatus() const; 00066 SubscriptionType subscriptionType() const; 00067 00068 void setBareJid(const QString&); 00069 void setGroups(const QSet<QString>&); 00070 void setName(const QString&); 00071 void setSubscriptionStatus(const QString&); 00072 void setSubscriptionType(SubscriptionType); 00073 00075 void parse(const QDomElement &element); 00076 void toXml(QXmlStreamWriter *writer) const; 00078 00079 private: 00080 QString getSubscriptionTypeStr() const; 00081 void setSubscriptionTypeFromStr(const QString&); 00082 00083 QString m_bareJid; 00084 SubscriptionType m_type; 00085 QString m_name; 00086 // can be subscribe/unsubscribe (attribute "ask") 00087 QString m_subscriptionStatus; 00088 QSet<QString> m_groups; 00089 }; 00090 00091 void addItem(const Item&); 00092 QList<Item> items() const; 00093 00095 static bool isRosterIq(const QDomElement &element); 00097 00098 protected: 00100 void parseElementFromChild(const QDomElement &element); 00101 void toXmlElementFromChild(QXmlStreamWriter *writer) const; 00103 00104 private: 00105 QList<Item> m_items; 00106 }; 00107 00108 #endif // QXMPPROSTERIQ_H