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 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>mailfilter: Preferences.hh Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.8 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a></div>
<h1>Preferences.hh</h1><a href="Preferences_8hh.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">// Preferences.hh - source file for the mailfilter program</span>
00002 <span class="comment">// Copyright (c) 2000 - 2004 Andreas Bauer <baueran@in.tum.de></span>
00003 <span class="comment">//</span>
00004 <span class="comment">// This program is free software; you can redistribute it and/or modify</span>
00005 <span class="comment">// it under the terms of the GNU General Public License as published by</span>
00006 <span class="comment">// the Free Software Foundation; either version 2 of the License, or</span>
00007 <span class="comment">// (at your option) any later version.</span>
00008 <span class="comment">//</span>
00009 <span class="comment">// This program is distributed in the hope that it will be useful,</span>
00010 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
00011 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
00012 <span class="comment">// GNU General Public License for more details.</span>
00013 <span class="comment">//</span>
00014 <span class="comment">// You should have received a copy of the GNU General Public License</span>
00015 <span class="comment">// along with this program; if not, write to the Free Software</span>
00016 <span class="comment">// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,</span>
00017 <span class="comment">// USA.</span>
00018
00019 <span class="preprocessor">#ifndef PREFERENCES_HH</span>
00020 <span class="preprocessor"></span><span class="preprocessor">#define PREFERENCES_HH</span>
00021 <span class="preprocessor"></span>
00022 <span class="preprocessor">#include <string></span>
00023 <span class="preprocessor">#include <vector></span>
00024 <span class="preprocessor">#include <list></span>
00025 <span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
00026 <span class="preprocessor">#include <sys/types.h></span>
00027 <span class="preprocessor">#include <regex.h></span>
00028 }
00029 <span class="preprocessor">#include "<a class="code" href="RegExp_8hh.html">RegExp.hh</a>"</span>
00030 <span class="preprocessor">#include "<a class="code" href="mailfilter_8hh.html">mailfilter.hh</a>"</span>
00031
00032 <span class="comment">// Filter modes</span>
<a name="l00033"></a><a class="code" href="Preferences_8hh.html#a0">00033</a> <span class="preprocessor">#define CASE_DEFAULT 0</span>
<a name="l00034"></a><a class="code" href="Preferences_8hh.html#a1">00034</a> <span class="preprocessor"></span><span class="preprocessor">#define CASE_SENSITIVE 1</span>
<a name="l00035"></a><a class="code" href="Preferences_8hh.html#a2">00035</a> <span class="preprocessor"></span><span class="preprocessor">#define CASE_INSENSITIVE 2</span>
00036 <span class="preprocessor"></span>
00037 <span class="comment">// Verbose levels</span>
<a name="l00038"></a><a class="code" href="Preferences_8hh.html#a3">00038</a> <span class="preprocessor">#define MIN_VERBOSE 0</span>
<a name="l00039"></a><a class="code" href="Preferences_8hh.html#a4">00039</a> <span class="preprocessor"></span><span class="preprocessor">#define MAX_VERBOSE 6</span>
00040 <span class="preprocessor"></span>
00041 <span class="keyword">using</span> <span class="keyword">namespace </span>std;
00042
00043 <span class="keyword">namespace </span>pref {
00044
<a name="l00045"></a><a class="code" href="structpref_1_1serverInfo.html">00045</a> <span class="keyword">struct </span><a class="code" href="structpref_1_1serverInfo.html">serverInfo</a> {
<a name="l00046"></a><a class="code" href="structpref_1_1serverInfo.html#o0">00046</a> string <a class="code" href="structpref_1_1serverInfo.html#o0">name</a>;
<a name="l00047"></a><a class="code" href="structpref_1_1serverInfo.html#o1">00047</a> string <a class="code" href="structpref_1_1serverInfo.html#o1">user</a>;
<a name="l00048"></a><a class="code" href="structpref_1_1serverInfo.html#o2">00048</a> string <a class="code" href="structpref_1_1serverInfo.html#o2">pass</a>;
<a name="l00049"></a><a class="code" href="structpref_1_1serverInfo.html#o3">00049</a> <span class="keywordtype">int</span> <a class="code" href="structpref_1_1serverInfo.html#o3">protocol</a>;
<a name="l00050"></a><a class="code" href="structpref_1_1serverInfo.html#o4">00050</a> <span class="keywordtype">int</span> <a class="code" href="structpref_1_1serverInfo.html#o4">port</a>;
00051 };
00052
00053
<a name="l00054"></a><a class="code" href="structpref_1_1filterInfo.html">00054</a> <span class="keyword">struct </span><a class="code" href="structpref_1_1filterInfo.html">filterInfo</a> {
<a name="l00055"></a><a class="code" href="structpref_1_1filterInfo.html#o0">00055</a> string <a class="code" href="structpref_1_1filterInfo.html#o0">filter</a>; <span class="comment">// Filter as ordinary string object</span>
<a name="l00056"></a><a class="code" href="structpref_1_1filterInfo.html#o1">00056</a> <span class="keywordtype">int</span> <a class="code" href="structpref_1_1filterInfo.html#o1">case_sensitive</a>; <span class="comment">// Values can be { CASE_SENSITIVE | CASE_INSENSITIVE | CASE_DEFAULT }</span>
00057
00058 <span class="comment">// Negative filters</span>
<a name="l00059"></a><a class="code" href="structpref_1_1filterInfo.html#o2">00059</a> <span class="keywordtype">bool</span> <a class="code" href="structpref_1_1filterInfo.html#o2">negative</a>; <span class="comment">// true if filter is of type 'DENY<>myaddress@something.com', otherwise false</span>
00060
<a name="l00061"></a><a class="code" href="structpref_1_1filterInfo.html#o3">00061</a> regex_t <a class="code" href="structpref_1_1filterInfo.html#o3">cFilter</a>; <span class="comment">// Compiled filter</span>
00062 };
00063
00064
<a name="l00065"></a><a class="code" href="structpref_1_1friendInfo.html">00065</a> <span class="keyword">struct </span><a class="code" href="structpref_1_1friendInfo.html">friendInfo</a> {
<a name="l00066"></a><a class="code" href="structpref_1_1friendInfo.html#o0">00066</a> string <a class="code" href="structpref_1_1friendInfo.html#o0">filter</a>;
<a name="l00067"></a><a class="code" href="structpref_1_1friendInfo.html#o1">00067</a> regex_t <a class="code" href="structpref_1_1friendInfo.html#o1">cFilter</a>;
00068 };
00069
00070
<a name="l00071"></a><a class="code" href="structpref_1_1scoreInfo.html">00071</a> <span class="keyword">struct </span><a class="code" href="structpref_1_1scoreInfo.html">scoreInfo</a> {
<a name="l00072"></a><a class="code" href="structpref_1_1scoreInfo.html#o0">00072</a> string <a class="code" href="structpref_1_1scoreInfo.html#o0">filter</a>;
<a name="l00073"></a><a class="code" href="structpref_1_1scoreInfo.html#o1">00073</a> <span class="keywordtype">int</span> <a class="code" href="structpref_1_1scoreInfo.html#o1">score</a>;
<a name="l00074"></a><a class="code" href="structpref_1_1scoreInfo.html#o2">00074</a> <span class="keywordtype">int</span> <a class="code" href="structpref_1_1scoreInfo.html#o2">case_sensitive</a>;
<a name="l00075"></a><a class="code" href="structpref_1_1scoreInfo.html#o3">00075</a> <span class="keywordtype">bool</span> <a class="code" href="structpref_1_1scoreInfo.html#o3">negative</a>;
<a name="l00076"></a><a class="code" href="structpref_1_1scoreInfo.html#o4">00076</a> regex_t <a class="code" href="structpref_1_1scoreInfo.html#o4">cFilter</a>;
00077 };
00078
00079
<a name="l00080"></a><a class="code" href="structpref_1_1Size__score.html">00080</a> <span class="keyword">struct </span><a class="code" href="structpref_1_1Size__score.html">Size_score</a>{
<a name="l00081"></a><a class="code" href="structpref_1_1Size__score.html#o0">00081</a> <span class="keywordtype">int</span> <a class="code" href="structpref_1_1Size__score.html#o0">score</a>;
<a name="l00082"></a><a class="code" href="structpref_1_1Size__score.html#o1">00082</a> <span class="keywordtype">int</span> <a class="code" href="structpref_1_1Size__score.html#o1">size</a>;
00083 };
00084
00085
<a name="l00086"></a><a class="code" href="classpref_1_1Preferences.html">00086</a> <span class="keyword">class </span><a class="code" href="classpref_1_1Preferences.html">Preferences</a> {
00087 <span class="keyword">private</span>:
00088 <span class="comment">// Variables</span>
00089 vector<serverInfo> servers;
00090 vector<filterInfo> filters;
00091 vector<friendInfo> friends;
00092 vector<scoreInfo> scores;
00093 <a class="code" href="structpref_1_1serverInfo.html">serverInfo</a> popServer;
00094 <a class="code" href="structpref_1_1Size__score.html">Size_score</a> size_score;
00095 string logfile;
00096 string file;
00097 <span class="keywordtype">int</span> highscore;
00098 <span class="keywordtype">int</span> maxsize;
00099 <span class="keywordtype">int</span> maxsizeFriends;
00100 <span class="keywordtype">bool</span> icase;
00101 <span class="keywordtype">bool</span> normal;
00102 <span class="keywordtype">int</span> regType;
00103 <span class="keywordtype">int</span> regNewline;
00104 <span class="keywordtype">int</span> verboseLevel;
00105 <span class="keywordtype">int</span> timeOut;
00106 <span class="keywordtype">bool</span> test;
00107 <span class="keywordtype">bool</span> showHeaders;
00108 <span class="keywordtype">bool</span> delDuplicates;
00109 <span class="keywordtype">bool</span> compiled;
00110 <span class="keywordtype">int</span> maxLineLength;
00111 <a class="code" href="classre_1_1RegExp.html">re::RegExp</a> regExp;
00112
00113 <span class="comment">// Private function(s)</span>
00114 <span class="keywordtype">int</span> cmpNoCase(<span class="keyword">const</span> string&, <span class="keyword">const</span> string&);
00115
00116 <span class="keyword">public</span>:
00117 <a class="code" href="classpref_1_1Preferences.html#a0">Preferences</a>(<span class="keyword">const</span> string&);
00118 <a class="code" href="classpref_1_1Preferences.html#a1">~Preferences</a>();
00119
00120 <span class="keyword">const</span> vector<serverInfo>& <a class="code" href="classpref_1_1Preferences.html#a2">getServers</a>(<span class="keywordtype">void</span>);
00121 <span class="keywordtype">int</span> <a class="code" href="classpref_1_1Preferences.html#a3">getMaxsize</a>(<span class="keywordtype">void</span>);
00122 <span class="keywordtype">int</span> <a class="code" href="classpref_1_1Preferences.html#a4">getMaxsizeFriends</a>(<span class="keywordtype">void</span>);
00123 <span class="keywordtype">bool</span> <a class="code" href="classpref_1_1Preferences.html#a5">getIcase</a>(<span class="keywordtype">void</span>);
00124 <span class="keywordtype">bool</span> <a class="code" href="classpref_1_1Preferences.html#a6">isNormal</a>(<span class="keywordtype">void</span>);
00125 <span class="keywordtype">int</span> <a class="code" href="classpref_1_1Preferences.html#a7">getVerboseLevel</a>(<span class="keywordtype">void</span>);
00126 <span class="keywordtype">void</span> <a class="code" href="classpref_1_1Preferences.html#a8">setVerboseLevel</a>(<span class="keywordtype">int</span>);
00127 <span class="keyword">const</span> string& <a class="code" href="classpref_1_1Preferences.html#a9">getLogfile</a>(<span class="keywordtype">void</span>);
00128 <span class="keywordtype">void</span> <a class="code" href="classpref_1_1Preferences.html#a10">setLogfile</a>(<span class="keyword">const</span> string&);
00129 vector<filterInfo>* <a class="code" href="classpref_1_1Preferences.html#a11">getFilters</a>(<span class="keywordtype">void</span>);
00130 vector<friendInfo>* <a class="code" href="classpref_1_1Preferences.html#a12">getFriends</a>(<span class="keywordtype">void</span>);
00131 vector<scoreInfo>* <a class="code" href="classpref_1_1Preferences.html#a13">getScores</a>(<span class="keywordtype">void</span>);
00132 <span class="keywordtype">int</span> <a class="code" href="classpref_1_1Preferences.html#a14">getRegType</a>(<span class="keywordtype">void</span>);
00133 <span class="keywordtype">int</span> <a class="code" href="classpref_1_1Preferences.html#a15">getRegNewline</a>(<span class="keywordtype">void</span>);
00134 <span class="keywordtype">bool</span> <a class="code" href="classpref_1_1Preferences.html#a16">getTestMode</a>(<span class="keywordtype">void</span>);
00135 <span class="keywordtype">void</span> <a class="code" href="classpref_1_1Preferences.html#a17">setTestMode</a>(<span class="keywordtype">bool</span>);
00136 <span class="keywordtype">bool</span> <a class="code" href="classpref_1_1Preferences.html#a18">getDelDubs</a>(<span class="keywordtype">void</span>);
00137 <span class="keywordtype">bool</span> <a class="code" href="classpref_1_1Preferences.html#a19">getShowHeaders</a>(<span class="keywordtype">void</span>);
00138 <span class="keywordtype">int</span> <a class="code" href="classpref_1_1Preferences.html#a20">getMaxLineLength</a>(<span class="keywordtype">void</span>);
00139 <span class="keywordtype">void</span> <a class="code" href="classpref_1_1Preferences.html#a21">showErrorDeprecated</a>(<span class="keyword">const</span> string&);
00140 <span class="keywordtype">void</span> <a class="code" href="classpref_1_1Preferences.html#a22">showErrorParameter</a>(<span class="keyword">const</span> string&, <span class="keyword">const</span> string&, <span class="keyword">const</span> string&);
00141 <span class="keywordtype">void</span> <a class="code" href="classpref_1_1Preferences.html#a22">showErrorParameter</a>(<span class="keyword">const</span> string&, <span class="keyword">const</span> string&, <span class="keywordtype">int</span>);
00142 <span class="keywordtype">int</span> <a class="code" href="classpref_1_1Preferences.html#a24">getTimeOut</a>(<span class="keywordtype">void</span>);
00143 <span class="keywordtype">void</span> <a class="code" href="classpref_1_1Preferences.html#a25">setTimeOut</a>(<span class="keywordtype">int</span>);
00144 <span class="keywordtype">int</span> <a class="code" href="classpref_1_1Preferences.html#a26">getHighscore</a>(<span class="keywordtype">void</span>);
00145 <span class="keywordtype">void</span> <a class="code" href="classpref_1_1Preferences.html#a27">setHighscore</a>(<span class="keywordtype">int</span>);
00146 <span class="keywordtype">void</span> <a class="code" href="classpref_1_1Preferences.html#a28">keyword</a>(<span class="keyword">const</span> string, <span class="keyword">const</span> string, <span class="keyword">const</span> string);
00147 <span class="keywordtype">void</span> <a class="code" href="classpref_1_1Preferences.html#a28">keyword</a>(<span class="keyword">const</span> string, <span class="keyword">const</span> string, <span class="keywordtype">int</span>);
00148 <span class="keywordtype">void</span> <a class="code" href="classpref_1_1Preferences.html#a28">keyword</a>(<span class="keyword">const</span> string, <span class="keywordtype">int</span>, <span class="keyword">const</span> string, <span class="keyword">const</span> string);
00149 <span class="keywordtype">int</span> <a class="code" href="classpref_1_1Preferences.html#a31">precompileExpressions</a>(<span class="keywordtype">void</span>);
00150 <span class="keywordtype">void</span> <a class="code" href="classpref_1_1Preferences.html#a32">setCompiled</a>(<span class="keywordtype">bool</span>);
00151 <span class="keywordtype">bool</span> <a class="code" href="classpref_1_1Preferences.html#a33">getCompiled</a>(<span class="keywordtype">void</span>);
00152 <a class="code" href="structpref_1_1Size__score.html">Size_score</a> <a class="code" href="classpref_1_1Preferences.html#a34">getMaxSizeScore</a>(<span class="keywordtype">void</span>);
00153 };
00154
00155 <span class="comment">// Exceptions</span>
<a name="l00156"></a><a class="code" href="classpref_1_1MalformedPrefsFile.html">00156</a> <span class="keyword">class </span><a class="code" href="classpref_1_1MalformedPrefsFile.html">MalformedPrefsFile</a> { };
<a name="l00157"></a><a class="code" href="classpref_1_1IOException.html">00157</a> <span class="keyword">class </span><a class="code" href="classpref_1_1IOException.html">IOException</a> { };
<a name="l00158"></a><a class="code" href="classpref_1_1RegExException.html">00158</a> <span class="keyword">class </span><a class="code" href="classpref_1_1RegExException.html">RegExException</a> { };
00159 }
00160
00161 <span class="preprocessor">#endif</span>
</div></pre><hr size="1"><address style="align: right;"><small>Generated on Sun Aug 8 15:22:26 2004 for mailfilter by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address>
</body>
</html>
|