177 |
|
|
178 |
|
|
179 |
static void substitute(Mail_T *m, char *name, const char *event, |
static void substitute(Mail_T *m, char *name, const char *event, |
180 |
const char *action) { |
const char *action) { |
181 |
|
|
182 |
char host[STRLEN]; |
char host[STRLEN]; |
183 |
char *now= Util_getRFC822Date(NULL); |
char now[STRLEN]; |
184 |
|
|
185 |
ASSERT(m && name && event && action); |
ASSERT(m && name && event && action); |
186 |
|
|
187 |
|
Util_getRFC822Date(NULL, now, STRLEN); |
188 |
if(gethostname(host, sizeof(host)) < 0) { |
if(gethostname(host, sizeof(host)) < 0) { |
189 |
snprintf(host, STRLEN, "%s", LOCALHOST); |
snprintf(host, STRLEN, "%s", LOCALHOST); |
190 |
} |
} |
|
|
|
191 |
Util_replaceString(&(*m)->from, "$HOST", host); |
Util_replaceString(&(*m)->from, "$HOST", host); |
192 |
Util_replaceString(&(*m)->subject, "$DATE", now); |
Util_replaceString(&(*m)->subject, "$DATE", now); |
193 |
Util_replaceString(&(*m)->message, "$DATE", now); |
Util_replaceString(&(*m)->message, "$DATE", now); |
201 |
Util_replaceString(&(*m)->message, "$EVENT", event); |
Util_replaceString(&(*m)->message, "$EVENT", event); |
202 |
Util_replaceString(&(*m)->subject, "$ACTION", action); |
Util_replaceString(&(*m)->subject, "$ACTION", action); |
203 |
Util_replaceString(&(*m)->message, "$ACTION", action); |
Util_replaceString(&(*m)->message, "$ACTION", action); |
|
|
|
|
FREE(now); |
|
|
|
|
204 |
} |
} |
205 |
|
|
206 |
|
|