{"thread":{"id":"31394","subject":"[PATCH v3] Thunderbird: fix appp.sh format problems","startedAt":"2012-08-31T07:59:22Z","lastAt":"2012-08-31T16:50:20Z","messageCount":2,"participants":["Marco Stornelli","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":null},"messages":[{"id":"198142","messageId":"50406EDA.2050505@gmail.com","threadId":"31394","inReplyTo":null,"subject":"[PATCH v3] Thunderbird: fix appp.sh format problems","fromName":"Marco Stornelli","fromEmail":"marco.stornelli@gmail.com","sentAt":"2012-08-31T07:59:22Z","receivedAt":"2012-08-31T07:59:22Z","isPatch":true,"sender":{"key":"marco.stornelli@gmail.com","avatar":null},"body":"The current script has got the following problems:\n\n1) It doesn't work if the language used by Thunderbird is not English;\n2) The field To: filled by format-patch is not evaluated;\n3) The field Cc: is loaded from Cc used in the commit message\ninstead of using the Cc field filled by format-patch in the email\nheader.\n\nAdded comments for point 1), added parsing of To: for point 2) and\nadded parsing of Cc: in the email header for point 3), removing the\nCc: parsing from commit message.\n\nSigned-off-by: Marco Stornelli <marco.stornelli@gmail.com>\n---\n\nv3: parse only To: and Cc: in the email header, fix some comments\nv2: changed the commit message to reflect better the script implementation\nv1: first draft\n\n contrib/thunderbird-patch-inline/appp.sh |   21 +++++++++++++++++----\n 1 files changed, 17 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/thunderbird-patch-inline/appp.sh b/contrib/thunderbird-patch-inline/appp.sh\nindex 5eb4a51..9325366 100755\n--- a/contrib/thunderbird-patch-inline/appp.sh\n+++ b/contrib/thunderbird-patch-inline/appp.sh\n@@ -6,6 +6,9 @@\n \n # ExternalEditor can be downloaded at http://globs.org/articles.php?lng=en&pg=2\n \n+# NOTE: You must change some words in this script according to the language\n+# used by Mozilla Thunderbird, as <Subject>, <To>, <Don't remove this line>.\n+\n CONFFILE=~/.appprc\n \n SEP=\"-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-\"\n@@ -26,17 +29,27 @@ fi\n cd - > /dev/null\n \n SUBJECT=`sed -n -e '/^Subject: /p' \"${PATCH}\"`\n-HEADERS=`sed -e '/^'\"${SEP}\"'$/,$d' $1`\n BODY=`sed -e \"1,/${SEP}/d\" $1`\n CMT_MSG=`sed -e '1,/^$/d' -e '/^---$/,$d' \"${PATCH}\"`\n DIFF=`sed -e '1,/^---$/d' \"${PATCH}\"`\n+MAILHEADER=`sed '/^$/q' \"${PATCH}\"`\n+\n+export MAILHEADER\n+CCS=`perl -e 'local $/=undef; $text=$ENV{'MAILHEADER'};\n+$cc = $1 if $text =~ /Cc: (.*?(,\\n .*?)*)\\n/s; $cc =~ s/\\n//g;\n+print $cc;'`\n \n-CCS=`echo -e \"$CMT_MSG\\n$HEADERS\" | sed -n -e 's/^Cc: \\(.*\\)$/\\1,/gp' \\\n-\t-e 's/^Signed-off-by: \\(.*\\)/\\1,/gp'`\n+TO=`perl -e 'local $/=undef; $text=$ENV{'MAILHEADER'};\n+$to = $1 if $text =~ /To: (.*?(,\\n .*?)*)\\n/s; $to =~ s/\\n//g;\n+print $to;'`\n \n+# Change Subject: before next line according to Thunderbird language\n+# for example to translate in Italian:\n+# SUBJECT=`echo $SUBJECT | sed -e 's/Subject/Oggetto/g'`\n echo \"$SUBJECT\" > $1\n+# Change To: according to Thunderbird language\n+echo \"To: $TO\" >> $1\n echo \"Cc: $CCS\" >> $1\n-echo \"$HEADERS\" | sed -e '/^Subject: /d' -e '/^Cc: /d' >> $1\n echo \"$SEP\" >> $1\n \n echo \"$CMT_MSG\" >> $1\n-- \n1.7.3.4\n"},{"id":"198152","messageId":"7v7gsfovjn.fsf@alter.siamese.dyndns.org","threadId":"31394","inReplyTo":"50406EDA.2050505@gmail.com","subject":"Re: [PATCH v3] Thunderbird: fix appp.sh format problems","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-08-31T16:50:20Z","receivedAt":"2012-08-31T16:50:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marco Stornelli <marco.stornelli@gmail.com> writes:\n\n> The current script has got the following problems:\n>\n> 1) It doesn't work if the language used by Thunderbird is not English;\n> 2) The field To: filled by format-patch is not evaluated;\n> 3) The field Cc: is loaded from Cc used in the commit message\n> instead of using the Cc field filled by format-patch in the email\n> header.\n>\n> Added comments for point 1), added parsing of To: for point 2) and\n> added parsing of Cc: in the email header for point 3), removing the\n> Cc: parsing from commit message.\n>\n> Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>\n> ---\n>\n> v3: parse only To: and Cc: in the email header, fix some comments\n> v2: changed the commit message to reflect better the script implementation\n> v1: first draft\n>\n>  contrib/thunderbird-patch-inline/appp.sh |   21 +++++++++++++++++----\n>  1 files changed, 17 insertions(+), 4 deletions(-)\n>\n> diff --git a/contrib/thunderbird-patch-inline/appp.sh b/contrib/thunderbird-patch-inline/appp.sh\n> index 5eb4a51..9325366 100755\n> --- a/contrib/thunderbird-patch-inline/appp.sh\n> +++ b/contrib/thunderbird-patch-inline/appp.sh\n> @@ -6,6 +6,9 @@\n>  \n>  # ExternalEditor can be downloaded at http://globs.org/articles.php?lng=en&pg=2\n>  \n> +# NOTE: You must change some words in this script according to the language\n> +# used by Mozilla Thunderbird, as <Subject>, <To>, <Don't remove this line>.\n> +\n>  CONFFILE=~/.appprc\n>  \n>  SEP=\"-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-\"\n> @@ -26,17 +29,27 @@ fi\n>  cd - > /dev/null\n>  \n>  SUBJECT=`sed -n -e '/^Subject: /p' \"${PATCH}\"`\n> -HEADERS=`sed -e '/^'\"${SEP}\"'$/,$d' $1`\n>  BODY=`sed -e \"1,/${SEP}/d\" $1`\n>  CMT_MSG=`sed -e '1,/^$/d' -e '/^---$/,$d' \"${PATCH}\"`\n>  DIFF=`sed -e '1,/^---$/d' \"${PATCH}\"`\n> +MAILHEADER=`sed '/^$/q' \"${PATCH}\"`\n> +\n> +export MAILHEADER\n> +CCS=`perl -e 'local $/=undef; $text=$ENV{'MAILHEADER'};\n> +$cc = $1 if $text =~ /Cc: (.*?(,\\n .*?)*)\\n/s; $cc =~ s/\\n//g;\n> +print $cc;'`\n>  \n> -CCS=`echo -e \"$CMT_MSG\\n$HEADERS\" | sed -n -e 's/^Cc: \\(.*\\)$/\\1,/gp' \\\n> -\t-e 's/^Signed-off-by: \\(.*\\)/\\1,/gp'`\n> +TO=`perl -e 'local $/=undef; $text=$ENV{'MAILHEADER'};\n> +$to = $1 if $text =~ /To: (.*?(,\\n .*?)*)\\n/s; $to =~ s/\\n//g;\n> +print $to;'`\n>  \n> +# Change Subject: before next line according to Thunderbird language\n> +# for example to translate in Italian:\n> +# SUBJECT=`echo $SUBJECT | sed -e 's/Subject/Oggetto/g'`\n>  echo \"$SUBJECT\" > $1\n\nYeah that is much easier to understand.\n\nYou would want to write it with 's/^Subject:/Oggetto:/', though; you\nwant to rewrite\n\n\tSubject: Subject appears as Oggetto in Thunderbird for Italian\n\nto\n\n\tOggetto: Subject appears as Oggetto in Thunderbird for Italian\n\nwithout touching \"Subject\" that appear anywhere other than at the\nbeginning, suffixed with \":\".\n\n> +# Change To: according to Thunderbird language\n> +echo \"To: $TO\" >> $1\n>  echo \"Cc: $CCS\" >> $1\n> -echo \"$HEADERS\" | sed -e '/^Subject: /d' -e '/^Cc: /d' >> $1\n>  echo \"$SEP\" >> $1\n>  \n>  echo \"$CMT_MSG\" >> $1\n"}]}