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>
29
class UserResource : public XMPP::Resource
33
UserResource(const XMPP::Resource &);
36
void setResource(const XMPP::Resource &);
38
const QString & versionString() const;
39
void setVersionString(const QString &);
41
const QString & publicKeyID() const;
42
int pgpVerifyStatus() const;
43
QDateTime sigTimestamp() const;
44
void setPublicKeyID(const QString &);
45
void setPGPVerifyStatus(int);
46
void setSigTimestamp(const QDateTime &);
49
QString v_ver, v_keyID;
50
int v_pgpVerifyStatus;
54
bool operator<(const UserResource &r1, const UserResource &r2);
55
bool operator<=(const UserResource &r1, const UserResource &r2);
56
bool operator==(const UserResource &r1, const UserResource &r2);
57
bool operator>(const UserResource &r1, const UserResource &r2);
58
bool operator>=(const UserResource &r1, const UserResource &r2);
60
class UserResourceList : public QValueList<UserResource>
68
UserResourceList::Iterator find(const QString &);
69
UserResourceList::Iterator priority();
71
UserResourceList::ConstIterator find(const QString &) const;
72
UserResourceList::ConstIterator priority() const;
75
class UserListItem : public XMPP::LiveRosterItem
78
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);
82
bool isTransport() const;
83
bool isAvailable() const;
84
bool isHidden() const;
86
QDateTime lastAvailable() const;
87
int lastMessageType() const;
88
void setLastMessageType(const int mtype);
89
const QString & presenceError() const;
91
QString makeTip(bool trim = true, bool doLinkify = true) const;
92
QString makeDesc() const;
93
bool isPrivate() const;
95
void setJid(const XMPP::Jid &);
97
void setLastAvailable(const QDateTime &);
98
void setPresenceError(const QString &);
99
void setPrivate(bool);
101
UserResourceList & userResourceList();
102
UserResourceList::Iterator priority();
103
const UserResourceList & userResourceList() const;
104
UserResourceList::ConstIterator priority() const;
106
bool isSecure(const QString &rname) const;
107
void setSecure(const QString &rname, bool);
109
const QString & publicKeyID() const;
110
void setPublicKeyID(const QString &);
79
QPtrList<UserListItem> list;
80
QPtrListIterator<UserListItem> *it;
116
UserResourceList v_url;
118
bool v_self, v_isTransport;
124
typedef QPtrListIterator<UserListItem> UserListIt;
126
class UserList : public QPtrList<UserListItem>
91
QString user, pass, host, resource;
132
UserListItem *find(const XMPP::Jid &);