blob: ec3fa720e34876b3b9eef5fb890a28a26b3893c7 (
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
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
|
//
// C++ Interface: senderlistfilter
//
// Description:
//
//
// Author: Ulrich Weigelt <ulrich.weigelt@gmx.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef SENDERLISTFILTER_H
#define SENDERLISTFILTER_H
//TQt headers
#include <ntqstring.h>
#include <ntqstringlist.h>
//KDE headers
#include <tdeapplication.h>
#include <tdeconfig.h>
#include <kdebug.h>
//Kshowmail headers
#include "types.h"
#include "constants.h"
using namespace Types;
/**
* @brief This class represents both the blacklist and the whitelist.
* For using create an object of it and call check() to test a sender address.
* You have to call load() after the settings in the config file was changed.
* @author Ulrich Weigelt <ulrich.weigelt@gmx.de>
*/
class SenderListFilter{
public:
/**
* Constructor
*/
SenderListFilter();
/**
* Destructor
*/
~SenderListFilter();
/**
* Checks the given sender whether it is listed in the blacklist or whitelist.
* @param sender sender which shall be checked
* @return appointed action (FActPass, FActDelete, FActMark, FActNone)
*/
FilterAction_Type check( TQString sender ) const;
/**
* Loads the setup from the application config file.
*/
void load();
/**
* Prints the settings.
*/
void print();
private:
/**
* Connector to the configuration file
*/
TDEConfig* config;
/**
* blacklisted addresses
*/
TQStringList blacklist;
/**
* whitelisted addresses
*/
TQStringList whitelist;
/**
* appointed action of the blacklist.
*/
FilterAction_Type blacklistAction;
protected:
/**
* Returns TRUE if the given list contains the sender or a part of it.
* e.g.: The list contains:
* Ulrich Weigelt
* spam@spamhouse.com
* "Lara Croft" <lara.croft@tombraider.com>
*
* This sender strings will cause a return value of TRUE:
* "Ulrich Weigelt" <ulrich.weigelt@gmx.de>
* "Spam King" <spam@spamhouse.com>
* spam@spamhouse.com
* lara.croft@tombraider.com
* "Lara Croft" <lara.croft@tombraider.com>
*
* @param list blacklist or whitelist
* @param sender searched sender name
* @return TRUE - the given sender name is listed. FALSE - is not listed
*/
bool search( TQStringList list, TQString sender ) const;
};
#endif
|