|
0
|
1 |
#ifndef VMAILMGR__CONFIG_RC__H__
|
|
|
2 |
#define VMAILMGR__CONFIG_RC__H__
|
|
|
3 |
|
|
|
4 |
#ifndef GLOBAL_CONFIG_DIR
|
|
|
5 |
#define GLOBAL_CONFIG_DIR "/etc/vmailmgr"
|
|
|
6 |
#endif
|
|
|
7 |
|
|
|
8 |
#ifndef LOCAL_CONFIG_DIR
|
|
|
9 |
#define LOCAL_CONFIG_DIR ".vmailmgr"
|
|
|
10 |
#endif
|
|
|
11 |
|
|
|
12 |
#include "mystring/mystring.h"
|
|
|
13 |
#include "misc/strlist.h"
|
|
|
14 |
|
|
|
15 |
template<class T>
|
|
|
16 |
struct config_cache
|
|
|
17 |
{
|
|
|
18 |
T* value;
|
|
|
19 |
config_cache() : value(0) { }
|
|
|
20 |
~config_cache() { delete value; }
|
|
|
21 |
};
|
|
|
22 |
|
|
|
23 |
class configuration
|
|
|
24 |
{
|
|
|
25 |
public:
|
|
|
26 |
configuration();
|
|
|
27 |
configuration(const configuration* prev, const mystring& dir);
|
|
|
28 |
~configuration();
|
|
|
29 |
|
|
|
30 |
configuration const * parent;
|
|
|
31 |
|
|
|
32 |
const mystring directory;
|
|
|
33 |
|
|
|
34 |
public: mystring autoresponse_dir() const;
|
|
|
35 |
private: config_cache<mystring> autoresponse_dir_cache;
|
|
|
36 |
public: mystring autoresponse_file() const;
|
|
|
37 |
private: config_cache<mystring> autoresponse_file_cache;
|
|
|
38 |
public: mystring bulletin_dir() const;
|
|
|
39 |
private: config_cache<mystring> bulletin_dir_cache;
|
|
|
40 |
public: unsigned default_expiry() const;
|
|
|
41 |
private: config_cache<unsigned> default_expiry_cache;
|
|
|
42 |
public: mystring default_maildir() const;
|
|
|
43 |
private: config_cache<mystring> default_maildir_cache;
|
|
|
44 |
public: unsigned default_msgcount() const;
|
|
|
45 |
private: config_cache<unsigned> default_msgcount_cache;
|
|
|
46 |
public: unsigned default_msgsize() const;
|
|
|
47 |
private: config_cache<unsigned> default_msgsize_cache;
|
|
|
48 |
public: unsigned default_hardquota() const;
|
|
|
49 |
private: config_cache<unsigned> default_hardquota_cache;
|
|
|
50 |
public: unsigned default_softquota() const;
|
|
|
51 |
private: config_cache<unsigned> default_softquota_cache;
|
|
|
52 |
public: mystring default_username() const;
|
|
|
53 |
private: config_cache<mystring> default_username_cache;
|
|
|
54 |
public: mystring error_maildir() const;
|
|
|
55 |
private: config_cache<mystring> error_maildir_cache;
|
|
|
56 |
public: mystring global_bulletin_dir() const;
|
|
|
57 |
private: config_cache<mystring> global_bulletin_dir_cache;
|
|
|
58 |
public: mystring maildir_arg_str() const;
|
|
|
59 |
private: config_cache<mystring> maildir_arg_str_cache;
|
|
|
60 |
public: mystring password_file() const;
|
|
|
61 |
private: config_cache<mystring> password_file_cache;
|
|
|
62 |
public: strlist postmaster_aliases() const;
|
|
|
63 |
private: config_cache<strlist> postmaster_aliases_cache;
|
|
|
64 |
public: mystring postmaster_email() const;
|
|
|
65 |
private: config_cache<mystring> postmaster_email_cache;
|
|
|
66 |
public: mystring qmail_root() const;
|
|
|
67 |
private: config_cache<mystring> qmail_root_cache;
|
|
|
68 |
public: mystring separators() const;
|
|
|
69 |
private: config_cache<mystring> separators_cache;
|
|
|
70 |
public: mystring socket_file() const;
|
|
|
71 |
private: config_cache<mystring> socket_file_cache;
|
|
|
72 |
public: mystring user_dir() const;
|
|
|
73 |
private: config_cache<mystring> user_dir_cache;
|
|
|
74 |
public: unsigned user_dir_bits() const;
|
|
|
75 |
private: config_cache<unsigned> user_dir_bits_cache;
|
|
|
76 |
public: unsigned user_dir_slices() const;
|
|
|
77 |
private: config_cache<unsigned> user_dir_slices_cache;
|
|
|
78 |
|
|
|
79 |
private:
|
|
|
80 |
mystring read_str(const mystring& name, const mystring& def,
|
|
|
81 |
config_cache<mystring>&) const;
|
|
|
82 |
mystring read_dir(const mystring& name, const mystring& def,
|
|
|
83 |
config_cache<mystring>&) const;
|
|
|
84 |
unsigned read_uns(const mystring& name, unsigned def,
|
|
|
85 |
config_cache<unsigned>&) const;
|
|
|
86 |
strlist read_list(const mystring& name, const strlist& def,
|
|
|
87 |
config_cache<strlist>&) const;
|
|
|
88 |
};
|
|
|
89 |
|
|
|
90 |
extern const configuration* config;
|
|
|
91 |
|
|
|
92 |
#endif
|