From 5da50cb59aadcea7d7338ea379df54493c200603 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Thu, 5 Nov 2009 01:25:35 +0100 Subject: [PATCH] taskd/mail.sh: Optional fifth parameter is email sender; set up in ref_change() --- Girocco/Notify.pm | 13 ++++++++++++- taskd/mail.sh | 6 ++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Girocco/Notify.pm b/Girocco/Notify.pm index 0cbe095..2735594 100644 --- a/Girocco/Notify.pm +++ b/Girocco/Notify.pm @@ -133,8 +133,19 @@ sub ref_change { # First, possibly send out various mails if ($proj->{notifymail}) { + my $sender; + if ($user) { + if ($user->{name} eq 'mob') { + $sender = "The Mob User <$proj->{email}>"; + } else { + $sender = "$user->{name} <$user->{email}>"; + } + } else { + $sender = "$proj->{name} <$proj->{email}>"; + } system($Girocco::Config::basedir.'/taskd/mail.sh', - "$ref", "$oldrev", "$newrev", $proj->{name}) + "$ref", "$oldrev", "$newrev", $proj->{name}, + $sender) and warn "mail.sh failed"; } diff --git a/taskd/mail.sh b/taskd/mail.sh index 5ac1334..8a00ec2 100755 --- a/taskd/mail.sh +++ b/taskd/mail.sh @@ -13,6 +13,7 @@ # * Calling with arguments is same as giving them on stdin. # * Optional fourth parameter is project name, used at most places instead # of description. +# * Optional fifth parameter is email sender. # * Load shlib. # * Default subject prefix is site name. # * Unsubscribe instructions in email footer. @@ -205,6 +206,9 @@ generate_email_header() { # --- Email (all stdout will be the email) # Generate header + if [ -n "$emailsender" ]; then + echo "From: $emailsender" + fi cat <<-EOF To: $recipients Subject: ${emailprefix}$projectname $refname_type, $short_refname, ${change_type}d. $describe @@ -691,6 +695,8 @@ else projectboth="$projectdesc" fi +emailsender="$5" + recipients=$(git config hooks.mailinglist) announcerecipients=$(git config hooks.announcelist) envelopesender=$(git config hooks.envelopesender) -- 2.11.4.GIT