kmail

antispamconfig.h
1 /*
2  antispamconfig.h
3 
4  This file is part of KMail, the KDE mail client.
5  Copyright (c) 2004 Patrick Audley <paudley@blackcat.ca>
6  Copyright (c) 2004 Ingo Kloecker <kloecker@kde.org>
7 
8  KMail is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  KMail is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 
22  In addition, as a special exception, the copyright holders give
23  permission to link the code of this program with any edition of
24  the TQt library by Trolltech AS, Norway (or with modified versions
25  of TQt that use the same license as TQt), and distribute linked
26  combinations including the two. You must obey the GNU General
27  Public License in all respects for all of the code used other than
28  TQt. If you modify this file, you may extend this exception to
29  your version of the file, but you are not obligated to do so. If
30  you do not wish to do so, delete this exception statement from
31  your version.
32 */
33 
34 #ifndef __KMAIL_ANTISPAMCONFIG_H__
35 #define __KMAIL_ANTISPAMCONFIG_H__
36 
37 #include <tqvaluelist.h>
38 #include <tqregexp.h>
39 
40 class TQString;
41 class TQCString;
42 
43 namespace KMail {
44 
46  typedef enum {
53 
54  class SpamAgent {
55  public:
56  SpamAgent() : mType( SpamAgentNone ) {}
57  SpamAgent( const TQString & name, SpamAgentTypes type, const TQCString & field,
58  const TQRegExp & score, const TQRegExp & threshold )
59  : mName( name ), mType( type ), mField( field ),
60  mScore( score ), mThreshold( threshold ) {}
61 
62  TQString name() const { return mName; }
63  SpamAgentTypes scoreType() const { return mType; }
64  TQCString header() const { return mField; }
65  TQRegExp scorePattern() const { return mScore; }
66  TQRegExp thresholdPattern() const { return mThreshold; }
67 
68  private:
69  TQString mName;
70  SpamAgentTypes mType;
71  TQCString mField;
72  TQRegExp mScore;
73  TQRegExp mThreshold;
74  };
75  typedef TQValueList<SpamAgent> SpamAgents;
76  typedef TQValueListIterator<SpamAgent> SpamAgentsIterator;
77 
88  private:
89  static AntiSpamConfig * sSelf;
90 
91  AntiSpamConfig() {}
92 
93  public:
94  ~AntiSpamConfig() {}
95 
96  static AntiSpamConfig * instance();
97 
102  const SpamAgents agents() const { return mAgents; }
103  SpamAgents agents() { return mAgents; }
104 
110  const SpamAgents uniqueAgents() const;
111 
112  private:
113  SpamAgents mAgents;
114 
115  void readConfig();
116  };
117 
118 } // namespace KMail
119 
120 #endif // __KMAIL_ANTISPAMCONFIG_H__
Singleton to manage loading the kmail.antispamrc file.
const SpamAgents agents() const
Returns a list of all agents found on the system.
const SpamAgents uniqueAgents() const
Returns a list of unique agents, found on the system.
folderdiaquotatab.h
Definition: aboutdata.cpp:40
SpamAgentTypes
Valid types of SpamAgent.
@ SpamAgentFloatLarge
For straight percentages between 0.0 and 100.0.
@ SpamAgentBool
Simple Yes or No (Razor)
@ SpamAgentFloat
For straight percentages between 0.0 and 1.0 (BogoFilter)
@ SpamAgentNone
Invalid SpamAgent, skip this agent.
@ SpamAgentAdjustedFloat
Use this when we need to compare against a threshold (SpamAssasssin)