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
|
/*
kopeteblacklister.h - Kopete BlackLister
Copyright (c) 2004 by Roie Kerstein <sf_kersteinroie@bezeqint.net>
*************************************************************************
* *
* 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 KOPETEBLACKLISTER_H
#define KOPETEBLACKLISTER_H
#include <tqobject.h>
namespace Kopete
{
class Contact;
/**
* @brief Manages the list of blacklisted contacts for an account
*
* This class manages the list of contacts the user wishes
* to ignore permanently. In order to use the this class, there is no need to
* create an instance. Use the @ref Kopete::Account::blackLister() instead.
*
* Keep in mind that this class does not discard messages from blocked
* users - It only manages the list. It is the up to the protocol to
* check whether a user is blocked, and act accordingly. A protocol may
* re-implement @ref Kopete::Account::block() and @ref Kopete::Account::unblock()
* and use @ref Kopete::Account::blackLister() as a persistent list manager
* only, or connect the signals @ref contactAdded() and @ref contactRemoved()
* to its slots.
*
* @sa Kopete::Account::block() Kopete::Account::unblock()
*
* @author Roie Kerstein <sf_kersteinroie@bezeqint.net>
*/
class BlackLister : public TQObject
{
Q_OBJECT
public:
/**
* Create an instance, and read the blacklist from disk if it exists.
* @param protocolId is the ID of the protocol owning accountId
* @param accountId is the ID of the owning Account.
* @param parent The TQObject parent for this class.
* @param name The TQObject name for this class.
*/
BlackLister( const TQString &protocolId, const TQString &accountId, TQObject *parent = 0, const char *name = 0 );
~BlackLister();
/**
* \return @c true if @p contact is blocked, @c false otherwise.
*/
bool isBlocked( Contact *contact );
/**
* \return @c true if the contact with ID @p contactId is blocked, @c false otherwise.
*/
bool isBlocked( const TQString &contactId );
public slots:
/**
* Add a contact to the blacklist.
*
* This function emits the @ref contactAdded() signal.
* @param contactId is the ID of the contact to be added to the list.
*/
void addContact( const TQString &contactId );
/**
* @overload
*/
void addContact( Contact *contact );
/**
* \brief Remove a contact from the blacklist.
*
* Removes the contact from the blacklist.
* This function emits the @ref contactRemoved() signal.
* @param contact is the contact to be removed from the list.
*/
void removeContact( Contact *contact );
/**
* @overload
*/
void removeContact( const TQString &contactId );
signals:
/**
* \brief A new contact has been added to the list
*
* Connect to this signal if you want to perform additional actions,
* and you prefer not to derive from this class.
*/
void contactAdded( const TQString &contactId );
/**
* \brief A contact has been removed from the list
*
* Connect to this signal if you want to perform additional actions,
* and you prefer not to derive from this class.
*/
void contactRemoved( const TQString &contactId );
private:
void saveToDisk();
class Private;
Private *d;
};
}
#endif
|