aboutsummaryrefslogtreecommitdiff
path: root/src/mail.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mail.c')
-rw-r--r--src/mail.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/mail.c b/src/mail.c
index 81bf085..52602f6 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -149,11 +149,27 @@ void
notify_owner (struct file_triplet *trp, enum notification_event ev)
{
int rc;
- struct access_method *method = trp->dpair->project_owner_method;
+ struct access_method *method;
char *text;
mu_address_t rcpt = NULL;
unsigned nrows, ncols, i;
struct kw_expansion kwexp[4];
+
+ switch (ev)
+ {
+ case ev_success:
+ case ev_bad_directive_signature:
+ case ev_bad_detached_signature:
+ method = trp->dpair->user_data_method;
+ break;
+
+ case ev_bad_ownership:
+ method = trp->dpair->project_owner_method;
+ break;
+
+ default:
+ abort ();
+ }
if (method->type == method_none)
{
@@ -171,7 +187,7 @@ notify_owner (struct file_triplet *trp, enum notification_event ev)
return;
}
- make_default_kwexp (kwexp, NULL, trp->project);
+ make_default_kwexp (kwexp, trp->user, trp->project);
escape_kwexp (method, kwexp, NITEMS (kwexp));
text = expand_param (method->param[1], kwexp, NITEMS (kwexp), NULL);
@@ -187,6 +203,13 @@ notify_owner (struct file_triplet *trp, enum notification_event ev)
nrows = method_num_rows (method);
ncols = method_num_cols (method);
+ if (nrows == 0)
+ {
+ logmsg (LOG_ERR, "cannot obtain owner emails for %s",
+ trp->project);
+ return;
+ }
+
for (i = 0; i < nrows; i++)
{
mu_address_t addr;
@@ -228,6 +251,7 @@ notify_owner (struct file_triplet *trp, enum notification_event ev)
void
notify (struct file_triplet *trp, enum notification_event ev)
{
+ fill_project_name (trp);
if (owner_notification_flags & STAT_MASK (ev))
notify_owner (trp, ev);
/* FIXME */

Return to:

Send suggestions and report system problems to the System administrator.