1 package Promulger::List;
10 use Promulger::Config;
29 default => sub { {} },
39 $proto =~ s/-request$//;
40 my $path = find_path_for($proto);
43 $maybe_list = __PACKAGE__->load($path->stringify);
50 return if $self->subscribers->at($new);
51 $self->subscribers->put($new, 1);
52 $self->store(find_path_for($self->name));
57 return unless $self->subscribers->at($ex);
58 $self->subscribers->delete($ex);
59 $self->store(find_path_for($self->name));
62 # XXX implement ACLs and other shinies -- apeiron, 2010-03-13
63 sub accept_posts_from {
64 my($self, $sender) = @_;
65 return grep { $sender eq $_ } @{$self->subscribers};
70 my $config = Promulger::Config->config;
71 my $name = $self->listname;
72 croak "${name} already a known list" if resolve($name);
73 my $path = find_path_for($name);
75 open my $fh, '+<', $config->{aliases};
77 my @current_contents = <$fh>;
78 my @aliases = ($name, "${name}-request");
80 for my $alias (@aliases) {
81 if(grep { /^${alias}:/ } @current_contents) {
82 croak "${alias} already in $config->{aliases}";
84 push @current_contents,
85 qq(${alias}: "|$config->{bin_root}/pmg msg -c $config->{config_file}"\n);
88 $self->store($path->stringify);
89 print $fh @current_contents;
95 my $path = file(Promulger::Config->config->{list_home}, $proto . ".list");
98 'http://mitpress.mit.edu/sicp/';