comparison src/sm-archive.cpp @ 7:5241a079fe03

initial version
author carl
date Fri, 10 Mar 2006 12:26:37 -0800
parents 01268466f0dc
children ed73e6361570
comparison
equal deleted inserted replaced
6:0b03e7656abf 7:5241a079fe03
174 mlfiPriv &priv = *MLFIPRIV; 174 mlfiPriv &priv = *MLFIPRIV;
175 priv.mailaddr = to_lower_string(from[0]); 175 priv.mailaddr = to_lower_string(from[0]);
176 return SMFIS_CONTINUE; 176 return SMFIS_CONTINUE;
177 } 177 }
178 178
179 void add_target(mlfiPriv &priv, SMFICTX *ctx, char *target);
180 void add_target(mlfiPriv &priv, SMFICTX *ctx, char *target)
181 {
182 if (target) {
183 smfi_addrcpt(ctx, target);
184 if (debug_syslog > 1) {
185 char msg[maxlen];
186 snprintf(msg, sizeof(msg), "adding recipient <%s>", target);
187 my_syslog(&priv, msg);
188 }
189 }
190 }
191
179 sfsistat mlfi_envrcpt(SMFICTX *ctx, char **rcpt) 192 sfsistat mlfi_envrcpt(SMFICTX *ctx, char **rcpt)
180 { 193 {
181 mlfiPriv &priv = *MLFIPRIV; 194 mlfiPriv &priv = *MLFIPRIV;
182 CONFIG &dc = *priv.pc; 195 CONFIG &dc = *priv.pc;
183 if (!priv.queueid) priv.queueid = strdup(smfi_getsymval(ctx, "i")); 196 if (!priv.queueid) priv.queueid = strdup(smfi_getsymval(ctx, "i"));
186 char msg[maxlen]; 199 char msg[maxlen];
187 snprintf(msg, sizeof(msg), "from <%s> to <%s>", priv.mailaddr, rcptaddr); 200 snprintf(msg, sizeof(msg), "from <%s> to <%s>", priv.mailaddr, rcptaddr);
188 my_syslog(&priv, msg); 201 my_syslog(&priv, msg);
189 } 202 }
190 char *target = dc.find_to(rcptaddr); 203 char *target = dc.find_to(rcptaddr);
191 if (target) smfi_addrcpt(ctx, target); 204 add_target(priv, ctx, target);
192 free(rcptaddr); 205 free(rcptaddr);
193 if (!priv.processed_from) { 206 if (!priv.processed_from) {
194 target = dc.find_from(priv.mailaddr); 207 target = dc.find_from(priv.mailaddr);
195 if (target) smfi_addrcpt(ctx, target); 208 add_target(priv, ctx, target);
196 priv.processed_from = true; 209 priv.processed_from = true;
197 } 210 }
198 return SMFIS_CONTINUE; 211 return SMFIS_CONTINUE;
199 } 212 }
200 213