diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-01-02 22:37:49 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-01-02 22:38:13 +0200 |
commit | e113d685f81852992a08b5dabab93dd97f0fee59 (patch) | |
tree | 7bf55540c9aa51f80e8f0c38d33a8b2a6da25d42 /src/mail.c | |
parent | c44f0f83448b426935e9aeb07c5d761299144d14 (diff) | |
download | wydawca-e113d685f81852992a08b5dabab93dd97f0fee59.tar.gz wydawca-e113d685f81852992a08b5dabab93dd97f0fee59.tar.bz2 |
New email-related meta-variables.
These variables make it possible to avoid setting
`recipient' statement in `notify' blocks, instead
specifying recipients directly in the message
headers and using the default recipient setting, which
is `read'.
* src/mail.c (expand_email_admin)
(expand_email_owner): New functions.
* src/triplet.c (triplet_processor): Remove the
triplet if process_directives returns !0.
(expand_email_user): New function.
(triplet_meta): New keywords email:user (not to
be confused with user:email), email:admin and
email:owner.
* src/wydawca.h (expand_email_admin)
(expand_email_owner): New functions.
* NEWS, doc/wydawca.texi: Updated.
Diffstat (limited to 'src/mail.c')
-rw-r--r-- | src/mail.c | 45 |
1 files changed, 45 insertions, 0 deletions
@@ -682,6 +682,51 @@ notify (struct notification *notification_list, for (p = notification_list; p; p = p->next) if (p->ev == ev) do_notify (trp, ev, p); /* FIXME */ } + +const char * +expand_email_admin (struct metadef *def, void *data) +{ + size_t size; + if (mu_address_to_string (admin_address, NULL, 0, &size) == 0) + { + size++; + def->storage = xmalloc (size); + mu_address_to_string (admin_address, def->storage, size, NULL); + def->value = def->storage; + } + else + def->value = ""; + return def->value; +} + +const char * +expand_email_owner (struct metadef *def, void *data) +{ + struct file_triplet *trp = data; + mu_address_t addr; + const char *errp; + size_t size; + + addr = get_recipient (trp->spool->dictionary[project_owner_dict], + trp, &errp); + if (!addr) + { + logmsg (LOG_ERR, _("cannot get email of the %s's owner: %s"), + trp->project, gettext (errp)); + def->value = ""; + } + else if (mu_address_to_string (addr, NULL, 0, &size) == 0) + { + size++; + def->storage = xmalloc (size); + mu_address_to_string (addr, def->storage, size, NULL); + def->value = def->storage; + mu_address_destroy (&addr); + } + else + def->value = ""; + return def->value; +} |