blob: 4e9b6022efe2b7c26887ad0432a3760d263c12cd (
plain)
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
|
/*
userdetailsmanager.h - Storage of all user details seen during this session
Copyright (c) 2004 SUSE Linux AG http://www.suse.com
Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
*************************************************************************
* *
* 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 of the License, or (at your option) any later version. *
* *
*************************************************************************
*/
#ifndef USERDETAILSMANAGER_H
#define USERDETAILSMANAGER_H
#include <qmap.h>
#include <qobject.h>
#include <qstringlist.h>
#include "gwerror.h"
class Client;
/**
Several client event handling processes require that a contact's details are available before exposing the event to the user. This class is responsible for issuing details requests, tracking which users the client already has received details for, and signalling when details have been received. The manager allows multiple interleaved get details requests to be replaced by a single request.
@author SUSE AG
*/
class UserDetailsManager : public QObject
{
Q_OBJECT
public:
UserDetailsManager( Client * parent, const char *name = 0);
~UserDetailsManager();
/**
* List of DNs that we have already received details for
*/
QStringList knownDNs();
/**
* Check if we have details for a single DN
*/
bool known( const QString &dn );
/**
* Get details for a given DN
*/
ContactDetails details( const QString &dn );
/**
* Add a ContactDetails object to our cache.
* This SHOULD be called when receiving details in contactlist receive and manipulation, to prevent unnecessary additional requests.
*/
void addDetails( const GroupWise::ContactDetails & details );
/**
* Remove a contact from the list of known DNs. This MUST be performed when a client removes a DN from its local contact list,
* otherwise new events from this DN will not receive user details.
*/
void removeContact( const QString & dn );
/**
* Explicitly request details for a set of contacts from the server.
* Will signal @ref gotContactUserDetails for each one when they are available.
*/
void requestDetails( const QStringList & dnList, bool onlyUnknown = true );
/**
* Explicitly request a contact's details from the server. Will signal @ref gotContactUserDetails when they are available.
*/
void requestDetails( const QString & dn, bool onlyUnknown = true );
signals:
void gotContactDetails( const GroupWise::ContactDetails & );
protected slots:
void slotReceiveContactDetails( const GroupWise::ContactDetails & );
protected:
void dump( const QStringList & list );
private:
QStringList m_pendingDNs; // a list of DNs that have pending requests
Client * m_client;
QMap< QString, GroupWise::ContactDetails > m_detailsMap;
};
#endif
|