Mercurial > sm-archive
comparison src/context.h @ 13:75e1a9bcbc2e
gpl3, add removal option for original recipients
author | carl |
---|---|
date | Sat, 25 Aug 2007 11:14:49 -0700 |
parents | 01268466f0dc |
children | b24369330483 |
comparison
equal
deleted
inserted
replaced
12:bb3d2cd6007e | 13:75e1a9bcbc2e |
---|---|
1 /* | |
2 | |
3 Copyright (c) 2007 Carl Byington - 510 Software Group, released under | |
4 the GPL version 3 or any later version at your choice available at | |
5 http://www.gnu.org/licenses/gpl-3.0.txt | |
6 | |
7 */ | |
1 #ifndef context_include | 8 #ifndef context_include |
2 #define context_include | 9 #define context_include |
3 | 10 |
4 #include "tokenizer.h" | 11 #include "tokenizer.h" |
5 #include <map> | 12 #include <map> |
14 int generation; | 21 int generation; |
15 time_t load_time; | 22 time_t load_time; |
16 string_set config_files; | 23 string_set config_files; |
17 string_map env_from; // map senders to archive mailboxes | 24 string_map env_from; // map senders to archive mailboxes |
18 string_map rcpt_to; // map recipients to archive mailboxes | 25 string_map rcpt_to; // map recipients to archive mailboxes |
26 string_set rcpt_remove; // remove these recipients | |
19 | 27 |
20 CONFIG(); | 28 CONFIG(); |
21 ~CONFIG(); | 29 ~CONFIG(); |
22 void add_from(char *from, char *target) {env_from[from] = target; }; | 30 void add_from(char *from, char *target) {env_from[from] = target; }; |
23 void add_to(char *to, char *target) {rcpt_to[to] = target; }; | 31 void add_to(char *to, char *target) {rcpt_to[to] = target; }; |
24 char * find_from(char *from) {return find(from, env_from);}; | 32 void add_remove(char *to) {rcpt_remove.insert(to); }; |
25 char * find_to(char *to) {return find(to, rcpt_to); }; | 33 char * find_from(char *from) {return find(from, env_from); }; |
34 char * find_to(char *to) {return find(to, rcpt_to); }; | |
35 bool find_remove(char *to) {return find(to, rcpt_remove); }; | |
36 bool find(char *needle, string_set &haystack); | |
26 char * find(char *needle, string_map &haystack); | 37 char * find(char *needle, string_map &haystack); |
27 void dump(); | 38 void dump(); |
28 }; | 39 }; |
29 | 40 |
30 extern char *token_envfrom; | 41 extern char *token_envfrom; |
31 extern char *token_include; | 42 extern char *token_include; |
32 extern char *token_lbrace; | 43 extern char *token_lbrace; |
33 extern char *token_rbrace; | 44 extern char *token_rbrace; |
34 extern char *token_rcptto; | 45 extern char *token_rcptto; |
46 extern char *token_remove; | |
35 extern char *token_semi; | 47 extern char *token_semi; |
36 | 48 |
37 extern string_set all_strings; // owns all the strings, only modified by the config loader thread | 49 extern string_set all_strings; // owns all the strings, only modified by the config loader thread |
38 | 50 |
39 void discard(string_set &s); | 51 void discard(string_set &s); |
40 char* register_string(string_set &s, char *name); | 52 char* register_string(string_set &s, char *name); |
41 char* register_string(char *name); | 53 char* register_string(char *name); |
54 void clear_strings(); | |
42 CONFIG *parse_config(char *fn); | 55 CONFIG *parse_config(char *fn); |
43 bool load_conf(CONFIG &dc, char *fn); | 56 bool load_conf(CONFIG &dc, char *fn); |
44 void token_init(); | 57 void token_init(); |
45 | 58 |
46 #endif | 59 #endif |