QXmppRosterIq.h
/*
* Copyright (C) 2008-2014 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 QXMPPROSTERIQ_H
#define QXMPPROSTERIQ_H
#include "QXmppIq.h"
#include <QList>
#include <QSet>
class QXMPP_EXPORT QXmppRosterIq : public QXmppIq
{
public:
class QXMPP_EXPORT Item
{
public:
enum SubscriptionType
{
None = 0,
From = 1,
To = 2,
Both = 3,
Remove = 4,
NotSet = 8
};
Item();
QString bareJid() const;
QSet<QString> groups() const;
QString name() const;
QString subscriptionStatus() const;
SubscriptionType subscriptionType() const;
void setBareJid(const QString&);
void setGroups(const QSet<QString>&);
void setName(const QString&);
void setSubscriptionStatus(const QString&);
void setSubscriptionType(SubscriptionType);
void parse(const QDomElement &element);
void toXml(QXmlStreamWriter *writer) const;
private:
QString getSubscriptionTypeStr() const;
void setSubscriptionTypeFromStr(const QString&);
QString m_bareJid;
SubscriptionType m_type;
QString m_name;
// can be subscribe/unsubscribe (attribute "ask")
QString m_subscriptionStatus;
QSet<QString> m_groups;
};
void addItem(const Item&);
QList<Item> items() const;
static bool isRosterIq(const QDomElement &element);
protected:
void parseElementFromChild(const QDomElement &element);
void toXmlElementFromChild(QXmlStreamWriter *writer) const;
private:
QList<Item> m_items;
};
#endif // QXMPPROSTERIQ_H
QXmppRosterIq::Item::SubscriptionType
SubscriptionType
An enumeration for type of subscription with the bareJid in the roster.
Definition: QXmppRosterIq.h:46
QXmppRosterIq
The QXmppRosterIq class represents a roster IQ.
Definition: QXmppRosterIq.h:37
QXmppIq
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:42
QXmppRosterIq::Item
The QXmppRosterIq::Item class represents a roster entry.
Definition: QXmppRosterIq.h:42