{"thread":{"id":"31387","subject":"[PATCH] Thunderbird: fix appp.sh format problems","startedAt":"2012-08-30T08:31:34Z","lastAt":"2012-08-30T08:31:34Z","messageCount":1,"participants":["Marco Stornelli"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"198088","messageId":"503F24E6.3060506@gmail.com","threadId":"31387","inReplyTo":null,"subject":"[PATCH] Thunderbird: fix appp.sh format problems","fromName":"Marco Stornelli","fromEmail":"marco.stornelli@gmail.com","sentAt":"2012-08-30T08:31:34Z","receivedAt":"2012-08-30T08:31:34Z","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. In addition, in the commit message we can find several tags\n(acked-by, tested-by, reported-by...), so it'd better to use only the\ninformation provided by format-patch.\n\nAdded comments for point 1). Fixed point 2) and 3).\n\nSigned-off-by: Marco Stornelli <marco.stornelli@gmail.com>\n---\n contrib/thunderbird-patch-inline/appp.sh |   18 ++++++++++++++----\n 1 files changed, 14 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/thunderbird-patch-inline/appp.sh b/contrib/thunderbird-patch-inline/appp.sh\nindex 5eb4a51..e6e1b85 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,24 @@ 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 \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+export PATCH\n+CCS=`perl -e 'local $/=undef; open FILE, $ENV{'PATCH'}; $text=<FILE>;\n+close FILE; $cc = $1 if $text =~ /Cc: (.*?(,\\n .*?)*)\\n/s; $cc =~ s/\\n//g;\n+print $cc;'`\n+\n+TO=`perl -e 'local $/=undef; open FILE, $ENV{'PATCH'}; $text=<FILE>;\n+close FILE; $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 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"}]}