$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
}
$ibx->{name} = $name;
- $ibx->{-pi_config} = $self;
+ $ibx->{-pi_cfg} = $self;
$ibx = PublicInbox::Inbox->new($ibx);
foreach (@{$ibx->{address}}) {
my $lc_addr = lc($_);
$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}) {
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 ($$) {