Skip to content

Commit

Permalink
Allow list_addresses.pl to incorporate MC email addresses.
Browse files Browse the repository at this point in the history
See ukf/ukf-meta#146
  • Loading branch information
Alex Stuart committed Oct 13, 2017
1 parent df0f598 commit 1693bdc
Showing 1 changed file with 33 additions and 5 deletions.
38 changes: 33 additions & 5 deletions utilities/list_addresses.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand All @@ -21,11 +28,13 @@
sub usage {
print <<EOF;
$0 [-h] [-f <metadata file>]
$0 [-h] [-f <metadata file>] [--security] [--mc] [-c <management contacts>]
-h - prints this help text and exits
-f <metadata file> - takes metadata from this file, not the pre-defined file.
--security - also extract the security contacts
-h - prints this help text and exits
-f <metadata file> - 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 <management contacts> - Use this contacts file not the well-known location
Extracts email addresses of contacts in a metadata file.
Expand All @@ -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 ) {
Expand Down Expand Up @@ -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 (<SFCONTACTS>) {
chomp;
$sfcontacts{$_} = 1 unless $_ eq '';
}
close SFCONTACTS;
foreach $addr (keys %sfcontacts) {
$wanted{lc $addr} = $addr;
}
}

#
# List all wanted addresses.
#
Expand Down

0 comments on commit 1693bdc

Please sign in to comment.