QXmpp Version:0.7.6

- Main Page
- Modules
- Classes
- Files

- File List

All Classes Functions Variables Enumerations Enumerator Properties Groups
QXmppRosterIq.h
1 /*
2 * Copyright (C) 2008-2012 The QXmpp developers
3 *
4 * Authors:
5 * Manjeet Dahiya
6 * Jeremy Lainé
7 *
8 * Source:
9 * http://code.google.com/p/qxmpp
10 *
11 * This file is a part of QXmpp library.
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 */
24
25
26 #ifndef QXMPPROSTERIQ_H
27 #define QXMPPROSTERIQ_H
28
29 #include "QXmppIq.h"
30 #include <QList>
31 #include <QSet>
32
36
37 class QXMPP_EXPORT QXmppRosterIq : public QXmppIq
38 {
39 public:
40
42 class QXMPP_EXPORT Item
43 {
44 public:
46 enum SubscriptionType
47 {
48 None = 0,
49
50
51 From = 1,
52
53 To = 2,
54
55 Both = 3,
56
57 Remove = 4,
58 NotSet = 8
59 };
60
61 Item();
62 QString bareJid() const;
63 QSet<QString> groups() const;
64 QString name() const;
65 QString subscriptionStatus() const;
66 SubscriptionType subscriptionType() const;
67
68 void setBareJid(const QString&);
69 void setGroups(const QSet<QString>&);
70 void setName(const QString&);
71 void setSubscriptionStatus(const QString&);
72 void setSubscriptionType(SubscriptionType);
73
75 void parse(const QDomElement &element);
76 void toXml(QXmlStreamWriter *writer) const;
78
79 private:
80 QString getSubscriptionTypeStr() const;
81 void setSubscriptionTypeFromStr(const QString&);
82
83 QString m_bareJid;
84 SubscriptionType m_type;
85 QString m_name;
86 // can be subscribe/unsubscribe (attribute "ask")
87 QString m_subscriptionStatus;
88 QSet<QString> m_groups;
89 };
90
91 void addItem(const Item&);
92 QList<Item> items() const;
93
95 static bool isRosterIq(const QDomElement &element);
97
98 protected:
100 void parseElementFromChild(const QDomElement &element);
101 void toXmlElementFromChild(QXmlStreamWriter *writer) const;
103
104 private:
105 QList<Item> m_items;
106 };
107
108 #endif // QXMPPROSTERIQ_H