}
sub new {
- my ($class, $config) = @_;
+ my ($class, $cfg) = @_;
my (%mdmap, $spamc);
my (%imap, %nntp); # url => [inbox objects] or 'watchspam'
# indefinitely...
foreach my $pfx (qw(publicinboxwatch publicinboxlearn)) {
my $k = "$pfx.watchspam";
- defined(my $dirs = $config->{$k}) or next;
+ defined(my $dirs = $cfg->{$k}) or next;
$dirs = PublicInbox::Config::_array($dirs);
for my $dir (@$dirs) {
my $url;
my $k = 'publicinboxwatch.spamcheck';
my $default = undef;
- my $spamcheck = PublicInbox::Spamcheck::get($config, $k, $default);
+ my $spamcheck = PublicInbox::Spamcheck::get($cfg, $k, $default);
$spamcheck = _spamcheck_cb($spamcheck) if $spamcheck;
- $config->each_inbox(sub {
+ $cfg->each_inbox(sub {
# need to make all inboxes writable for spam removal:
my $ibx = $_[0] = PublicInbox::InboxWritable->new($_[0]);
spamcheck => $spamcheck,
mdmap => \%mdmap,
mdre => $mdre,
- config => $config,
+ pi_cfg => $cfg,
imap => scalar keys %imap ? \%imap : undef,
nntp => scalar keys %nntp? \%nntp : undef,
importers => {},
$path =~ /:2,[A-R]*S[T-Za-z]*\z/ or return;
my $eml = eml_from_path($path) or return;
local $SIG{__WARN__} = warn_ignore_cb();
- $self->{config}->each_inbox(\&remove_eml_i, $self, $eml, $path);
+ $self->{pi_cfg}->each_inbox(\&remove_eml_i, $self, $eml, $path);
}
sub import_eml ($$$) {
# flesh out common IMAP-specific data structures
sub imap_common_init ($) {
my ($self) = @_;
- my $cfg = $self->{config};
+ my $cfg = $self->{pi_cfg};
my $mic_args = {}; # scheme://authority => Mail:IMAPClient arg
for my $url (sort keys %{$self->{imap}}) {
my $uri = PublicInbox::URIimap->new($url);
if ($flags =~ /\\Seen\b/) {
local $SIG{__WARN__} = warn_ignore_cb();
my $eml = PublicInbox::Eml->new($raw);
- $self->{config}->each_inbox(\&remove_eml_i,
+ $self->{pi_cfg}->each_inbox(\&remove_eml_i,
$self, $eml, "$url UID:$uid");
}
} else {
# flesh out common NNTP-specific data structures
sub nntp_common_init ($) {
my ($self) = @_;
- my $cfg = $self->{config};
+ my $cfg = $self->{pi_cfg};
my $nn_args = {}; # scheme://authority => Net::NNTP->new arg
for my $url (sort keys %{$self->{nntp}}) {
my $sec = uri_section(uri_new($url));
}
} elsif ($inboxes eq 'watchspam') {
my $eml = PublicInbox::Eml->new(\$raw);
- $self->{config}->each_inbox(\&remove_eml_i,
+ $self->{pi_cfg}->each_inbox(\&remove_eml_i,
$self, $eml, "$url ARTICLE $art");
} else {
die "BUG: destination unknown $inboxes";