send-email: Fix Pine address book parsing
See: http://www.washington.edu/pine/tech-notes/low-level.html Entries with a fcc or comment field after the address weren't parsed correctly. Continuation lines, identified by leading spaces, were also not handled. Distribution lists which had ( ) around a list of addresses did not have the parenthesis removed. Signed-off-by: Trent Piepho <tpiepho@freescale.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Trent Piepho committed
Nov 25, 2008 at 18:55 UTC
73c427eb99a9bb8a3ade40809194405ddb1fd733
1 file changed
+6
-3
git-send-email.perl
+6
-3
@@ -345,10 +345,13 @@ my %parse_alias = (
345
# spaces delimit multiple addresses
346
$aliases{$1} = [ split(/\s+/, $2) ];
347
}}},
348
- pine => sub { my $fh = shift; while (<$fh>) {
349
- if (/^(\S+)\t.*\t(.*)$/) {
348
+ pine => sub { my $fh = shift; my $f='\t[^\t]*';
349
+ for (my $x = ''; defined($x); $x = $_) {
350
+ chomp $x;
351
+ $x .= $1 while(defined($_ = <$fh>) && /^ +(.*)$/);
352
+ $x =~ /^(\S+)$f\t\(?([^\t]+?)\)?(:?$f){0,2}$/ or next;
353
$aliases{$1} = [ split(/\s*,\s*/, $2) ];
351
- }}},
354
+ }},
355
gnus => sub { my $fh = shift; while (<$fh>) {
356
if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) {
357
$aliases{$1} = [ $2 ];