File indexing completed on 2024-06-02 04:07:10
0001 /* 0002 * xmpp_muc.h 0003 * Copyright (C) 2006 Remko Troncon 0004 * 0005 * This library is free software; you can redistribute it and/or 0006 * modify it under the terms of the GNU Lesser General Public 0007 * License as published by the Free Software Foundation; either 0008 * either version 2 0009 of the License, or (at your option) any later version.1 of the License, or (at your option) any later version. 0010 * 0011 * This library is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 * Lesser General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU Lesser General Public 0017 * License along with this library; if not, write to the Free Software 0018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 0019 * 0020 */ 0021 0022 #ifndef XMPP_MUC_H 0023 #define XMPP_MUC_H 0024 0025 #include <QDomElement> 0026 #include <QString> 0027 0028 #include "xmpp/jid/jid.h" 0029 0030 namespace XMPP 0031 { 0032 class MUCItem 0033 { 0034 public: 0035 enum Affiliation { UnknownAffiliation, Outcast, NoAffiliation, Member, Admin, Owner }; 0036 enum Role { UnknownRole, NoRole, Visitor, Participant, Moderator }; 0037 0038 MUCItem(Role = UnknownRole, Affiliation = UnknownAffiliation); 0039 MUCItem(const QDomElement&); 0040 0041 void setNick(const QString&); 0042 void setJid(const Jid&); 0043 void setAffiliation(Affiliation); 0044 void setRole(Role); 0045 void setActor(const Jid&); 0046 void setReason(const QString&); 0047 0048 const QString& nick() const; 0049 const Jid& jid() const; 0050 Affiliation affiliation() const; 0051 Role role() const; 0052 const Jid& actor() const; 0053 const QString& reason() const; 0054 0055 void fromXml(const QDomElement&); 0056 QDomElement toXml(QDomDocument&); 0057 0058 bool operator==(const MUCItem& o); 0059 0060 private: 0061 QString nick_; 0062 Jid jid_, actor_; 0063 Affiliation affiliation_; 0064 Role role_; 0065 QString reason_; 0066 }; 0067 0068 class MUCInvite 0069 { 0070 public: 0071 MUCInvite(); 0072 MUCInvite(const QDomElement&); 0073 MUCInvite(const Jid& to, const QString& reason = QString()); 0074 0075 const Jid& to() const; 0076 void setTo(const Jid&); 0077 const Jid& from() const; 0078 void setFrom(const Jid&); 0079 const QString& reason() const; 0080 void setReason(const QString&); 0081 bool cont() const; 0082 void setCont(bool); 0083 0084 0085 void fromXml(const QDomElement&); 0086 QDomElement toXml(QDomDocument&) const; 0087 bool isNull() const; 0088 0089 private: 0090 Jid to_, from_; 0091 QString reason_, password_; 0092 bool cont_; 0093 }; 0094 0095 class MUCDecline 0096 { 0097 public: 0098 MUCDecline(); 0099 MUCDecline(const Jid& to, const QString& reason); 0100 MUCDecline(const QDomElement&); 0101 0102 const Jid& to() const; 0103 void setTo(const Jid&); 0104 const Jid& from() const; 0105 void setFrom(const Jid&); 0106 const QString& reason() const; 0107 void setReason(const QString&); 0108 0109 void fromXml(const QDomElement&); 0110 QDomElement toXml(QDomDocument&) const; 0111 bool isNull() const; 0112 0113 private: 0114 Jid to_, from_; 0115 QString reason_; 0116 }; 0117 0118 class MUCDestroy 0119 { 0120 public: 0121 MUCDestroy(); 0122 MUCDestroy(const QDomElement&); 0123 0124 const Jid& jid() const; 0125 void setJid(const Jid&); 0126 const QString& reason() const; 0127 void setReason(const QString&); 0128 0129 void fromXml(const QDomElement&); 0130 QDomElement toXml(QDomDocument&) const; 0131 0132 private: 0133 Jid jid_; 0134 QString reason_; 0135 }; 0136 } 0137 0138 #endif