comparison src/context.cpp @ 3:01268466f0dc

initial version
author carl
date Fri, 10 Mar 2006 11:00:12 -0800
parents 616666e2f34c
children 61a4e8773e2e
comparison
equal deleted inserted replaced
2:32b57406b656 3:01268466f0dc
20 #include <sys/un.h> 20 #include <sys/un.h>
21 21
22 static char* context_version="$Id$"; 22 static char* context_version="$Id$";
23 23
24 char *token_envfrom; 24 char *token_envfrom;
25 char *token_include;
25 char *token_lbrace; 26 char *token_lbrace;
26 char *token_rbrace; 27 char *token_rbrace;
27 char *token_rcptto; 28 char *token_rcptto;
28 char *token_semi; 29 char *token_semi;
29 30
39 40
40 CONFIG::~CONFIG() { 41 CONFIG::~CONFIG() {
41 } 42 }
42 43
43 44
44 char *CONFIG::find(char *needle, &string_map haystack) { 45 char *CONFIG::find(char *needle, string_map &haystack) {
45 string_map::iterator i = haystack.find(needle); 46 string_map::iterator i = haystack.find(needle);
46 if (i != haystack.end()) return (*i).second; // found user@domain.tld key 47 if (i != haystack.end()) return (*i).second; // found user@domain.tld key
47 char *x = strchr(needle, '@'); 48 char *x = strchr(needle, '@');
48 if (x) { 49 if (x) {
49 x++; 50 x++;
180 tok.token_error("load_conf() failed to parse rcpt_to"); 181 tok.token_error("load_conf() failed to parse rcpt_to");
181 return false; 182 return false;
182 } 183 }
183 } 184 }
184 else { 185 else {
185 tok.token_error(token_context, have); 186 tok.token_error("env_from/rcpt_to", have);
186 return false; 187 return false;
187 } 188 }
188 } 189 }
189 return true; 190 return true;
190 } 191 }
193 //////////////////////////////////////////////// 194 ////////////////////////////////////////////////
194 // init the tokens 195 // init the tokens
195 // 196 //
196 void token_init() { 197 void token_init() {
197 token_envfrom = register_string("env_from"); 198 token_envfrom = register_string("env_from");
199 token_include = register_string("include");
198 token_lbrace = register_string("{"); 200 token_lbrace = register_string("{");
199 token_rbrace = register_string("}"); 201 token_rbrace = register_string("}");
200 token_rcptto = register_string("rcpt_to"); 202 token_rcptto = register_string("rcpt_to");
201 token_semi = register_string(";"); 203 token_semi = register_string(";");
202 } 204 }