QXmpp Version:0.3.91
QXmppMucIq.h
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 QXMPPMUCIQ_H
00025 #define QXMPPMUCIQ_H
00026 
00027 #include "QXmppDataForm.h"
00028 #include "QXmppIq.h"
00029 
00035 
00036 class QXmppMucItem
00037 {
00038 public:
00040     enum Affiliation {
00041         UnspecifiedAffiliation,
00042         OutcastAffiliation,
00043         NoAffiliation,
00044         MemberAffiliation,
00045         AdminAffiliation,
00046         OwnerAffiliation,
00047     };
00048 
00050     enum Role {
00051         UnspecifiedRole,
00052         NoRole,
00053         VisitorRole,
00054         ParticipantRole,
00055         ModeratorRole,
00056     };
00057 
00058     QXmppMucItem();
00059     bool isNull() const;
00060 
00061     QString actor() const;
00062     void setActor(const QString &actor);
00063 
00064     Affiliation affiliation() const;
00065     void setAffiliation(Affiliation affiliation);
00066 
00067     QString jid() const;
00068     void setJid(const QString &jid);
00069 
00070     QString nick() const;
00071     void setNick(const QString &nick);
00072 
00073     QString reason() const;
00074     void setReason(const QString &reason);
00075 
00076     Role role() const;
00077     void setRole(Role role);
00078 
00079     void parse(const QDomElement &element);
00080     void toXml(QXmlStreamWriter *writer) const;
00081 
00083     static Affiliation affiliationFromString(const QString &affiliationStr);
00084     static QString affiliationToString(Affiliation affiliation);
00085     static Role roleFromString(const QString &roleStr);
00086     static QString roleToString(Role role);
00088 private:
00089     QString m_actor;
00090     Affiliation m_affiliation;
00091     QString m_jid;
00092     QString m_nick;
00093     QString m_reason;
00094     Role m_role;
00095 };
00096 
00103 
00104 class QXmppMucAdminIq : public QXmppIq
00105 {
00106 public:
00107     QList<QXmppMucItem> items() const;
00108     void setItems(const QList<QXmppMucItem> &items);
00109 
00111     static bool isMucAdminIq(const QDomElement &element);
00113 
00114 protected:
00116     void parseElementFromChild(const QDomElement &element);
00117     void toXmlElementFromChild(QXmlStreamWriter *writer) const;
00119 
00120 private:
00121     QList<QXmppMucItem> m_items;
00122 };
00123 
00131 
00132 class QXmppMucOwnerIq : public QXmppIq
00133 {
00134 public:
00135     QXmppDataForm form() const;
00136     void setForm(const QXmppDataForm &form);
00137 
00139     static bool isMucOwnerIq(const QDomElement &element);
00141 
00142 protected:
00144     void parseElementFromChild(const QDomElement &element);
00145     void toXmlElementFromChild(QXmlStreamWriter *writer) const;
00147 
00148 private:
00149     QXmppDataForm m_form;
00150 };
00151 
00152 #endif
 All Classes Functions Enumerations Enumerator Properties