Simplify code by creating a funct (comma separated, with aliases ...) into a simple list of valid email addresses. Signed-off-by: Remi Lespinet <remi.lespinet@xxxxxxxxxxxxxxxxxxxxxxx> --- git-send-email.perl | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index 0cac4b0..59dcfe3 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -808,12 +808,9 @@ sub expand_one_alias { return $aliases{$alias} ? expand_aliases(@{$aliases{$alias}}) : $alias; } -@initial_to = expand_aliases(@initial_to); -@initial_to = validate_address_list(sanitize_address_list(@initial_to)); -@initial_cc = expand_aliases(@initial_cc); -@initial_cc = validate_address_list(sanitize_address_list(@initial_cc)); -@bcclist = expand_aliases(@bcclist); -@bcclist = validate_address_list(sanitize_address_list(@bcclist)); +@initial_to = process_address_list(@initial_to); +@initial_cc = process_address_list(@initial_cc); +@bcclist = process_address_list(@bcclist); if ($thread && !defined $initial_reply_to && $prompting) { $initial_reply_to = ask( @@ -1026,6 +1023,13 @@ sub sanitize_address_list { return (map { sanitize_address($_) } @_); } +sub process_address_list { + my @addr_list = expand_aliases(@_); + @addr_list = sanitize_address_list(@addr_list); + @addr_list = validate_address_list(@addr_list); + return @addr_list; +} + # Returns the local Fully Qualified Domain Name (FQDN) if available. # # Tightly configured MTAa require that a caller sends a real DNS @@ -1535,10 +1539,8 @@ foreach my $t (@files) { ($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1)); $needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc); - @to = expand_aliases(@to); - @to = validate_address_list(sanitize_address_list(@to)); - @cc = expand_aliases(@cc); - @cc = validate_address_list(sanitize_address_list(@cc)); + @to = process_address_list(@to); + @cc = process_address_list(@cc); @to = (@initial_to, @to); @cc = (@initial_cc, @cc); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html