From: Jacob Bachmeyer Date: Fri, 28 Oct 2022 23:38:46 +0000 (-0500) Subject: Add central email address non-repetition filter X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=896b56c06ff991cc599ec8f44886ba88a31d4dd1;p=gatekeeper.git Add central email address non-repetition filter --- diff --git a/gatekeeper.pl b/gatekeeper.pl index 2999438..3c3fdb6 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -985,6 +985,23 @@ END # - Email # +=item @unique_list = unique ( @list ) + +Filter LIST to return only unique strings. Analogous to uniq(1) but does +not require LIST be sorted. Order of LIST is preserved; the first +occurrence of each unique value is passed through. + +=cut + +sub unique { + my %filter; + my @ret; + + foreach (@_) { unless ($filter{$_}) { $filter{$_}++; push @ret, $_ } } + + return @ret; +} + =item @filtered = exclude_mail_blacklist ( $blacklist_file, @addresses ) Filter ADDRESSES to remove addresses mentioned in BLACKLIST_FILE. @@ -1050,7 +1067,7 @@ sub mail { $sender = 'ftp-upload@gnu.org' if ($send_to_user); # We really want replies to go to the ftp-upload queue - @email_list = exclude_mail_blacklist($email_blacklist, @email_list); + @email_list = unique(exclude_mail_blacklist($email_blacklist, @email_list)); #print STDERR "final emails: @email_list\n"; # return @_;