QXmpp  Version:1.3.2
QXmppMucIq.h
1 /*
2  * Copyright (C) 2008-2020 The QXmpp developers
3  *
4  * Author:
5  * Jeremy LainĂ©
6  *
7  * Source:
8  * https://github.com/qxmpp-project/qxmpp
9  *
10  * This file is a part of QXmpp library.
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * Lesser General Public License for more details.
21  *
22  */
23 
24 #ifndef QXMPPMUCIQ_H
25 #define QXMPPMUCIQ_H
26 
27 #include "QXmppDataForm.h"
28 #include "QXmppIq.h"
29 
35 
36 class QXMPP_EXPORT QXmppMucItem
37 {
38 public:
40  enum Affiliation {
41  UnspecifiedAffiliation,
42  OutcastAffiliation,
43  NoAffiliation,
44  MemberAffiliation,
45  AdminAffiliation,
46  OwnerAffiliation
47  };
48 
50  enum Role {
51  UnspecifiedRole,
52  NoRole,
53  VisitorRole,
54  ParticipantRole,
55  ModeratorRole
56  };
57 
58  QXmppMucItem();
59  bool isNull() const;
60 
61  QString actor() const;
62  void setActor(const QString &actor);
63 
64  Affiliation affiliation() const;
65  void setAffiliation(Affiliation affiliation);
66 
67  QString jid() const;
68  void setJid(const QString &jid);
69 
70  QString nick() const;
71  void setNick(const QString &nick);
72 
73  QString reason() const;
74  void setReason(const QString &reason);
75 
76  Role role() const;
77  void setRole(Role role);
78 
80  void parse(const QDomElement &element);
81  void toXml(QXmlStreamWriter *writer) const;
82 
83  static Affiliation affiliationFromString(const QString &affiliationStr);
84  static QString affiliationToString(Affiliation affiliation);
85  static Role roleFromString(const QString &roleStr);
86  static QString roleToString(Role role);
88 private:
89  QString m_actor;
90  Affiliation m_affiliation;
91  QString m_jid;
92  QString m_nick;
93  QString m_reason;
94  Role m_role;
95 };
96 
103 
104 class QXMPP_EXPORT QXmppMucAdminIq : public QXmppIq
105 {
106 public:
107  QList<QXmppMucItem> items() const;
108  void setItems(const QList<QXmppMucItem> &items);
109 
111  static bool isMucAdminIq(const QDomElement &element);
113 
114 protected:
116  void parseElementFromChild(const QDomElement &element) override;
117  void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
119 
120 private:
121  QList<QXmppMucItem> m_items;
122 };
123 
131 
132 class QXMPP_EXPORT QXmppMucOwnerIq : public QXmppIq
133 {
134 public:
135  QXmppDataForm form() const;
136  void setForm(const QXmppDataForm &form);
137 
139  static bool isMucOwnerIq(const QDomElement &element);
141 
142 protected:
144  void parseElementFromChild(const QDomElement &element) override;
145  void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
147 
148 private:
149  QXmppDataForm m_form;
150 };
151 
152 #endif
QXmppMucItem
The QXmppMucItem class represents a chat room "item".
Definition: QXmppMucIq.h:37
QXmppDataForm
The QXmppDataForm class represents a data form as defined by XEP-0004: Data Forms.
Definition: QXmppDataForm.h:49
QXmppMucOwnerIq
The QXmppMucOwnerIq class represents a chat room configuration IQ as defined by XEP-0045: Multi-User ...
Definition: QXmppMucIq.h:133
QXmppMucAdminIq
The QXmppMucAdminIq class represents a chat room administration IQ as defined by XEP-0045: Multi-User...
Definition: QXmppMucIq.h:105
QXmppMucItem::Role
Role
This enum is used to represent short-lived permissions in a room (roles).
Definition: QXmppMucIq.h:50
QXmppMucItem::Affiliation
Affiliation
This enum is used to represent long-lived permissions in a room (affiliations).
Definition: QXmppMucIq.h:40
QXmppIq
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:42