QXmppRosterManager.h
/*
* Copyright (C) 2008-2021 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 "QXmppClientExtension.h"
#include "QXmppPresence.h"
#include "QXmppRosterIq.h"
#include <QMap>
#include <QObject>
#include <QStringList>
class QXmppRosterManagerPrivate;
class QXMPP_EXPORT QXmppRosterManager : public QXmppClientExtension
{
Q_OBJECT
public:
QXmppRosterManager(QXmppClient *stream);
~QXmppRosterManager() override;
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) override;
public Q_SLOTS:
bool acceptSubscription(const QString &bareJid, const QString &reason = {});
bool refuseSubscription(const QString &bareJid, const QString &reason = {});
bool addItem(const QString &bareJid, const QString &name = {}, const QSet<QString> &groups = {});
bool removeItem(const QString &bareJid);
bool renameItem(const QString &bareJid, const QString &name);
bool subscribe(const QString &bareJid, const QString &reason = {});
bool unsubscribe(const QString &bareJid, const QString &reason = {});
Q_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 Q_SLOTS:
void _q_connected();
void _q_disconnected();
void _q_presenceReceived(const QXmppPresence &);
private:
QXmppRosterManagerPrivate *d;
};
#endif // QXMPPROSTER_H
QXmppClientExtension
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:47
QXmppClientExtension::handleStanza
virtual bool handleStanza(const QDomElement &stanza)=0
You need to implement this method to process incoming XMPP stanzas.
QXmppClient
The QXmppClient class is the main class for using QXmpp.
Definition: QXmppClient.h:94
QXmppPresence
The QXmppPresence class represents an XMPP presence stanza.
Definition: QXmppPresence.h:36
QXmppRosterIq::Item
The QXmppRosterIq::Item class represents a roster entry.
Definition: QXmppRosterIq.h:47
QXmppRosterManager
The QXmppRosterManager class provides access to a connected client's roster.
Definition: QXmppRosterManager.h:69
QXmppRosterManager::subscriptionReceived
void subscriptionReceived(const QString &bareJid)
QXmppRosterManager::itemRemoved
void itemRemoved(const QString &bareJid)
QXmppRosterManager::itemChanged
void itemChanged(const QString &bareJid)
QXmppRosterManager::rosterReceived
void rosterReceived()
QXmppRosterManager::itemAdded
void itemAdded(const QString &bareJid)
QXmppRosterManager::presenceChanged
void presenceChanged(const QString &bareJid, const QString &resource)
This signal is emitted when the presence of a particular bareJid and resource changes.