{"thread":{"id":"31418","subject":"[PATCH v6] Thunderbird: fix appp.sh format problems","startedAt":"2012-09-03T16:07:56Z","lastAt":"2012-09-03T16:07:56Z","messageCount":1,"participants":["Marco Stornelli"],"isPatch":true,"patchVersion":6,"patchTotal":null},"messages":[{"id":"198259","messageId":"5044D5DC.4010500@gmail.com","threadId":"31418","inReplyTo":null,"subject":"[PATCH v6] Thunderbird: fix appp.sh format problems","fromName":"Marco Stornelli","fromEmail":"marco.stornelli@gmail.com","sentAt":"2012-09-03T16:07:56Z","receivedAt":"2012-09-03T16:07:56Z","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\nv6: replaced single quotas with double quotas in perl embedded script\nv5: fixed comments by Junio C Hamano\nv4: create a tmp file to allow correct perl parsing\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 |   25 +++++++++++++++++++++----\n 1 files changed, 21 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/thunderbird-patch-inline/appp.sh b/contrib/thunderbird-patch-inline/appp.sh\nindex 5eb4a51..5e4e892 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,31 @@ 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+PATCHTMP=\"${PATCH}.tmp\"\n+\n+sed '/^$/q' \"${PATCH}\" > \"${PATCHTMP}\"\n+\n+export PATCHTMP\n+CCS=`perl -e 'local $/=undef; open FILE, $ENV{\"PATCHTMP\"}; $text=<FILE>;\n+close FILE; $addr = $1 if $text =~ /Cc: (.*?(,\\n .*?)*)\\n/s; $addr =~ s/\\n//g;\n+print $addr;'`\n+\n+TO=`perl -e 'local $/=undef; open FILE, $ENV{\"PATCHTMP\"}; $text=<FILE>;\n+close FILE; $addr = $1 if $text =~ /To: (.*?(,\\n .*?)*)\\n/s; $addr =~ s/\\n//g;\n+print $addr;'`\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+rm -f ${PATCHTMP}\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"}]}