QXmpp Version:0.7.6

- Main Page
- Modules
- Classes
- Files

- File List

All Classes Functions Variables Enumerations Enumerator Properties Groups
QXmppRosterManager.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 #ifndef QXMPPROSTERMANAGER_H
26 #define QXMPPROSTERMANAGER_H
27
28 #include <QObject>
29 #include <QMap>
30 #include <QStringList>
31
32 #include "QXmppClientExtension.h"
33 #include "QXmppPresence.h"
34 #include "QXmppRosterIq.h"
35
36 class QXmppRosterManagerPrivate;
37
63
64 class QXMPP_EXPORT QXmppRosterManager : public QXmppClientExtension
65 {
66 Q_OBJECT
67
68 public:
69 QXmppRosterManager(QXmppClient* stream);
70 ~QXmppRosterManager();
71
72 bool isRosterReceived() const;
73 QStringList getRosterBareJids() const;
74 QXmppRosterIq::Item getRosterEntry(const QString& bareJid) const;
75
76 QStringList getResources(const QString& bareJid) const;
77 QMap<QString, QXmppPresence> getAllPresencesForBareJid(
78 const QString& bareJid) const;
79 QXmppPresence getPresence(const QString& bareJid,
80 const QString& resource) const;
81
83 bool handleStanza(const QDomElement &element);
85
86 public slots:
87 bool acceptSubscription(const QString &bareJid, const QString &reason = QString());
88 bool refuseSubscription(const QString &bareJid, const QString &reason = QString());
89 bool addItem(const QString &bareJid, const QString &name = QString(), const QSet<QString> &groups = QSet<QString>());
90 bool removeItem(const QString &bareJid);
91 bool renameItem(const QString &bareJid, const QString &name);
92 bool subscribe(const QString &bareJid, const QString &reason = QString());
93 bool unsubscribe(const QString &bareJid, const QString &reason = QString());
94
95 signals:
100 void rosterReceived();
101
103 void presenceChanged(const QString& bareJid, const QString& resource);
104
112 void subscriptionReceived(const QString& bareJid);
113
116 void itemAdded(const QString& bareJid);
117
120 void itemChanged(const QString& bareJid);
121
124 void itemRemoved(const QString& bareJid);
125
126 private slots:
127 void _q_connected();
128 void _q_disconnected();
129 void _q_presenceReceived(const QXmppPresence&);
130
131 private:
132 QXmppRosterManagerPrivate *d;
133 };
134
135 #endif // QXMPPROSTER_H