aboutsummaryrefslogtreecommitdiff
path: root/src/mail.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-01-02 22:37:49 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2010-01-02 22:38:13 +0200
commite113d685f81852992a08b5dabab93dd97f0fee59 (patch)
tree7bf55540c9aa51f80e8f0c38d33a8b2a6da25d42 /src/mail.c
parentc44f0f83448b426935e9aeb07c5d761299144d14 (diff)
downloadwydawca-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.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mail.c b/src/mail.c
index 3328850..39dfe08 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -685,3 +685,48 @@ notify (struct notification *notification_list,
685 do_notify (trp, ev, p); 685 do_notify (trp, ev, p);
686 /* FIXME */ 686 /* FIXME */
687} 687}
688
689const char *
690expand_email_admin (struct metadef *def, void *data)
691{
692 size_t size;
693 if (mu_address_to_string (admin_address, NULL, 0, &size) == 0)
694 {
695 size++;
696 def->storage = xmalloc (size);
697 mu_address_to_string (admin_address, def->storage, size, NULL);
698 def->value = def->storage;
699 }
700 else
701 def->value = "";
702 return def->value;
703}
704
705const char *
706expand_email_owner (struct metadef *def, void *data)
707{
708 struct file_triplet *trp = data;
709 mu_address_t addr;
710 const char *errp;
711 size_t size;
712
713 addr = get_recipient (trp->spool->dictionary[project_owner_dict],
714 trp, &errp);
715 if (!addr)
716 {
717 logmsg (LOG_ERR, _("cannot get email of the %s's owner: %s"),
718 trp->project, gettext (errp));
719 def->value = "";
720 }
721 else if (mu_address_to_string (addr, NULL, 0, &size) == 0)
722 {
723 size++;
724 def->storage = xmalloc (size);
725 mu_address_to_string (addr, def->storage, size, NULL);
726 def->value = def->storage;
727 mu_address_destroy (&addr);
728 }
729 else
730 def->value = "";
731 return def->value;
732}

Return to:

Send suggestions and report system problems to the System administrator.