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
$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) = @_;
$$raw =~ s/\r\n/\n/sg;
my $kw = [];
for my $f (split(/ /, $flags)) {
- my $k = $IMAPflags2kw{$f} // next; # TODO: X-Label?
- push @$kw, $k;
+ if (my $k = $IMAPflags2kw{$f}) {
+ push @$kw, $k;
+ } elsif ($f eq "\\Recent") { # not in JMAP
+ } elsif ($f eq "\\Deleted") { # not in JMAP
+ return;
+ } elsif ($self->{verbose}) {
+ warn "# unknown IMAP flag $f <$uri;uid=$uid>\n";
+ }
}
+ @$kw = sort @$kw; # for all UI/UX purposes
my ($eml_cb, @args) = @{$self->{eml_each}};
$eml_cb->($uri, $uid, $kw, PublicInbox::Eml->new($raw), @args);
}