QXmpp Version:0.3.91
|
00001 /* 00002 * Copyright (C) 2008-2011 The QXmpp developers 00003 * 00004 * Author: 00005 * Jeremy Lainé 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 #ifndef QXMPPPUBSUBIQ_H 00025 #define QXMPPPUBSUBIQ_H 00026 00027 #include "QXmppIq.h" 00028 00032 00033 class QXmppPubSubItem 00034 { 00035 public: 00036 QString id() const; 00037 void setId(const QString &id); 00038 00039 QXmppElement contents() const; 00040 void setContents(const QXmppElement &contents); 00041 00043 void parse(const QDomElement &element); 00044 void toXml(QXmlStreamWriter *writer) const; 00046 00047 private: 00048 QString m_id; 00049 QXmppElement m_contents; 00050 }; 00051 00056 00057 class QXmppPubSubIq : public QXmppIq 00058 { 00059 public: 00061 enum QueryType 00062 { 00063 AffiliationsQuery, 00064 DefaultQuery, 00065 ItemsQuery, 00066 PublishQuery, 00067 RetractQuery, 00068 SubscribeQuery, 00069 SubscriptionQuery, 00070 SubscriptionsQuery, 00071 UnsubscribeQuery, 00072 }; 00073 00074 QXmppPubSubIq::QueryType queryType() const; 00075 void setQueryType(QXmppPubSubIq::QueryType queryType); 00076 00077 QString queryJid() const; 00078 void setQueryJid(const QString &jid); 00079 00080 QString queryNode() const; 00081 void setQueryNode(const QString &node); 00082 00083 QList<QXmppPubSubItem> items() const; 00084 void setItems(const QList<QXmppPubSubItem> &items); 00085 00086 QString subscriptionId() const; 00087 void setSubscriptionId(const QString &id); 00088 00090 static bool isPubSubIq(const QDomElement &element); 00092 00093 protected: 00095 void parseElementFromChild(const QDomElement&); 00096 void toXmlElementFromChild(QXmlStreamWriter *writer) const; 00098 00099 private: 00100 QXmppPubSubIq::QueryType m_queryType; 00101 QString m_queryJid; 00102 QString m_queryNode; 00103 QList<QXmppPubSubItem> m_items; 00104 QString m_subscriptionId; 00105 QString m_subscriptionType; 00106 }; 00107 00108 #endif