mailfilter  0.8.3
preferences.hh
Go to the documentation of this file.
1 // preferences.hh - source file for the mailfilter program
2 // Copyright (c) 2000 - 2009 Andreas Bauer <baueran@gmail.com>
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 // USA.
18 
19 #ifndef PREFERENCES_HH
20 #define PREFERENCES_HH
21 
22 #include <string>
23 #include <vector>
24 #include <fstream>
25 #include "defines.hh"
26 #include "socket.hh"
27 #include "filter.hh"
28 #include "score.hh"
29 #include "account.hh"
30 
31 using namespace std;
32 
34 {
35 protected:
36  ifstream prefs_stream;
37  vector<Filter> allows;
38  vector<Filter> denies;
39  vector<Score> scores;
40  vector<Account> accnts;
43  string log_file_name;
45  int icase;
46  bool norm;
47  bool test;
50  bool ret_status;
53  unsigned time_out_val;
54  int max_size;
58  int rreg_type;
59  int verbosity;
60  int conn_type;
64  // These flags indicate whether a value was already set, or
65  // whether it's still set to the default values defined by the
66  // constructor.
69 public:
70  Preferences ();
71  static Preferences&
72  Instance ();
73  void init (void);
74  void kill (void);
75  bool open (const char*);
76  bool load (void);
77  void add_deny_rule (const char*,
78  const char*,
79  const char*);
80  void add_allow_rule (const char*,
81  const char*,
82  const char*);
83  void add_score (const char*,
84  int,
85  const char*,
86  const char*);
87  int neg_allows (void);
88  int neg_denies (void);
89  void set_rc_file (const char*);
90  string rc_file (void);
91  void set_log_file (const char*);
92  string log_file (void);
93  void set_verbose_level (int);
94  int verbose_level (void);
95  void set_headers_file (const char*);
96  string headers_file (void);
97  void set_default_case (const char*);
98  int default_case (void);
99  void set_reg_type (const char*);
100  int reg_type (void);
101  void set_server (const char*);
102  void set_usr (const char*);
103  void set_passwd (const char*);
104  void set_protocol (const char*);
105  void set_connection (unsigned int = POSIX_SOCKETS)
106  __attribute__ ((unused));
107  void set_port (unsigned int);
108  unsigned int time_out (void);
109  void set_time_out (unsigned int);
110  bool delete_duplicates (void);
111  void set_del_duplicates(const char*);
112  int max_size_allow (void);
113  void set_max_size_allow(int);
114  int max_size_deny (void);
115  void set_max_size_deny (int);
116  Size_score max_size_score (void);
117  void set_max_size_score(int, int);
118  int highscore (void);
119  void set_highscore (int);
120  bool normal (void);
121  void set_normal (const char*);
122  bool test_mode (void);
123  void set_test_mode (const char*);
124  int maxlength (void);
125  void set_maxlength (int);
126  bool ignore_time_stamp ();
127  void set_ignore_time_stamp (bool = true);
128  bool return_status (void);
129  void set_return_status (bool);
130  vector<Account>* accounts (void);
131  vector<Filter>* allow_filters (void);
132  vector<Filter>* deny_filters (void);
133  vector<Score>* score_filters (void);
134 };
135 
136 #endif
int negative_scores
Definition: preferences.hh:63
vector< Account > accnts
Definition: preferences.hh:40
bool test_changed
Definition: preferences.hh:68
int max_line_length
Definition: preferences.hh:57
int max_size
Definition: preferences.hh:54
bool _ignore_time_stamp
Definition: preferences.hh:51
Account cur_account
Definition: preferences.hh:41
bool verbosity_changed
Definition: preferences.hh:67
string log_file_name
Definition: preferences.hh:43
vector< Filter > denies
Definition: preferences.hh:38
ifstream prefs_stream
Definition: preferences.hh:36
int negative_denies
Definition: preferences.hh:62
#define const
Definition: getopt.c:38
Definition: filter.hh:35
Definition: score.hh:33
int conn_type
Definition: preferences.hh:60
vector< Filter > allows
Definition: preferences.hh:37
int negative_allows
Definition: preferences.hh:61
int max_size_friends
Definition: preferences.hh:56
int verbosity
Definition: preferences.hh:59
int rreg_type
Definition: preferences.hh:58
string prefs_file_name
Definition: preferences.hh:42
bool norm
Definition: preferences.hh:46
bool del_duplicates
Definition: preferences.hh:49
bool show_headers
Definition: preferences.hh:48
bool ret_status
Definition: preferences.hh:50
Size_score size_score
Definition: preferences.hh:55
bool test
Definition: preferences.hh:47
Definition: account.hh:32
string headers_file_name
Definition: preferences.hh:44
unsigned time_out_val
Definition: preferences.hh:53
Definition: preferences.hh:33
int high_score
Definition: preferences.hh:52
vector< Score > scores
Definition: preferences.hh:39
Definition: score.hh:26
int icase
Definition: preferences.hh:45