/usr/include/jreen-qt5/jreen/abstractroster.h is in libjreen-qt5-dev 1.2.0-1fakesync1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | /****************************************************************************
**
** Jreen
**
** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru>
**
*****************************************************************************
**
** $JREEN_BEGIN_LICENSE$
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.
**
** This program 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see http://www.gnu.org/licenses/.
** $JREEN_END_LICENSE$
**
****************************************************************************/
// TODO: Create simple RosterManager for bots and simple applications
#ifndef JREEN_ABSTRACTROSTER_H
#define JREEN_ABSTRACTROSTER_H
#include <QSharedPointer>
#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
// Looks like this function was overloaded at this release, if not - tell me // EuroElessar
template <class T> inline uint qHash(const T *key);
template<typename T>
inline uint qHash(const QSharedPointer<T> &key) { return qHash(key.data()); }
#endif
#include "stanzaextension.h"
#include "presence.h"
#include "langmap.h"
#include "jid.h"
#include <QStringList>
#include <QHash>
#include <QSet>
namespace Jreen
{
class Client;
class IQ;
class Presence;
class AbstractRoster;
class AbstractRosterPrivate;
class SimpleRosterPrivate;
class RosterItem;
class RosterItemPrivate;
class AbstractRosterQuery;
class JREEN_AUTOTEST_EXPORT ItemFactory : public XmlStreamFactory<RosterItem>
{
public:
};
enum AbstractRosterIqContext
{
SyncContext,
LoadRoster,
AddRosterItem,
RemoveRosterItem
};
class RosterItemPrivate;
class JREEN_EXPORT RosterItem
{
Q_DECLARE_PRIVATE(RosterItem)
friend class AbstractRoster;
public:
enum SubscriptionType
{
From,
To,
Both,
Remove,
None,
Invalid = -1
};
typedef QSharedPointer<RosterItem> Ptr;
RosterItem(const QString &jid, const QString &name,
const QStringList &groups, SubscriptionType s10n);
RosterItem(AbstractRoster *roster, RosterItemPrivate *data = 0);
virtual ~RosterItem();
QString jid() const;
QString name() const;
QStringList groups() const;
SubscriptionType subscription() const;
QString ask() const;
void setGroups(const QStringList &groups);
void setName(const QString &name);
protected:
virtual void setData(const QSharedPointer<RosterItem> &item);
void setChanged();
QScopedPointer<RosterItemPrivate> d_ptr;
};
class JREEN_EXPORT AbstractRoster : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(AbstractRoster)
public:
AbstractRoster(Client *client, AbstractRosterPrivate *data = 0);
virtual ~AbstractRoster();
QString version() const;
RosterItem::Ptr item(const JID &jid) const;
RosterItem::Ptr selfItem() const;
void fillRoster(const QString &version, const QList<RosterItem::Ptr> &items);
public slots:
virtual void load();
virtual void synchronize();
protected:
virtual QSharedPointer<RosterItem> createItem();
virtual void init();
virtual void add(const JID &jid, const QString &name = QString(), const QStringList &groups = QStringList());
virtual void remove(const JID &jid);
signals:
void loaded();
protected slots:
virtual void handleIQ(const Jreen::IQ &iq);
virtual void handleIQ(const Jreen::IQ &iq, int context);
protected:
virtual void onItemAdded(QSharedPointer<RosterItem> item);
virtual void onItemUpdated(QSharedPointer<RosterItem> item);
virtual void onItemRemoved(const QString &jid);
virtual void onLoaded(const QList<QSharedPointer<RosterItem> > &items);
QScopedPointer<AbstractRosterPrivate> d_ptr;
friend class AbstractRosterQuery;
friend class JREEN_AUTOTEST_EXPORT AbstractRosterQueryFactory;
friend class RosterItem;
};
class JREEN_EXPORT SimpleRoster : public AbstractRoster
{
Q_OBJECT
Q_DECLARE_PRIVATE(SimpleRoster)
public:
SimpleRoster(Client *client, SimpleRosterPrivate *data = 0);
virtual ~SimpleRoster();
void subscribe(const JID &jid, const QString &msg, const QString &name, const QStringList &groups);
void subscribe(const JID &jid, const QString &msg = QString());
void unsubscribe(const JID &jid, const QString &msg = QString());
void allowSubscription(const JID &jid, bool ok);
using AbstractRoster::add;
using AbstractRoster::remove;
signals:
void itemAdded(const Jreen::RosterItem::Ptr &item);
void itemUpdated(const Jreen::RosterItem::Ptr &item);
void itemRemoved(const QString &jid);
void presenceReceived(const Jreen::RosterItem::Ptr &item, const Jreen::Presence &presence);
void subscriptionReceived(const Jreen::RosterItem::Ptr &item, const Jreen::Presence &presence);
protected slots:
void onPresenceReceived(const Jreen::Presence &presence);
protected:
virtual void onItemAdded(QSharedPointer<RosterItem> item);
virtual void onItemUpdated(QSharedPointer<RosterItem> item);
virtual void onItemRemoved(const QString &jid);
};
}
#endif // JREEN_ABSTRACTROSTER_H
|