user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/4] net_reader: trim exports and remove unused uri_new
Date: Wed, 24 Feb 2021 17:31:54 +0600	[thread overview]
Message-ID: <20210224113154.686-5-e@80x24.org> (raw)
In-Reply-To: <20210224113154.686-1-e@80x24.org>

More network things for -watch are isolated in NetReader, now,
so fewer exports are necessary.
---
 lib/PublicInbox/NetReader.pm | 15 +--------------
 lib/PublicInbox/Watch.pm     |  4 ++--
 2 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm
index f3988f15..462514ed 100644
--- a/lib/PublicInbox/NetReader.pm
+++ b/lib/PublicInbox/NetReader.pm
@@ -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) = @_;
diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm
index 0b72bd16..dd245935 100644
--- a/lib/PublicInbox/Watch.pm
+++ b/lib/PublicInbox/Watch.pm
@@ -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};

      parent reply	other threads:[~2021-02-24 11:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 11:31 [PATCH 0/4] lei <import|convert> nntp:// Eric Wong
2021-02-24 11:31 ` [PATCH 1/4] add PublicInbox::URInntps package Eric Wong
2021-02-24 11:31 ` [PATCH 2/4] lei <import|convert>: support NNTP sources Eric Wong
2021-02-24 11:31 ` [PATCH 3/4] watch: switch IMAP and NNTP fetch loops to NetReader Eric Wong
2021-02-24 23:25   ` [SQUASH 5/4] net_reader: do not warn on EINTR if user quit Eric Wong
2021-02-24 11:31 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210224113154.686-5-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    --subject='Re: [PATCH 4/4] net_reader: trim exports and remove unused uri_new' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).