mailfilter  0.8.9
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;
54  unsigned time_out_val;
55  int max_size;
59  int rreg_type;
60  int verbosity;
61  int conn_type;
65  // These flags indicate whether a value was already set, or
66  // whether it's still set to the default values defined by the
67  // constructor.
70 public:
71  Preferences ();
72  static Preferences&
73  Instance ();
74  void init (void);
75  void kill (void);
76  bool open (const char*);
77  bool load (void);
78  void add_deny_rule (const char*,
79  const char*,
80  const char*);
81  void add_allow_rule (const char*,
82  const char*,
83  const char*);
84  void add_score (const char*,
85  int,
86  const char*,
87  const char*);
88  int neg_allows (void);
89  int neg_denies (void);
90  void set_rc_file (const char*);
91  string rc_file (void);
92  void set_log_file (const char*);
93  string log_file (void);
94  void set_verbose_level (int);
95  int verbose_level (void);
96  void set_headers_file (const char*);
97  string headers_file (void);
98  void set_default_case (const char*);
99  int default_case (void);
100  void set_reg_type (const char*);
101  int reg_type (void);
102  void set_server (const char*);
103  void set_usr (const char*);
104  void set_passwd (const char*);
105  void set_protocol (const char*);
106  void set_connection (unsigned int = POSIX_SOCKETS)
107  __attribute__ ((unused));
108  void set_port (unsigned int);
109  unsigned int time_out (void);
110  void set_time_out (unsigned int);
111  bool delete_duplicates (void);
112  void set_del_duplicates(const char*);
113  int max_size_allow (void);
114  void set_max_size_allow(int);
115  int max_size_deny (void);
116  void set_max_size_deny (int);
117  Size_score max_size_score (void);
118  void set_max_size_score(int, int);
119  int highscore (void);
120  void set_highscore (int);
121  bool normal (void);
122  void set_normal (const char*);
123  bool test_mode (void);
124  void set_test_mode (const char*);
125  int maxlength (void);
126  void set_maxlength (int);
127  bool ignore_time_stamp ();
128  void set_ignore_time_stamp (bool = true);
129  bool return_status (void);
130  void set_return_status (bool);
131  void set_skip_ssl_verify (bool);
132  bool skip_ssl_verify (void);
133  vector<Account>* accounts (void);
134  vector<Filter>* allow_filters (void);
135  vector<Filter>* deny_filters (void);
136  vector<Score>* score_filters (void);
137 };
138 
139 #endif
Definition: account.hh:33
Definition: preferences.hh:34
bool del_duplicates
Definition: preferences.hh:49
int rreg_type
Definition: preferences.hh:59
int max_size
Definition: preferences.hh:55
ifstream prefs_stream
Definition: preferences.hh:36
bool _skip_ssl_verify
Definition: preferences.hh:52
int high_score
Definition: preferences.hh:53
bool _ignore_time_stamp
Definition: preferences.hh:51
bool show_headers
Definition: preferences.hh:48
bool test_changed
Definition: preferences.hh:69
string prefs_file_name
Definition: preferences.hh:42
bool test
Definition: preferences.hh:47
int verbosity
Definition: preferences.hh:60
int max_size_friends
Definition: preferences.hh:57
bool ret_status
Definition: preferences.hh:50
bool verbosity_changed
Definition: preferences.hh:68
vector< Filter > denies
Definition: preferences.hh:38
int negative_scores
Definition: preferences.hh:64
string headers_file_name
Definition: preferences.hh:44
int max_line_length
Definition: preferences.hh:58
int negative_allows
Definition: preferences.hh:62
vector< Score > scores
Definition: preferences.hh:39
Account cur_account
Definition: preferences.hh:41
int negative_denies
Definition: preferences.hh:63
vector< Account > accnts
Definition: preferences.hh:40
Size_score size_score
Definition: preferences.hh:56
string log_file_name
Definition: preferences.hh:43
bool norm
Definition: preferences.hh:46
vector< Filter > allows
Definition: preferences.hh:37
int icase
Definition: preferences.hh:45
unsigned time_out_val
Definition: preferences.hh:54
int conn_type
Definition: preferences.hh:61
Definition: score.hh:27