X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FConfig.pm;h=cafd9c3bafe364eaaeedcb478cc9e23fd1a49dfc;hb=0d38f65c490466837ae091afa7a7b6f59d04ce7c;hp=251008a38e0e7e5b542c9675801e8d6b463a41c9;hpb=be688d5b00bb77c6601b3ab680403ecd71ac4871;p=public-inbox.git diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index 251008a3..cafd9c3b 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -33,6 +33,7 @@ sub new { $self->{-by_list_id} = {}; $self->{-by_name} = {}; $self->{-by_newsgroup} = {}; + $self->{-by_eidx_key} = {}; $self->{-no_obfuscate} = {}; $self->{-limiters} = {}; $self->{-code_repos} = {}; # nick => PublicInbox::Git object @@ -424,7 +425,7 @@ EOF } $ibx->{name} = $name; - $ibx->{-pi_config} = $self; + $ibx->{-pi_cfg} = $self; $ibx = PublicInbox::Inbox->new($ibx); foreach (@{$ibx->{address}}) { my $lc_addr = lc($_); @@ -437,8 +438,23 @@ EOF $self->{-by_list_id}->{lc($list_id)} = $ibx; } } - if (my $ng = $ibx->{newsgroup}) { - $self->{-by_newsgroup}->{$ng} = $ibx; + if (my $ngname = $ibx->{newsgroup}) { + if (ref($ngname)) { + delete $ibx->{newsgroup}; + warn 'multiple newsgroups not supported: '. + join(', ', @$ngname). "\n"; + # Newsgroup name needs to be compatible with RFC 3977 + # wildmat-exact and RFC 3501 (IMAP) ATOM-CHAR. + # Leave out a few chars likely to cause problems or conflicts: + # '|', '<', '>', ';', '#', '$', '&', + } elsif ($ngname =~ m![^A-Za-z0-9/_\.\-\~\@\+\=:]!) { + delete $ibx->{newsgroup}; + warn "newsgroup name invalid: `$ngname'\n"; + } else { + # PublicInbox::NNTPD does stricter ->nntp_usable + # checks, keep this lean for startup speed + $self->{-by_newsgroup}->{$ngname} = $ibx; + } } $self->{-by_name}->{$name} = $ibx; if ($ibx->{obfuscate}) { @@ -461,8 +477,11 @@ EOF push @$repo_objs, $repo if $repo; } } - - $ibx + if (my $es = ALL($self)) { + require PublicInbox::Isearch; + $ibx->{isrch} = PublicInbox::Isearch->new($ibx, $es); + } + $self->{-by_eidx_key}->{$ibx->eidx_key} = $ibx; } sub _fill_ei ($$) {