QXmpp Version:0.3.91
QXmppRosterManager.h
00001 /*
00002  * Copyright (C) 2008-2011 The QXmpp developers
00003  *
00004  * Authors:
00005  *  Manjeet Dahiya
00006  *  Jeremy Lainé
00007  *
00008  * Source:
00009  *  http://code.google.com/p/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 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     // deprecated in release 0.4.0
00088     void Q_DECL_DEPRECATED removeRosterEntry(const QString &bareJid);
00090 
00091 public slots:
00092     bool acceptSubscription(const QString &bareJid);
00093     bool refuseSubscription(const QString &bareJid);
00094     bool removeItem(const QString &bareJid);
00095     bool renameItem(const QString &bareJid, const QString &name);
00096     bool subscribe(const QString &bareJid);
00097     bool unsubscribe(const QString &bareJid);
00098 
00099 signals:
00104     void rosterReceived();
00105 
00107     void presenceChanged(const QString& bareJid, const QString& resource);
00108 
00110     // deprecated in release 0.4.0
00111     void rosterChanged(const QString& bareJid);
00113 
00121     void subscriptionReceived(const QString& bareJid);
00122 
00125     void itemAdded(const QString& bareJid);
00126 
00129     void itemChanged(const QString& bareJid);
00130 
00133     void itemRemoved(const QString& bareJid);
00134 
00135 private slots:
00136     void _q_connected();
00137     void _q_disconnected();
00138     void _q_presenceReceived(const QXmppPresence&);
00139 
00140 private:
00141     QXmppRosterManagerPrivate *d;
00142 };
00143 
00144 #endif // QXMPPROSTER_H
 All Classes Functions Enumerations Enumerator Properties