]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Watch.pm
net_reader: nntp_opt => cfg_opt
[public-inbox.git] / lib / PublicInbox / Watch.pm
index 4fbc96405cb5b799445ecc104767ebc6166b88f6..96faa9f89971bf5212b735404909900cf196ba8f 100644 (file)
@@ -2,7 +2,7 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 #
 # ref: https://cr.yp.to/proto/maildir.html
-#      httsp://wiki2.dovecot.org/MailboxFormat/Maildir
+#      https://wiki2.dovecot.org/MailboxFormat/Maildir
 package PublicInbox::Watch;
 use strict;
 use v5.10.1;
@@ -53,8 +53,7 @@ sub new {
        # indefinitely...
        foreach my $pfx (qw(publicinboxwatch publicinboxlearn)) {
                my $k = "$pfx.watchspam";
-               defined(my $dirs = $cfg->{$k}) or next;
-               $dirs = PublicInbox::Config::_array($dirs);
+               my $dirs = $cfg->get_all($k) // next;
                for my $dir (@$dirs) {
                        my $uri;
                        if (is_maildir($dir)) {
@@ -359,7 +358,7 @@ sub watch_imap_idle_1 ($$$) {
        my $mic;
        local $0 = $uri->mailbox." $sec";
        until ($self->{quit}) {
-               $mic //= PublicInbox::IMAPClient->new(%$mic_arg);
+               $mic //= PublicInbox::IMAPClient->new(%$mic_arg,Keepalive => 1);
                my $err;
                if ($mic && $mic->IsConnected) {
                        local $self->{mics_cached}->{$sec} = $mic;
@@ -550,7 +549,7 @@ sub watch_nntp_init ($$) {
        PublicInbox::NetReader::nntp_common_init($self);
        for my $uri (@{$self->{nntp_order}}) {
                my $sec = uri_section($uri);
-               my $intvl = $self->{nntp_opt}->{$sec}->{pollInterval};
+               my $intvl = $self->{cfg_opt}->{$sec}->{pollInterval};
                push @{$poll->{$intvl || 120}}, $uri;
        }
 }
@@ -683,4 +682,6 @@ EOF
        undef;
 }
 
+sub folder_select { 'select' } # for PublicInbox::NetReader
+
 1;