]> Sergey Matveev's repositories - public-inbox.git/commitdiff
net_reader: trim exports and remove unused uri_new
authorEric Wong <e@80x24.org>
Wed, 24 Feb 2021 11:31:54 +0000 (17:31 +0600)
committerEric Wong <e@80x24.org>
Wed, 24 Feb 2021 23:27:07 +0000 (23:27 +0000)
More network things for -watch are isolated in NetReader, now,
so fewer exports are necessary.

lib/PublicInbox/NetReader.pm
lib/PublicInbox/Watch.pm

index 785211bff14ef136445f76e8901de2db7a86d2ce..96d3b2ed255a6585f1599b1d9c792ff144a39375 100644 (file)
@@ -10,11 +10,7 @@ use PublicInbox::Eml;
 
 our %IMAPflags2kw = map {; "\\\u$_" => $_ } qw(seen answered flagged draft);
 
-# TODO: trim this down, this is huge
-our @EXPORT = qw(uri_new uri_section
-               nn_new imap_uri nntp_uri
-               cfg_bool cfg_intvl imap_common_init nntp_common_init
-               );
+our @EXPORT = qw(uri_section imap_uri nntp_uri);
 
 # returns the git config section name, e.g [imap "imaps://user@example.com"]
 # without the mailbox, so we can share connections between different inboxes
@@ -94,15 +90,6 @@ sub mic_for { # mic = Mail::IMAPClient
        $mic;
 }
 
-sub uri_new {
-       my ($url) = @_;
-       require URI;
-
-       # URI::snews exists, URI::nntps does not, so use URI::snews
-       $url =~ s!\Anntps://!snews://!i;
-       URI->new($url);
-}
-
 # Net::NNTP doesn't support CAPABILITIES, yet
 sub try_starttls ($) {
        my ($host) = @_;
index 0b72bd160330a1474b0c9387eda79106cc934767..dd24593599a0b72f785d8f6caa05ea238699d3bd 100644 (file)
@@ -544,7 +544,7 @@ sub poll_fetch_reap {
 
 sub watch_imap_init ($$) {
        my ($self, $poll) = @_;
-       my $mics = imap_common_init($self); # read args from config
+       my $mics = PublicInbox::NetReader::imap_common_init($self);
        my $idle = []; # [ [ uri1, intvl1 ], [uri2, intvl2] ]
        for my $uri (@{$self->{imap_order}}) {
                my $sec = uri_section($uri);
@@ -565,7 +565,7 @@ sub watch_imap_init ($$) {
 
 sub watch_nntp_init ($$) {
        my ($self, $poll) = @_;
-       nntp_common_init($self); # read args from config
+       PublicInbox::NetReader::nntp_common_init($self);
        for my $uri (@{$self->{nntp_order}}) {
                my $sec = uri_section($uri);
                my $intvl = $self->{nntp_opt}->{$sec}->{pollInterval};