Show invite menu in wlm chat window immediately
[kdenetwork.git] / kopete / libkopete / kopeteblacklister.h
blobe6d6ca9f142ce67625b0bd5a084e9a6476249ef4
1 /*
2 kopeteblacklister.h - Kopete BlackLister
4 Copyright (c) 2004 by Roie Kerstein <sf_kersteinroie@bezeqint.net>
6 *************************************************************************
7 * *
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2 of the License, or (at your option) any later version. *
12 * *
13 *************************************************************************
16 #ifndef KOPETEBLACKLISTER_H
17 #define KOPETEBLACKLISTER_H
19 #include <QtCore/QObject>
21 namespace Kopete
24 class Contact;
26 /**
27 * @brief Manages the list of blacklisted contacts for an account
29 * This class manages the list of contacts the user wishes
30 * to ignore permanently. In order to use the this class, there is no need to
31 * create an instance. Use the @ref Kopete::Account::blackLister() instead.
33 * Keep in mind that this class does not discard messages from blocked
34 * users - It only manages the list. It is the up to the protocol to
35 * check whether a user is blocked, and act accordingly. A protocol may
36 * re-implement @ref Kopete::Account::block() and @ref Kopete::Account::unblock()
37 * and use @ref Kopete::Account::blackLister() as a persistent list manager
38 * only, or connect the signals @ref contactAdded() and @ref contactRemoved()
39 * to its slots.
41 * @sa Kopete::Account::block() Kopete::Account::unblock()
43 * @author Roie Kerstein <sf_kersteinroie@bezeqint.net>
45 class BlackLister : public QObject
47 Q_OBJECT
49 public:
50 /**
51 * Create an instance, and read the blacklist from disk if it exists.
52 * @param protocolId is the ID of the protocol owning accountId
53 * @param accountId is the ID of the owning Account.
54 * @param parent The QObject parent for this class.
55 * @param name The QObject name for this class.
57 BlackLister( const QString &protocolId, const QString &accountId, QObject *parent = 0 );
58 ~BlackLister();
60 /**
61 * \return @c true if @p contact is blocked, @c false otherwise.
63 bool isBlocked( Contact *contact );
65 /**
66 * \return @c true if the contact with ID @p contactId is blocked, @c false otherwise.
68 bool isBlocked( const QString &contactId );
70 public slots:
71 /**
72 * Add a contact to the blacklist.
74 * This function emits the @ref contactAdded() signal.
75 * @param contactId is the ID of the contact to be added to the list.
77 void addContact( const QString &contactId );
79 /**
80 * @overload
82 void addContact( Contact *contact );
84 /**
85 * \brief Remove a contact from the blacklist.
87 * Removes the contact from the blacklist.
88 * This function emits the @ref contactRemoved() signal.
89 * @param contact is the contact to be removed from the list.
91 void removeContact( Contact *contact );
93 /**
94 * @overload
96 void removeContact( const QString &contactId );
98 signals:
99 /**
100 * \brief A new contact has been added to the list
102 * Connect to this signal if you want to perform additional actions,
103 * and you prefer not to derive from this class.
105 void contactAdded( const QString &contactId );
108 * \brief A contact has been removed from the list
110 * Connect to this signal if you want to perform additional actions,
111 * and you prefer not to derive from this class.
113 void contactRemoved( const QString &contactId );
115 private:
116 void saveToDisk();
118 class Private;
119 Private * const d;
124 #endif