QXmpp  Version:0.4.91
 All Classes Functions Enumerations Enumerator Properties Groups
QXmppRosterManager.h
1 /*
2  * Copyright (C) 2008-2011 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:
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  // deprecated in release 0.4.0
88  void Q_DECL_DEPRECATED removeRosterEntry(const QString &bareJid);
90 
91 public slots:
92  bool acceptSubscription(const QString &bareJid);
93  bool refuseSubscription(const QString &bareJid);
94  bool addItem(const QString &bareJid, const QString &name = QString(), const QSet<QString> &groups = QSet<QString>());
95  bool removeItem(const QString &bareJid);
96  bool renameItem(const QString &bareJid, const QString &name);
97  bool subscribe(const QString &bareJid);
98  bool unsubscribe(const QString &bareJid);
99 
100 signals:
105  void rosterReceived();
106 
108  void presenceChanged(const QString& bareJid, const QString& resource);
109 
111  // deprecated in release 0.4.0
112  void rosterChanged(const QString& bareJid);
114 
122  void subscriptionReceived(const QString& bareJid);
123 
126  void itemAdded(const QString& bareJid);
127 
130  void itemChanged(const QString& bareJid);
131 
134  void itemRemoved(const QString& bareJid);
135 
136 private slots:
137  void _q_connected();
138  void _q_disconnected();
139  void _q_presenceReceived(const QXmppPresence&);
140 
141 private:
142  QXmppRosterManagerPrivate *d;
143 };
144 
145 #endif // QXMPPROSTER_H