Browse Source

Add a contact to a list, super duper naive version

master
Jonathan "Duke" Leto 7 years ago
parent
commit
bf7afdb76a
  1. 13
      lib/Hush/List.pm

13
lib/Hush/List.pm

@ -277,13 +277,16 @@ sub add_contact {
barf "Invalid Hushlist list name!" unless $name;
$contact||= '';
barf "Invalid Hushlist contact=$contact" unless is_valid_contact($contact);
barf "Invalid Hushlist contact=$contact" unless $contact;
my $lists = $self->{lists};
my $list = $lists->{$name};
#barf "Hush list $list does not exist" unless $list;
# TODO: does contact exist already?
my $member_list = catfile($HUSHLIST_CONFIG_DIR,$name,'members.txt');
open my $fh, '>>', $member_list or barf "Could not open $member_list for writing";
print $fh $contact . "\n";
close $fh;
barf "Hush list $list does not exist" unless $list;
$list->{recipients}->{$zaddr}++;
return $self;
}

Loading…
Cancel
Save