cfg_unwanted_keywords="$(ini_config_get "$cfgfile" ""prj_$prj"" "unwanted_keywords")"
}
-# Send an e-mail reply. This function assumes that the following variables are
-# defined: cfg_ownname, cfg_ownmail, cfg_adminname, cfg_adminmail,
-# cfg_preamble, cfg_signature. See "parse_config()" function.
+# Compose (but not send) e-mail reply. This function assumes that the following
+# variables are defined: cfg_ownname, cfg_ownmail, cfg_adminname,
+# cfg_adminmail, cfg_preamble, cfg_signature. See "parse_config()" function.
#
-# Usage: compose_email <to> <cc> <subj> <in_reply_to> <tmpfile>
-#
-# The "tmpfile" parameter is a file where this function will store a copy of
-# the send e-mail.
+# Usage: compose_email <to> <cc> <subj> <in_reply_to>
compose_email()
{
local to="$1"; shift
local cc="$1"; shift
local subj="$1"; shift
local in_reply_to="$1"; shift
- local tmpfile="$1"; shift
if [ -n "$cc" ]; then
# A newline characters
cc="$__newline$cc"
fi
- cat > "$tmpfile" <<EOF
+ cat <<EOF
To: $to
From: "$cfg_ownname" <$cfg_ownmail>$cc
Subject: Re: $subj
--
$cfg_signature
EOF
-
- [ -z "$verbose" ] || cat -- "$tmpfile" >&2
- [ -z "$test_mode" ] &&
- mutt -x -H "$tmpdir/mail" </dev/null ||
- verbose "Do not actually send the email - we are in test mode"
}
-
printf "%s" "$list" | LC_ALL=C sed -n -e "s/.*$ol+\([^@]\+\)@$od.*/\1/p" | head -n1
}
+# Send an e-mail reply to the patch author.
+# Usage: send_email
+send_email()
+{
+ compose_email "$from" "$to" "$subj" "$id" > "$tmpdir/mail"
+
+ [ -z "$verbose" ] || cat -- "$tmpdir/mail" >&2
+
+ if [ -z "$test_mode" ]; then
+ mutt -x -H "$tmpdir/mail" </dev/null
+ else
+ verbose "Do not actually send the email - we are in test mode"
+ fi
+}
+
TEMP=`getopt -n $PROG -o i:,C:,p,v,h --long test-mode,input:,confdir:,preserve,bisectability,sparse,smatch,cppcheck,coccinelle,verbose,help -- "$@"` ||
fail_usage ""
eval set -- "$TEMP"
[ "$#" -eq 1 ] || fatal "Insufficient or too many arguments"
+program_required "mutt" ""
+
cfgfile="$1"; shift
# Save the mbox to a temporary file if it comes from stdin
# Reject the e-mail if the project has not been specified
if [ -z "$prj" ]; then
- compose_email "$from" "" "$subj" "$id" "$tmpdir/mail" <<EOF
+ send_email <<EOF
Sorry, but you have not specified the project name. Please, specify it
using symbol "+" in the e-mail address of $ownname.
# Check if we have this project in our config file
if [ -z "$cfg_name" ]; then
- compose_email "$from" "" "$subj" "$id" "$tmpdir/mail" <<EOF
+ send_email <<EOF
Sorry, but project "$prj" is not supported. List of projects $cfg_ownname supports:
$(list_projects)
# Notify the sender that the patches have been accepted
if [ "$cfg_accept_notify" = "1" ]; then
message "Sending \"accepted\" e-mail"
- compose_email "$from" "$to" "$subj" "$id" "$tmpdir/mail" <<EOF
+ send_email <<EOF
Your patch or patch-set:
$(fetch_header_per_patch "Subject" < "$mbox" | sort)
"$cfg_path" "$cfg_configs" > "$tmpdir/test-patchset.log" ||
{
message "aiaiai-test-patchset failed"
- compose_email "$from" "$to" "$subj" "$id" "$tmpdir/mail" <<EOF
+ send_email <<EOF
Sorry, but an internal error happened. Please, send a bug report to
"$cfg_adminname" <$cfg_adminmail>.
EOF
message "Test is finished, sending back the results"
-compose_email "$from" "$to" "$subj" "$id" "$tmpdir/mail" <<EOF
+send_email <<EOF
$cfg_built_preamble
$(fetch_header_per_patch "Subject" < "$mbox" | sort)