1
/****************************************************************************
2
** userlist.h - higher-level version of JabRoster
3
** Copyright (C) 2001, 2002 Justin Karneges
5
** This program is free software; you can redistribute it and/or
6
** modify it under the terms of the GNU General Public License
7
** as published by the Free Software Foundation; either version 2
8
** of the License, or (at your option) any later version.
10
** This program is distributed in the hope that it will be useful,
11
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
** GNU General Public License for more details.
15
** You should have received a copy of the GNU General Public License
16
** along with this program; if not, write to the Free Software
17
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
19
****************************************************************************/
2
* userlist.h - high-level roster
3
* Copyright (C) 2001, 2002 Justin Karneges
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this library; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
24
#include<qstring.h>
26
25
#include<qdatetime.h>
31
#define USERLIST_CONTACTS 1
32
#define USERLIST_SERVICES 2
34
#define USERLIST_ALL 3
26
#include<qvaluelist.h>
31
class UserResource : public XMPP::Resource
35
UserResource(const XMPP::Resource &);
38
void setResource(const XMPP::Resource &);
40
const QString& versionString() const;
41
const QString& clientVersion() const;
42
const QString& clientName() const;
43
const QString& clientOS() const;
44
void setClient(const QString& name, const QString& version, const QString& os);
46
const QString & publicKeyID() const;
47
int pgpVerifyStatus() const;
48
QDateTime sigTimestamp() const;
49
void setPublicKeyID(const QString &);
50
void setPGPVerifyStatus(int);
51
void setSigTimestamp(const QDateTime &);
54
QString v_ver, v_clientName, v_clientVersion, v_clientOS, v_keyID;
55
int v_pgpVerifyStatus;
59
bool operator<(const UserResource &r1, const UserResource &r2);
60
bool operator<=(const UserResource &r1, const UserResource &r2);
61
bool operator==(const UserResource &r1, const UserResource &r2);
62
bool operator>(const UserResource &r1, const UserResource &r2);
63
bool operator>=(const UserResource &r1, const UserResource &r2);
65
class UserResourceList : public QValueList<UserResource>
73
UserResourceList::Iterator find(const QString &);
74
UserResourceList::Iterator priority();
76
UserResourceList::ConstIterator find(const QString &) const;
77
UserResourceList::ConstIterator priority() const;
80
class UserListItem : public XMPP::LiveRosterItem
83
UserListItem(bool self=false);
62
void add(UserListItem *);
63
void remove(UserListItem *);
64
void remove(QString &jid);
65
UserListItem *findByJid(const QString &jid);
66
UserListItem *findServiceByJid(const QString &jid);
67
UserListItem *findAnyByJid(const QString &jid);
69
//int allQueuesEmpty();
71
UserListItem *start(int);
87
bool isTransport() const;
88
bool isAvailable() const;
89
bool isHidden() const;
91
QDateTime lastAvailable() const;
92
int lastMessageType() const;
93
void setLastMessageType(const int mtype);
94
const QString & presenceError() const;
96
QString makeTip(bool trim = true, bool doLinkify = true) const;
97
QString makeBareTip(bool trim, bool doLinkify) const;
98
QString makeDesc() const;
99
bool isPrivate() const;
101
void setJid(const XMPP::Jid &);
102
void setInList(bool);
103
void setLastAvailable(const QDateTime &);
104
void setPresenceError(const QString &);
105
void setPrivate(bool);
107
UserResourceList & userResourceList();
108
UserResourceList::Iterator priority();
109
const UserResourceList & userResourceList() const;
110
UserResourceList::ConstIterator priority() const;
112
bool isSecure(const QString &rname) const;
113
void setSecure(const QString &rname, bool);
115
const QString & publicKeyID() const;
116
void setPublicKeyID(const QString &);
118
AvatarFactory* avatarFactory() const;
119
void setAvatarFactory(AvatarFactory* av);
125
UserResourceList v_url;
127
bool v_self, v_isTransport;
131
AvatarFactory* v_avatarFactory;
79
QPtrList<UserListItem> list;
80
QPtrListIterator<UserListItem> *it;
135
typedef QPtrListIterator<UserListItem> UserListIt;
137
class UserList : public QPtrList<UserListItem>
91
QString user, pass, host, resource;
143
UserListItem *find(const XMPP::Jid &);