From: Ryan Anderson <ryan@michonline.com>
To: Eric Wong <normalperson@yhbt.net>
Cc: Junio C Hamano <junkio@cox.net>,
git@vger.kernel.org, Ryan Anderson <ryan@michonline.com>
Subject: Re: [PATCH (resend)] send-email: address expansion for common mailers
Date: Mon, 15 May 2006 00:12:28 -0400 [thread overview]
Message-ID: <20060515041227.GP32076@h4x0r5.com> (raw)
In-Reply-To: <11476592243181-git-send-email-normalperson@yhbt.net>
On Sun, May 14, 2006 at 07:13:44PM -0700, Eric Wong wrote:
> mutt, gnus, pine, mailrc formats should be supported.
>
> Testing and feedback for correctness and completeness of all formats
> and support for additional formats would be good.
>
> Nested expansions are also supported.
>
> More than one alias file to be used.
>
> All alias file formats must still of be the same type, though.
>
> Two git repo-config keys are required for this
> (as suggested by Ryan Anderson):
>
> sendemail.aliasesfile = <filename of aliases file>
> sendemail.aliasfiletype = (mutt|gnus|pine|mailrc)
>
> Signed-off-by: Eric Wong <normalperson@yhbt.net>
Acked-by: Ryan Anderson <ryan@michonline.com>
> ---
>
> Looks like this patch got forgotten a while ago, and I never noticed
> because I forgot to set WITH_SEND_EMAIL when doing make install.
> Of course, WITH_SEND_EMAIL should no longer be needed...
>
> git-send-email.perl | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 48 insertions(+), 0 deletions(-)
>
> ff6593287dc500853c1cf05bdb0f32f970f10c9d
> diff --git a/git-send-email.perl b/git-send-email.perl
> index 703dd1f..d8c4b1f 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -89,6 +89,41 @@ sub gitvar_ident {
> my ($author) = gitvar_ident('GIT_AUTHOR_IDENT');
> my ($committer) = gitvar_ident('GIT_COMMITTER_IDENT');
>
> +my %aliases;
> +chomp(my @alias_files = `git-repo-config --get-all sendemail.aliasesfile`);
> +chomp(my $aliasfiletype = `git-repo-config sendemail.aliasfiletype`);
> +my %parse_alias = (
> + # multiline formats can be supported in the future
> + mutt => sub { my $fh = shift; while (<$fh>) {
> + if (/^alias\s+(\S+)\s+(.*)$/) {
> + my ($alias, $addr) = ($1, $2);
> + $addr =~ s/#.*$//; # mutt allows # comments
> + # commas delimit multiple addresses
> + $aliases{$alias} = [ split(/\s*,\s*/, $addr) ];
> + }}},
> + mailrc => sub { my $fh = shift; while (<$fh>) {
> + if (/^alias\s+(\S+)\s+(.*)$/) {
> + # spaces delimit multiple addresses
> + $aliases{$1} = [ split(/\s+/, $2) ];
> + }}},
> + pine => sub { my $fh = shift; while (<$fh>) {
> + if (/^(\S+)\s+(.*)$/) {
> + $aliases{$1} = [ split(/\s*,\s*/, $2) ];
> + }}},
> + gnus => sub { my $fh = shift; while (<$fh>) {
> + if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) {
> + $aliases{$1} = [ $2 ];
> + }}}
> +);
> +
> +if (@alias_files && defined $parse_alias{$aliasfiletype}) {
> + foreach my $file (@alias_files) {
> + open my $fh, '<', $file or die "opening $file: $!\n";
> + $parse_alias{$aliasfiletype}->($fh);
> + close $fh;
> + }
> +}
> +
> my $prompting = 0;
> if (!defined $from) {
> $from = $author || $committer;
> @@ -112,6 +147,19 @@ if (!@to) {
> $prompting++;
> }
>
> +sub expand_aliases {
> + my @cur = @_;
> + my @last;
> + do {
> + @last = @cur;
> + @cur = map { $aliases{$_} ? @{$aliases{$_}} : $_ } @last;
> + } while (join(',',@cur) ne join(',',@last));
> + return @cur;
> +}
> +
> +@to = expand_aliases(@to);
> +@initial_cc = expand_aliases(@initial_cc);
> +
> if (!defined $initial_subject && $compose) {
> do {
> $_ = $term->readline("What subject should the emails start with? ",
> --
> 1.3.2.g1c9b
>
>
prev parent reply other threads:[~2006-05-15 4:13 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-25 10:43 send-email: dependency removal, cleanup, + small feature Eric Wong
2006-03-25 10:43 ` [PATCH 1/4] send-email: Change from Mail::Sendmail to Net::SMTP Eric Wong
2006-03-25 23:58 ` Ryan Anderson
2006-03-26 0:54 ` Eric Wong
2006-03-26 1:09 ` Junio C Hamano
2006-03-26 1:20 ` [PATCH] " Eric Wong
2006-04-26 0:45 ` Martin Langhoff
2006-04-26 20:17 ` Junio C Hamano
2006-04-26 20:24 ` Martin Langhoff
2006-04-28 0:27 ` Eric Wong
2006-04-28 1:04 ` Martin Langhoff
2006-03-25 10:43 ` [PATCH 2/4] send-email: use built-in time() instead of /bin/date '+%s' Eric Wong
2006-03-25 10:43 ` [PATCH 3/4] send-email: lazy-load Email::Valid and make it optional Eric Wong
2006-03-25 15:07 ` Randal L. Schwartz
2006-03-25 20:33 ` Junio C Hamano
2006-03-26 0:47 ` [PATCH] " Eric Wong
2006-03-25 10:43 ` [PATCH 4/4] send-email: add support for mutt aliases files Eric Wong
2006-03-25 20:31 ` Junio C Hamano
2006-03-25 23:50 ` Ryan Anderson
2006-03-26 1:10 ` [PATCH] send-email: address expansion for common mailers Eric Wong
2006-03-26 1:30 ` Junio C Hamano
2006-03-26 2:44 ` Eric Wong
2006-05-15 2:13 ` [PATCH (resend)] " Eric Wong
2006-05-15 4:12 ` Ryan Anderson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060515041227.GP32076@h4x0r5.com \
--to=ryan@michonline.com \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=normalperson@yhbt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).