QXmppRosterManager.h
/*
* Copyright (C) 2008-2019 The QXmpp developers
*
* Authors:
* Manjeet Dahiya
* Jeremy Lainé
*
* Source:
* https://github.com/qxmpp-project/qxmpp
*
* This file is a part of QXmpp library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/
#ifndef QXMPPROSTERMANAGER_H
#define QXMPPROSTERMANAGER_H
#include <QObject>
#include <QMap>
#include <QStringList>
#include "QXmppClientExtension.h"
#include "QXmppPresence.h"
#include "QXmppRosterIq.h"
class QXmppRosterManagerPrivate;
class QXMPP_EXPORT QXmppRosterManager : public QXmppClientExtension
{
Q_OBJECT
public:
QXmppRosterManager(QXmppClient* stream);
~QXmppRosterManager();
bool isRosterReceived() const;
QStringList getRosterBareJids() const;
QXmppRosterIq::Item getRosterEntry(const QString& bareJid) const;
QStringList getResources(const QString& bareJid) const;
QMap<QString, QXmppPresence> getAllPresencesForBareJid(
const QString& bareJid) const;
QXmppPresence getPresence(const QString& bareJid,
const QString& resource) const;
bool handleStanza(const QDomElement &element);
public slots:
bool acceptSubscription(const QString &bareJid, const QString &reason = QString());
bool refuseSubscription(const QString &bareJid, const QString &reason = QString());
bool addItem(const QString &bareJid, const QString &name = QString(), const QSet<QString> &groups = QSet<QString>());
bool removeItem(const QString &bareJid);
bool renameItem(const QString &bareJid, const QString &name);
bool subscribe(const QString &bareJid, const QString &reason = QString());
bool unsubscribe(const QString &bareJid, const QString &reason = QString());
signals:
void rosterReceived();
void presenceChanged(const QString& bareJid, const QString& resource);
void subscriptionReceived(const QString& bareJid);
void itemAdded(const QString& bareJid);
void itemChanged(const QString& bareJid);
void itemRemoved(const QString& bareJid);
private slots:
void _q_connected();
void _q_disconnected();
void _q_presenceReceived(const QXmppPresence&);
private:
QXmppRosterManagerPrivate *d;
};
#endif // QXMPPROSTER_H
QXmppRosterIq::Item
The QXmppRosterIq::Item class represents a roster entry.
Definition: QXmppRosterIq.h:42
QXmppPresence
The QXmppPresence class represents an XMPP presence stanza.
Definition: QXmppPresence.h:36
QXmppRosterManager
The QXmppRosterManager class provides access to a connected client's roster.
Definition: QXmppRosterManager.h:64
QXmppClientExtension
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:47
QXmppClient
The QXmppClient class is the main class for using QXmpp.
Definition: QXmppClient.h:80
QXmppClientExtension::handleStanza
virtual bool handleStanza(const QDomElement &stanza)=0
You need to implement this method to process incoming XMPP stanzas.