QXmpp  Version:1.0.0
QXmppRosterManager.h
1 /*
2  * Copyright (C) 2008-2019 The QXmpp developers
3  *
4  * Authors:
5  * Manjeet Dahiya
6  * Jeremy LainĂ©
7  *
8  * Source:
9  * https://github.com/qxmpp-project/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:
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
The QXmppRosterManager class provides access to a connected client&#39;s roster.
Definition: QXmppRosterManager.h:64
The QXmppPresence class represents an XMPP presence stanza.
Definition: QXmppPresence.h:36
virtual bool handleStanza(const QDomElement &stanza)=0
You need to implement this method to process incoming XMPP stanzas.
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:47
The QXmppClient class is the main class for using QXmpp.
Definition: QXmppClient.h:80
The QXmppRosterIq::Item class represents a roster entry.
Definition: QXmppRosterIq.h:42