about summary refs log tree commit homepage
path: root/lib/PublicInbox/Watch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-12-08 21:21:27 +0000
committerEric Wong <e@80x24.org>2020-12-09 21:13:34 +0000
commit0d38f65c490466837ae091afa7a7b6f59d04ce7c (patch)
tree8c838c12ce3c28ef1c15a15dd6584e0d0d831a34 /lib/PublicInbox/Watch.pm
parent416d1c3f6d5e5a857760ffc1b679e86a070bdbd4 (diff)
downloadpublic-inbox-0d38f65c490466837ae091afa7a7b6f59d04ce7c.tar.gz
{pi_config} may be confused with the documented `PI_CONFIG'
environment variable, and we'll favor vowel-removal to be
consistent with our usage of object references.

The `pi_' prefix may stay in some places, for now; since a
separate namespace may come into this codebase for local/private
client-tooling.

For InboxIdle, we'll also remove an invalid comment about
holding a reference to the PublicInbox::Config object, too.
Diffstat (limited to 'lib/PublicInbox/Watch.pm')
-rw-r--r--lib/PublicInbox/Watch.pm20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm
index 8bbce929..e1246096 100644
--- a/lib/PublicInbox/Watch.pm
+++ b/lib/PublicInbox/Watch.pm
@@ -41,7 +41,7 @@ sub compile_watchheaders ($) {
 }
 
 sub new {
-        my ($class, $config) = @_;
+        my ($class, $cfg) = @_;
         my (%mdmap, $spamc);
         my (%imap, %nntp); # url => [inbox objects] or 'watchspam'
 
@@ -50,7 +50,7 @@ sub new {
         # 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;
@@ -69,10 +69,10 @@ sub new {
 
         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]);
 
@@ -113,7 +113,7 @@ sub new {
                 spamcheck => $spamcheck,
                 mdmap => \%mdmap,
                 mdre => $mdre,
-                config => $config,
+                pi_cfg => $cfg,
                 imap => scalar keys %imap ? \%imap : undef,
                 nntp => scalar keys %nntp? \%nntp : undef,
                 importers => {},
@@ -175,7 +175,7 @@ sub _remove_spam {
         $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 ($$$) {
@@ -316,7 +316,7 @@ sub cfg_bool ($$$) {
 # 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);
@@ -418,7 +418,7 @@ sub imap_import_msg ($$$$$) {
                 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 {
@@ -775,7 +775,7 @@ sub watch_imap_init ($$) {
 # 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));
@@ -966,7 +966,7 @@ sub nntp_fetch_all ($$$) {
                         }
                 } 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";