Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

preferences.hh

Go to the documentation of this file.
00001 // preferences.hh - source file for the mailfilter program
00002 // Copyright (c) 2000 - 2004  Andreas Bauer <baueran@in.tum.de>
00003 //
00004 // This program is free software; you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation; either version 2 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00017 // USA.
00018 
00019 #ifndef PREFERENCES_HH
00020 #define PREFERENCES_HH
00021 
00022 #include <string>
00023 #include <vector>
00024 #include <fstream>
00025 #include "defines.hh"
00026 #include "socket.hh"
00027 #include "filter.hh"
00028 #include "score.hh"
00029 #include "account.hh"
00030 
00031 using namespace std;
00032 
00033 namespace pref
00034 {
00035   class Preferences
00036   {
00037   private:
00038     ifstream prefs_stream;
00039     vector<Filter>   allows;
00040     vector<Filter>   denies;
00041     vector<Score>    scores;
00042     vector<Account>  accnts;
00043     Account          cur_account;
00044     string           prefs_file_name;
00045     string           log_file_name;
00046     string           headers_file_name;
00047     int              icase;
00048     bool             norm;
00049     bool             test;
00050     bool             show_headers;
00051     bool             del_duplicates;
00052     bool             ret_status;
00053     int              high_score;
00054     unsigned int     time_out_val;
00055     int              max_size;
00056     Size_score       size_score;
00057     int              max_size_friends;
00058     int              max_line_length;
00059     int              rreg_type;
00060     int              verbosity;
00061     int              conn_type;
00062     int              negative_allows;
00063     int              negative_denies;
00064     int              negative_scores;
00065     
00066     // These flags indicate whether a value was already set, or
00067     // whether it's still set to the default values defined by the
00068     // constructor.
00069     bool             verbosity_changed;
00070     bool             test_changed;
00071 
00072   public:
00073     Preferences       (void);
00074     ~Preferences      (void);
00075     bool             open              (const char*);
00076     bool             load              (void);
00077     void             add_deny_rule     (const char*,
00078                     const char*,
00079                     const char*);
00080     void             add_allow_rule    (const char*,
00081                     const char*,
00082                     const char*);
00083     void             add_score         (const char*,
00084                     int,
00085                     const char*,
00086                     const char*);
00087     int              neg_allows        (void);
00088     int              neg_denies        (void);
00089     void             set_rc_file       (const char*);
00090     string           rc_file           (void);
00091     void             set_log_file      (const char*);
00092     string           log_file          (void);
00093     void             set_verbose_level (int);
00094     int              verbose_level     (void);
00095     void             set_headers_file  (const char*);
00096     string           headers_file      (void);
00097     void             set_default_case  (const char*);
00098     int              default_case      (void);
00099     void             set_reg_type      (const char*);
00100     int              reg_type          (void);
00101     void             set_server        (const char*);
00102     void             set_usr           (const char*);
00103     void             set_passwd        (const char*);
00104     void             set_protocol      (const char*);
00105     void             set_connection    (unsigned int = POSIX_SOCKETS)
00106                                           __attribute__ ((unused));
00107     void             set_port          (unsigned int);
00108     unsigned int     time_out          (void);
00109     void             set_time_out      (unsigned int);
00110     bool             delete_duplicates (void);
00111     void             set_del_duplicates (const char*);
00112     int              max_size_allow    (void);
00113     void             set_max_size_allow (int);
00114     int              max_size_deny     (void);
00115     void             set_max_size_deny (int);
00116     Size_score       max_size_score    (void);
00117     void             set_max_size_score(int,
00118                     int);
00119     int              highscore         (void);
00120     void             set_highscore     (int);
00121     bool             normal            (void);
00122     void             set_normal        (const char*);
00123     bool             test_mode         (void);
00124     void             set_test_mode     (const char*);
00125     int              maxlength         (void);
00126     void             set_maxlength     (int);
00127     bool             return_status     (void);
00128     void             set_return_status (bool);
00129     vector<Account>* accounts          (void);
00130     vector<Filter>*  allow_filters     (void);
00131     vector<Filter>*  deny_filters      (void);
00132     vector<Score>*   score_filters     (void);
00133   };
00134 }
00135 
00136 #endif

Generated on Sat Feb 14 18:38:55 2004 for mailfilter by doxygen 1.3.5