QXmpp  Version:0.9.3
QXmppRosterManager.h
00001 /*
00002  * Copyright (C) 2008-2014 The QXmpp developers
00003  *
00004  * Authors:
00005  *  Manjeet Dahiya
00006  *  Jeremy Lainé
00007  *
00008  * Source:
00009  *  https://github.com/qxmpp-project/qxmpp
00010  *
00011  * This file is a part of QXmpp library.
00012  *
00013  * This library is free software; you can redistribute it and/or
00014  * modify it under the terms of the GNU Lesser General Public
00015  * License as published by the Free Software Foundation; either
00016  * version 2.1 of the License, or (at your option) any later version.
00017  *
00018  * This library is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021  * Lesser General Public License for more details.
00022  *
00023  */
00024 
00025 #ifndef QXMPPROSTERMANAGER_H
00026 #define QXMPPROSTERMANAGER_H
00027 
00028 #include <QObject>
00029 #include <QMap>
00030 #include <QStringList>
00031 
00032 #include "QXmppClientExtension.h"
00033 #include "QXmppPresence.h"
00034 #include "QXmppRosterIq.h"
00035 
00036 class QXmppRosterManagerPrivate;
00037 
00063 
00064 class QXMPP_EXPORT QXmppRosterManager : public QXmppClientExtension
00065 {
00066     Q_OBJECT
00067 
00068 public:
00069     QXmppRosterManager(QXmppClient* stream);
00070     ~QXmppRosterManager();
00071 
00072     bool isRosterReceived() const;
00073     QStringList getRosterBareJids() const;
00074     QXmppRosterIq::Item getRosterEntry(const QString& bareJid) const;
00075 
00076     QStringList getResources(const QString& bareJid) const;
00077     QMap<QString, QXmppPresence> getAllPresencesForBareJid(
00078             const QString& bareJid) const;
00079     QXmppPresence getPresence(const QString& bareJid,
00080                               const QString& resource) const;
00081 
00083     bool handleStanza(const QDomElement &element);
00085 
00086 public slots:
00087     bool acceptSubscription(const QString &bareJid, const QString &reason = QString());
00088     bool refuseSubscription(const QString &bareJid, const QString &reason = QString());
00089     bool addItem(const QString &bareJid, const QString &name = QString(), const QSet<QString> &groups = QSet<QString>());
00090     bool removeItem(const QString &bareJid);
00091     bool renameItem(const QString &bareJid, const QString &name);
00092     bool subscribe(const QString &bareJid, const QString &reason = QString());
00093     bool unsubscribe(const QString &bareJid, const QString &reason = QString());
00094 
00095 signals:
00100     void rosterReceived();
00101 
00103     void presenceChanged(const QString& bareJid, const QString& resource);
00104 
00112     void subscriptionReceived(const QString& bareJid);
00113 
00116     void itemAdded(const QString& bareJid);
00117 
00120     void itemChanged(const QString& bareJid);
00121 
00124     void itemRemoved(const QString& bareJid);
00125 
00126 private slots:
00127     void _q_connected();
00128     void _q_disconnected();
00129     void _q_presenceReceived(const QXmppPresence&);
00130 
00131 private:
00132     QXmppRosterManagerPrivate *d;
00133 };
00134 
00135 #endif // QXMPPROSTER_H
 All Classes Functions Enumerations Enumerator Properties