summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2007-08-10 13:31:04 +0000
committerAndreas Gruenbacher <agruen@suse.de>2007-08-10 13:31:04 +0000
commitc37dd985aa8c62d157bfb0989f251683834250d9 (patch)
tree249cf425fb8744e8db3b81089398c0a8cc03ea53
parent80015a4d883aca92990fdfcb7589d3232d14cd6b (diff)
downloadquilt-c37dd985aa8c62d157bfb0989f251683834250d9.tar.gz
- quilt mail: Add a --reply-to <message> option which adds the
appropriate Subject, Reply-To, and References headers to the intro and patch messages.
-rw-r--r--po/de.po26
-rw-r--r--po/fr.po24
-rw-r--r--po/ja.po24
-rw-r--r--po/quilt.pot23
-rw-r--r--quilt.changes7
-rw-r--r--quilt/mail.in97
6 files changed, 155 insertions, 46 deletions
diff --git a/po/de.po b/po/de.po
index d0e24df..df87ee1 100644
--- a/po/de.po
+++ b/po/de.po
@@ -322,7 +322,7 @@ msgstr ""
"Kann kein Diff mit -p$opt_strip_level erzeugen, bitte -p0 oder -p1 verwenden."
"\\n"
-#: quilt/diff.in:266 quilt/files.in:105 quilt/mail.in:320
+#: quilt/diff.in:266 quilt/files.in:105 quilt/mail.in:367
msgid "Patch %s not applied before patch %s\\n"
msgstr "Patch %s ist nicht vor Patch %s angewandt\\n"
@@ -725,16 +725,18 @@ msgid "Failed to insert patch %s into file series\\n"
msgstr "Konnte Patch %s nicht in die series-Datei einfügen\\n"
#: quilt/mail.in:24
+#, fuzzy
msgid ""
"Usage: quilt mail {--mbox file|--send} [-m text] [--prefix prefix] [--"
"sender ...] [--from ...] [--to ...] [--cc ...] [--bcc ...] [--subject ...] "
-"[first_patch [last_patch]]\\n"
+"[--reply-to message] [first_patch [last_patch]]\\n"
msgstr ""
"Verwendung: quilt mail {--mbox datei|--send} [-m text] [--prefix prefix] [--"
"sender ...] [--from ...] [--to ...] [--cc ...] [--bcc ...] [--subject ...] "
"[first_patch [last_patch]]\\n"
#: quilt/mail.in:27
+#, fuzzy
msgid ""
"\n"
"Create mail messages from a specified range of patches, or all patches in\n"
@@ -770,6 +772,9 @@ msgid ""
"\n"
"--to, --cc, --bcc\n"
"\tAppend a recipient to the To, Cc, or Bcc header.\n"
+"\n"
+"--reply-to message\n"
+"\tAdd the appropriate headers to reply to the specified message.\n"
msgstr ""
"\n"
"Erzeuge E-Mail-Nachrichten für alle Patches in der series-Datei, und\n"
@@ -805,28 +810,33 @@ msgstr ""
"--to, --cc, --bcc\n"
"\tFüre einen Empfänger an die To, Cc, or Bcc-Kopfzeilen an.\n"
-#: quilt/mail.in:189
+#: quilt/mail.in:235
msgid "Could not determine the envelope sender address. Please use --sender."
msgstr ""
"Konnte die Envelope-Adresse nicht feststellen. Bitte verwenden Sie --sender."
-#: quilt/mail.in:350
+#: quilt/mail.in:397
msgid "Unable to extract a subject header from %s\\n"
msgstr "Konnte keine Subject-Kopfzeile aus %s extrahieren\\n"
-#: quilt/mail.in:373
+#: quilt/mail.in:420
msgid "Patches %s have duplicate subject headers.\\n"
msgstr "Die Patches %s haben die selben Subject-Kopfzeilen.\\n"
-#: quilt/mail.in:415
+#: quilt/mail.in:429
+#, fuzzy
+msgid "File %s does not exist\\n"
+msgstr "Patch %s existiert nicht\\n"
+
+#: quilt/mail.in:486
msgid "Introduction has no subject header (saved as %s)\\n"
msgstr "Die Einleitung hat keine Subject-Kopfzeile (gespeichert als %s)\\n"
-#: quilt/mail.in:418
+#: quilt/mail.in:489
msgid "Introduction has no subject header\\n"
msgstr "Die Einleitung hat keine Subject-Kopfzeile\\n"
-#: quilt/mail.in:508
+#: quilt/mail.in:578
msgid "Introduction saved as %s\\n"
msgstr "Einleitung gespeichert als %s\\n"
diff --git a/po/fr.po b/po/fr.po
index be56fe8..d21e15c 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -324,7 +324,7 @@ msgstr ""
"Impossible de crer des patches avec -p%s. Veuillez spcifier -p0 ou -p1 "
"la place\\n"
-#: quilt/diff.in:266 quilt/files.in:105 quilt/mail.in:320
+#: quilt/diff.in:266 quilt/files.in:105 quilt/mail.in:367
msgid "Patch %s not applied before patch %s\\n"
msgstr "Le patch %s n'est pas appliqu avant %s\\n."
@@ -725,7 +725,7 @@ msgstr "Impossible d'inserer %s dans le fichier de srie.\\n"
msgid ""
"Usage: quilt mail {--mbox file|--send} [-m text] [--prefix prefix] [--"
"sender ...] [--from ...] [--to ...] [--cc ...] [--bcc ...] [--subject ...] "
-"[first_patch [last_patch]]\\n"
+"[--reply-to message] [first_patch [last_patch]]\\n"
msgstr ""
"Usage : quilt mail {--mbox fichier|--send} [-m texte] [--prefix prfixe] [--"
"sender ...] [--from ...] [--to ...] [--cc ...] [--bcc ...] [--subject ...]\\n"
@@ -767,6 +767,9 @@ msgid ""
"\n"
"--to, --cc, --bcc\n"
"\tAppend a recipient to the To, Cc, or Bcc header.\n"
+"\n"
+"--reply-to message\n"
+"\tAdd the appropriate headers to reply to the specified message.\n"
msgstr ""
"\n"
"Cre des messages de courrier partir de tous les patches de la srie.\n"
@@ -804,28 +807,33 @@ msgstr ""
"\tAjoute un destinataire dans le champ d'en-tte A, Copie ou Copie\n"
"\tcache, respectivement.\n"
-#: quilt/mail.in:189
+#: quilt/mail.in:235
msgid "Could not determine the envelope sender address. Please use --sender."
msgstr "Impossible de dterminer l'adresse d'expditeur. Utilisez --sender."
-#: quilt/mail.in:350
+#: quilt/mail.in:397
msgid "Unable to extract a subject header from %s\\n"
msgstr "Impossible d'extraire une ligne de sujet de %s\\n"
-#: quilt/mail.in:373
+#: quilt/mail.in:420
msgid "Patches %s have duplicate subject headers.\\n"
msgstr "Les patches %s ont des sujets dupliqus.\\n"
-#: quilt/mail.in:415
+#: quilt/mail.in:429
+#, fuzzy
+msgid "File %s does not exist\\n"
+msgstr "Le patch %s n'existe pas\\n"
+
+#: quilt/mail.in:486
msgid "Introduction has no subject header (saved as %s)\\n"
msgstr ""
"L'introduction n'a pas de ligne de sujet (sauvegard en tant que %s)\\n"
-#: quilt/mail.in:418
+#: quilt/mail.in:489
msgid "Introduction has no subject header\\n"
msgstr "L'introduction ne contient pas de ligne de sujet\\n"
-#: quilt/mail.in:508
+#: quilt/mail.in:578
msgid "Introduction saved as %s\\n"
msgstr "Introduction sauvegarde en tant que %s\\n"
diff --git a/po/ja.po b/po/ja.po
index 3b93df4..9e4b444 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -312,7 +312,7 @@ msgstr ""
msgid "Cannot diff patches with -p%s, please specify -p0 or -p1 instead\\n"
msgstr "-p%s でパッチの差分はとれません。-p0か -p1を指定してください\\n"
-#: quilt/diff.in:266 quilt/files.in:105 quilt/mail.in:320
+#: quilt/diff.in:266 quilt/files.in:105 quilt/mail.in:367
msgid "Patch %s not applied before patch %s\\n"
msgstr "パッチ %s は、パッチ %s の前に適用されていません\\n"
@@ -699,7 +699,7 @@ msgstr "seriesファイルへのパッチ %s の書き込みに失敗しまし
msgid ""
"Usage: quilt mail {--mbox file|--send} [-m text] [--prefix prefix] [--"
"sender ...] [--from ...] [--to ...] [--cc ...] [--bcc ...] [--subject ...] "
-"[first_patch [last_patch]]\\n"
+"[--reply-to message] [first_patch [last_patch]]\\n"
msgstr ""
"使い方: quilt mail {--mbox file|--send} [-m text] [--prefix prefix] [--"
"sender ...] [--from ...] [--to ...] [--cc ...] [--bcc ...] [--subject ...]\\n"
@@ -741,6 +741,9 @@ msgid ""
"\n"
"--to, --cc, --bcc\n"
"\tAppend a recipient to the To, Cc, or Bcc header.\n"
+"\n"
+"--reply-to message\n"
+"\tAdd the appropriate headers to reply to the specified message.\n"
msgstr ""
"\n"
"シリーズファイル内にあるすべてのパッチからメールを作成し、mailboxファ\n"
@@ -773,29 +776,34 @@ msgstr ""
"--to, --cc, --bcc\n"
"\tToやCC、BCCへの受信者の追加。\n"
-#: quilt/mail.in:189
+#: quilt/mail.in:235
msgid "Could not determine the envelope sender address. Please use --sender."
msgstr ""
"エンベロープの送信者アドレスを確定できませんでした。--senderオプション\n"
"を使用してください。"
-#: quilt/mail.in:350
+#: quilt/mail.in:397
msgid "Unable to extract a subject header from %s\\n"
msgstr "%s から件名を取り出せません。\\n"
-#: quilt/mail.in:373
+#: quilt/mail.in:420
msgid "Patches %s have duplicate subject headers.\\n"
msgstr "パッチ %s の件名が重複しています。\\n"
-#: quilt/mail.in:415
+#: quilt/mail.in:429
+#, fuzzy
+msgid "File %s does not exist\\n"
+msgstr "パッチ %s が存在しません\\n"
+
+#: quilt/mail.in:486
msgid "Introduction has no subject header (saved as %s)\\n"
msgstr "序文に件名がありません(%s として保存されました)\\n"
-#: quilt/mail.in:418
+#: quilt/mail.in:489
msgid "Introduction has no subject header\\n"
msgstr "序文に件名がありません\\n"
-#: quilt/mail.in:508
+#: quilt/mail.in:578
msgid "Introduction saved as %s\\n"
msgstr "序文は %s という名前で保存されました\\n"
diff --git a/po/quilt.pot b/po/quilt.pot
index 1de726e..0e118aa 100644
--- a/po/quilt.pot
+++ b/po/quilt.pot
@@ -206,7 +206,7 @@ msgstr ""
msgid "Cannot diff patches with -p%s, please specify -p0 or -p1 instead\\n"
msgstr ""
-#: quilt/diff.in:266 quilt/files.in:105 quilt/mail.in:320
+#: quilt/diff.in:266 quilt/files.in:105 quilt/mail.in:367
msgid "Patch %s not applied before patch %s\\n"
msgstr ""
@@ -480,7 +480,7 @@ msgstr ""
msgid ""
"Usage: quilt mail {--mbox file|--send} [-m text] [--prefix prefix] [--"
"sender ...] [--from ...] [--to ...] [--cc ...] [--bcc ...] [--subject ...] "
-"[first_patch [last_patch]]\\n"
+"[--reply-to message] [first_patch [last_patch]]\\n"
msgstr ""
#: quilt/mail.in:27
@@ -519,29 +519,36 @@ msgid ""
"\n"
"--to, --cc, --bcc\n"
"\tAppend a recipient to the To, Cc, or Bcc header.\n"
+"\n"
+"--reply-to message\n"
+"\tAdd the appropriate headers to reply to the specified message.\n"
msgstr ""
-#: quilt/mail.in:189
+#: quilt/mail.in:235
msgid "Could not determine the envelope sender address. Please use --sender."
msgstr ""
-#: quilt/mail.in:350
+#: quilt/mail.in:397
msgid "Unable to extract a subject header from %s\\n"
msgstr ""
-#: quilt/mail.in:373
+#: quilt/mail.in:420
msgid "Patches %s have duplicate subject headers.\\n"
msgstr ""
-#: quilt/mail.in:415
+#: quilt/mail.in:429
+msgid "File %s does not exist\\n"
+msgstr ""
+
+#: quilt/mail.in:486
msgid "Introduction has no subject header (saved as %s)\\n"
msgstr ""
-#: quilt/mail.in:418
+#: quilt/mail.in:489
msgid "Introduction has no subject header\\n"
msgstr ""
-#: quilt/mail.in:508
+#: quilt/mail.in:578
msgid "Introduction saved as %s\\n"
msgstr ""
diff --git a/quilt.changes b/quilt.changes
index eacb990..1984631 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Fri Aug 10 15:16:12 CEST 2007 - agruen@suse.de
+
+- quilt mail: Add a --reply-to <message> option which adds the
+ appropriate Subject, Reply-To, and References headers to the
+ intro and patch messages.
+
+-------------------------------------------------------------------
Thu Aug 2 12:37:19 MDT 2007 - paul@pwsan.com
- quilt mail: strip closing angle brackets from the mail sender
diff --git a/quilt/mail.in b/quilt/mail.in
index c7d5a4c..fbb42cc 100644
--- a/quilt/mail.in
+++ b/quilt/mail.in
@@ -21,7 +21,7 @@ fi
usage()
{
- printf $"Usage: quilt mail {--mbox file|--send} [-m text] [--prefix prefix] [--sender ...] [--from ...] [--to ...] [--cc ...] [--bcc ...] [--subject ...] [first_patch [last_patch]]\n"
+ printf $"Usage: quilt mail {--mbox file|--send} [-m text] [--prefix prefix] [--sender ...] [--from ...] [--to ...] [--cc ...] [--bcc ...] [--subject ...] [--reply-to message] [first_patch [last_patch]]\n"
if [ x$1 = x-h ]
then
printf $"
@@ -58,6 +58,9 @@ first, and a last patch name of \`-' denotes the last patch in the series.
--to, --cc, --bcc
Append a recipient to the To, Cc, or Bcc header.
+
+--reply-to message
+ Add the appropriate headers to reply to the specified message.
" "@DOCSUBDIR@/README.MAIL"
exit 0
else
@@ -71,6 +74,45 @@ msgid()
echo "$timestamp@${opt_sender_address#*@}"
}
+# See RFC 2822 Internet Message Format for how the In-Reply-To and
+# References headers are generated...
+
+in_reply_to_header() {
+ local message=$1 message_id
+
+ message_id=$(formail -x Message-ID < "$message")
+ message_id=${message_id# }
+ [ -n "$message_id" ] && echo "In-Reply-To: $message_id"
+}
+
+references_header() {
+ local message=$1 message_id references in_reply_to
+
+ message_id=$(formail -x Message-ID < "$message")
+ message_id=${message_id# }
+
+ references=$(formail -x References < "$message")
+ references=${references# }
+ if [ -z "$references" ]
+ then
+ in_reply_to=$(formail -x In-Reply-To < "$message")
+ in_reply_to=${in_reply_to# }
+ if [ -n "$in_reply_to" ] &&
+ ! [[ "$in_reply_to" =~ "@.*@" ]]
+ then
+ references=$in_reply_to
+ fi
+ fi
+ if [ -z "$references" ]
+ then
+ references=$message_id
+ elif [ -n "$message_id" ]
+ then
+ references="$references"$'\n '"$message_id"
+ fi
+ [ -n "$references" ] && echo "References: $references"
+}
+
process_mail()
{
local tmpfile=$(gen_tempfile)
@@ -97,7 +139,7 @@ process_mail()
options=`getopt -o m:h --long from:,to:,cc:,bcc:,subject: \
--long send,mbox:,charset:,sender: \
- --long prefix: -- "$@"`
+ --long prefix:,reply-to: -- "$@"`
if [ $? -ne 0 ]
then
@@ -107,6 +149,7 @@ fi
eval set -- "$options"
opt_prefix=patch
+
while true
do
case "$1" in
@@ -143,6 +186,9 @@ do
--charset)
opt_charset=$2
shift 2 ;;
+ --reply-to)
+ opt_reply_to=$2
+ shift 2 ;;
-h)
usage -h ;;
--)
@@ -376,6 +422,21 @@ if [ ${#dup_subjects[@]} -ne 0 ]; then
exit 1
fi
+if [ -n "$opt_reply_to" ]
+then
+ if [ ! -e "$opt_reply_to" ]
+ then
+ printf $"File %s does not exist\n" "$opt_reply_to"
+ exit 1
+ fi
+
+ if [ -z "$opt_subject" ]
+ then
+ opt_subject="Re: $(formail -x Subject < "$opt_reply_to" \
+ | sed -e 's/^ *\([rR][eE]: *\)*//')"
+ fi
+fi
+
introduction="$(gen_tempfile)"
(
cat <<-EOF
@@ -386,6 +447,15 @@ introduction="$(gen_tempfile)"
To: $(IFS=,; echo "${opt_to[*]}")
Cc: $(IFS=,; echo "${opt_cc[*]}")
Bcc: $(IFS=,; echo "${opt_bcc[*]}")
+ EOF
+
+ if [ -n "$opt_reply_to" ]
+ then
+ in_reply_to_header "$opt_reply_to"
+ references_header "$opt_reply_to"
+ fi
+
+ cat <<-EOF
Subject-Prefix: [$opt_prefix @num@/@total@]
Subject: $opt_subject
@@ -480,20 +550,19 @@ for patch in "${patches[@]}"; do
p=${subject_prefix//@num@/$(printf %0*d ${#total} $num)}
p=${p//@total@/$total}
( echo "Message-Id: <$(msgid)>"
- sed -n -e '/^$/q' \
- -e 's/^Message-Id:/References:/' \
- -e p \
- $introduction
+ awk '
+ /^$/ { exit }
+ tolower($0) !~ /^(message-id|references|in-reply-to):/ \
+ { print }
+ ' $introduction
+ references_header $introduction
echo "Content-Disposition: inline; filename=$patch"
- sed -n -e '/^$/q' \
- -e '/^Recipient-.*:/d' \
- -e '/^Replace-.*:/d' \
- -e p \
- $body
awk '
- /^$/ { in_body = 1 }
- in_body { print }
- ' $body
+ !in_body && tolower($0) ~ /^(Recipient|Replace)-.*:/ \
+ { next }
+ /^$/ { in_body = 1 }
+ { print }
+ ' $body
echo -e '\n-- '
[ -r $HOME/.signature ] && cat $HOME/.signature
) | eval $QUILT_DIR/scripts/edmail --charset $opt_charset \