Mercurial > sm-archive
view src/context.h @ 8:ed73e6361570 stable-1-0
initial version
author | carl |
---|---|
date | Fri, 10 Mar 2006 12:55:07 -0800 |
parents | 01268466f0dc |
children | 75e1a9bcbc2e |
line wrap: on
line source
#ifndef context_include #define context_include #include "tokenizer.h" #include <map> typedef map<char *, char *, ltstr> string_map; struct CONFIG { // the only mutable stuff once it has been loaded from the config file int reference_count; // protected by the global config_mutex // all the rest is constant after loading from the config file int generation; time_t load_time; string_set config_files; string_map env_from; // map senders to archive mailboxes string_map rcpt_to; // map recipients to archive mailboxes CONFIG(); ~CONFIG(); void add_from(char *from, char *target) {env_from[from] = target; }; void add_to(char *to, char *target) {rcpt_to[to] = target; }; char * find_from(char *from) {return find(from, env_from);}; char * find_to(char *to) {return find(to, rcpt_to); }; char * find(char *needle, string_map &haystack); void dump(); }; extern char *token_envfrom; extern char *token_include; extern char *token_lbrace; extern char *token_rbrace; extern char *token_rcptto; extern char *token_semi; extern string_set all_strings; // owns all the strings, only modified by the config loader thread void discard(string_set &s); char* register_string(string_set &s, char *name); char* register_string(char *name); CONFIG *parse_config(char *fn); bool load_conf(CONFIG &dc, char *fn); void token_init(); #endif