From 896b56c06ff991cc599ec8f44886ba88a31d4dd1 Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Fri, 28 Oct 2022 18:38:46 -0500 Subject: [PATCH] Add central email address non-repetition filter --- gatekeeper.pl | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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 @_; -- 2.25.1