summaryrefslogtreecommitdiffabout
path: root/src/mail.c
authorSergey Poznyakoff <gray@gnu.org.ua>2007-08-26 16:43:21 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2007-08-26 16:43:21 (GMT)
commit8c3e4b2576fae10c60aaef6c224324a3f61c903b (patch) (side-by-side diff)
treed327c79583dfe1d3ea77237335f60b6f32fbdedb /src/mail.c
parentb89ece30bebb5b9dd06e4e061537b6bf068566f2 (diff)
downloadwydawca-8c3e4b2576fae10c60aaef6c224324a3f61c903b.tar.gz
wydawca-8c3e4b2576fae10c60aaef6c224324a3f61c903b.tar.bz2
* wydawca/wydawca.h (struct file_triplet): New member user
(fill_project_name): New function * wydawca/verify.c (get_project_name): Rename to fill_project_name, remove static qualifier. * wydawca/wydawca.rc: Update * wydawca/mail.c (notify_owner): Notify only the submitter on ev_success, ev_bad_directive_signature and ev_bad_detached_signature (should it be made configurable?) (notify): Call fill_project_name * wydawca/triplet.c (hash_triplet_free): Free trp->user (expand_user_real_name, expand_user_email): Change data indices to match those of project_owner_method. git-svn-id: file:///svnroot/wydawca/trunk@298 6bb4bd81-ecc2-4fd4-a2d4-9571d19c0d33
Diffstat (limited to 'src/mail.c') (more/less context) (ignore whitespace changes)
-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.