diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-02-16 16:17:03 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-02-16 16:23:53 +0200 |
commit | 6cfe6f8fe1b7506e772403fecc9d7298fc52dc74 (patch) | |
tree | 64e579d8895bfecfadceb9914f9f795d75e4ccbb /src/mail.c | |
parent | 98ca4bb1bc96cc95bdd141cb653b17029957de38 (diff) | |
download | wydawca-6cfe6f8fe1b7506e772403fecc9d7298fc52dc74.tar.gz wydawca-6cfe6f8fe1b7506e772403fecc9d7298fc52dc74.tar.bz2 |
Improve keyword (meta) expansion, add testsuite framework
* src/meta.c: New file.
* src/Makefile.am (wydawca_SOURCES): Add meta.c.
* Makefile.am (SUBDIRS): Add tests.
* configure.ac: Initialize testsuite.
* src/cmdline.opt: Add preprocessor-related options: --[no-]preprocessor,
-E
* src/mail.c, src/triplet.c, src/verify.c, src/wydawca.c, src/wydawca.h: Use
new expansion functions.
* src/update-2.0.awk: Replace % markup with $.
* etc/wydawca.rc: Switch to new meta-variable syntax.
* gnulib.modules: Add c-ctype.
* doc/Makefile.am (check-options): Rewrite.
* doc/wydawca.texi: Mark unrevised/obsolete material.
* tests/: New directory
Diffstat (limited to 'src/mail.c')
-rw-r--r-- | src/mail.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -215,7 +215,7 @@ register_notification (const struct notification *notif) void mail_stats () { - struct kw_expansion exp[MAX_STAT + 1]; + struct metadef exp[MAX_STAT + 2]; time_t t; const char *tmpl; char *text; @@ -238,10 +238,10 @@ mail_stats () return; time (&t); + memset (exp, 0, sizeof (exp)); exp[0].kw = "date"; - exp[0].value = xstrdup (ctime (&t)); + exp[0].value = exp[0].storage = xstrdup (ctime (&t)); exp[0].value [strlen (exp[0].value) - 1] = 0; - exp[0].expand = NULL; make_stat_expansion (exp + 1); @@ -252,13 +252,12 @@ mail_stats () admin_stat_message); return; } - text = expand_param (tmpl, - exp, sizeof (exp) / sizeof (exp[0]), NULL); + text = meta_expand_string (tmpl, exp, NULL); mail_send_message (admin_address, text); free (text); - free_kwexp (exp, sizeof (exp) / sizeof (exp[0])); + meta_free (exp); } mu_address_t @@ -266,7 +265,7 @@ get_recipient (struct access_method *method, struct file_triplet *trp, char **errp) { unsigned nrows, ncols, i; - struct kw_expansion kwexp[4]; + struct metadef def[5]; mu_address_t rcpt = NULL; char *text; int rc; @@ -283,10 +282,11 @@ get_recipient (struct access_method *method, struct file_triplet *trp, return NULL; } - make_default_kwexp (kwexp, trp->user, trp->project); - escape_kwexp (method, kwexp, NITEMS (kwexp)); - text = expand_param (method->param[1], kwexp, NITEMS (kwexp), NULL); - + make_default_meta (def, trp->user, trp->project); + meta_escape (method, def); + text = meta_expand_string (method->param[1], def, NULL); + meta_free (def); + rc = method_run (method, text); free (text); if (rc) |