blob: f5a5ff6c53186ff5f027c90d2272c66e11986441 (
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 <[email protected]>
*************************************************************************
* *
* 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 <tqmap.h>
#include <tqobject.h>
#include <tqstringlist.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
*/
TQStringList knownDNs();
/**
* Check if we have details for a single DN
*/
bool known( const TQString &dn );
/**
* Get details for a given DN
*/
ContactDetails details( const TQString &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 TQString & 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 TQStringList & dnList, bool onlyUnknown = true );
/**
* Explicitly request a contact's details from the server. Will signal @ref gotContactUserDetails when they are available.
*/
void requestDetails( const TQString & dn, bool onlyUnknown = true );
signals:
void gotContactDetails( const GroupWise::ContactDetails & );
protected slots:
void slotReceiveContactDetails( const GroupWise::ContactDetails & );
protected:
void dump( const TQStringList & list );
private:
TQStringList m_pendingDNs; // a list of DNs that have pending requests
Client * m_client;
TQMap< TQString, GroupWise::ContactDetails > m_detailsMap;
};
#endif
|