diff --git a/utilities/list_addresses.pl b/utilities/list_addresses.pl index 55f854e6..ca5191f2 100755 --- a/utilities/list_addresses.pl +++ b/utilities/list_addresses.pl @@ -9,9 +9,16 @@ # # Parameters # + +# An EntitiesDescriptor of all UKF-registered entities $metadata = '../mdx/uk/collected.xml'; + +# A file of email addresses for people who have opted-in to the list $extra_addresses = '../../ukf-data/members/extra_addresses.txt'; +# Default list of contacts from Salesforce, processed by contacts-from-sf.sh +$sf_contacts = '../../ukf-data/contacts/sf-contacts-mc.txt'; + # # Subroutines # @@ -21,11 +28,13 @@ sub usage { print <] + $0 [-h] [-f ] [--security] [--mc] [-c ] - -h - prints this help text and exits - -f - takes metadata from this file, not the pre-defined file. - --security - also extract the security contacts + -h - prints this help text and exits + -f - takes metadata from this file, not the pre-defined file + --security - also extract the security contacts + --mc - add Management Contacts from a well-known location + -c - Use this contacts file not the well-known location Extracts email addresses of contacts in a metadata file. @@ -41,9 +50,13 @@ sub usage { my $help; my $file; my $security; +my $mc; +my $contacts = $sf_contacts; GetOptions( "help" => \$help, "file=s" => \$file, - "security" => \$security + "security" => \$security, + "mc" => \$mc, + "c:s" => \$contacts ); if ( $help ) { @@ -127,6 +140,21 @@ sub usage { $wanted{lc $addr} = $addr; } +# +# And if we want to include Management Contact emails too +# +if ( $mc ) { + open(SFCONTACTS, "$contacts") || die "could not open contacts file $contacts"; + while () { + chomp; + $sfcontacts{$_} = 1 unless $_ eq ''; + } + close SFCONTACTS; + foreach $addr (keys %sfcontacts) { + $wanted{lc $addr} = $addr; + } +} + # # List all wanted addresses. #