comparison src/context.cpp @ 148:9330b8d6a56b

add documentation fixes, allow env_from target of inherit
author carl
date Tue, 30 Jan 2007 16:27:49 -0800
parents 7278c9766e26
children 9581f6e62574
comparison
equal deleted inserted replaced
147:812c80305f26 148:9330b8d6a56b
570 return (i == rcpt_per_hour.end()) ? default_rcpt_rate : (*i).second; 570 return (i == rcpt_per_hour.end()) ? default_rcpt_rate : (*i).second;
571 } 571 }
572 572
573 573
574 char *CONTEXT::find_from(char *from) { 574 char *CONTEXT::find_from(char *from) {
575 char *rc = token_inherit; 575 char *rc = env_from_default;
576 string_map::iterator i = env_from.find(from); 576 string_map::iterator i = env_from.find(from);
577 if (i != env_from.end()) rc = (*i).second; // found user@domain key 577 if (i != env_from.end()) rc = (*i).second; // found user@domain key
578 else { 578 else {
579 char *x = strchr(from, '@'); 579 char *x = strchr(from, '@');
580 if (x) { 580 if (x) {
588 *x = y; 588 *x = y;
589 if (i != env_from.end()) rc = (*i).second; // found user@ key 589 if (i != env_from.end()) rc = (*i).second; // found user@ key
590 } 590 }
591 } 591 }
592 } 592 }
593 if (rc == token_inherit) rc = env_from_default;
594 if ((rc == token_inherit) && parent) return parent->find_from(from); 593 if ((rc == token_inherit) && parent) return parent->find_from(from);
595 return (rc == token_inherit) ? token_unknown : rc; 594 return (rc == token_inherit) ? token_unknown : rc;
596 } 595 }
597 596
598 597
1177 } 1176 }
1178 } 1177 }
1179 else { 1178 else {
1180 // may be a valid email address or domain name 1179 // may be a valid email address or domain name
1181 char *st = tok.next(); 1180 char *st = tok.next();
1182 if ((st == token_black) || (st == token_white) || (st == token_unknown)) { 1181 if ((st == token_white) || (st == token_black) || (st == token_unknown) || (st == token_inherit)) {
1183 me.add_from(have, st); 1182 me.add_from(have, st);
1184 } 1183 }
1185 else { 1184 else {
1186 CONTEXTP con = me.find_from_context_name(st); 1185 CONTEXTP con = me.find_from_context_name(st);
1187 if (con) { 1186 if (con) {
1188 me.add_from_context(have, con); 1187 me.add_from_context(have, con);
1189 } 1188 }
1190 else { 1189 else {
1191 tok.token_error("white/black/unknown or child context name", st); 1190 tok.token_error("white/black/unknown/inherit or child context name", st);
1192 return false; 1191 return false;
1193 } 1192 }
1194 } 1193 }
1195 } 1194 }
1196 } 1195 }