Since this our internal IMAP options are keyed by URI section,
there's no need to have separate hashes for NNTP and IMAP
options since they URI already distinguishes them.
This will make future changes to support POP3 and JMAP and
arg caching with lei/store easier.
sub mic_new ($$$$) {
my ($self, $mic_arg, $sec, $uri) = @_;
my %mic_arg = %$mic_arg;
sub mic_new ($$$$) {
my ($self, $mic_arg, $sec, $uri) = @_;
my %mic_arg = %$mic_arg;
- my $sa = $self->{imap_opt}->{$sec}->{-proxy_cfg} || $self->{-proxy_cli};
+ my $sa = $self->{cfg_opt}->{$sec}->{-proxy_cfg} || $self->{-proxy_cli};
if ($sa) {
my %opt = %$sa;
$opt{ConnectAddr} = delete $mic_arg{Server};
if ($sa) {
my %opt = %$sa;
$opt{ConnectAddr} = delete $mic_arg{Server};
my $to = cfg_intvl($cfg, 'imap.timeout', $$uri);
$mic_args->{$sec}->{Timeout} = $to if $to;
my $sa = socks_args($cfg->urlmatch('imap.Proxy', $$uri));
my $to = cfg_intvl($cfg, 'imap.timeout', $$uri);
$mic_args->{$sec}->{Timeout} = $to if $to;
my $sa = socks_args($cfg->urlmatch('imap.Proxy', $$uri));
- $self->{imap_opt}->{$sec}->{-proxy_cfg} = $sa if $sa;
+ $self->{cfg_opt}->{$sec}->{-proxy_cfg} = $sa if $sa;
for my $k (qw(pollInterval idleInterval)) {
$to = cfg_intvl($cfg, "imap.$k", $$uri) // next;
for my $k (qw(pollInterval idleInterval)) {
$to = cfg_intvl($cfg, "imap.$k", $$uri) // next;
- $self->{imap_opt}->{$sec}->{$k} = $to;
+ $self->{cfg_opt}->{$sec}->{$k} = $to;
}
my $k = 'imap.fetchBatchSize';
my $bs = $cfg->urlmatch($k, $$uri) // next;
if ($bs =~ /\A([0-9]+)\z/) {
}
my $k = 'imap.fetchBatchSize';
my $bs = $cfg->urlmatch($k, $$uri) // next;
if ($bs =~ /\A([0-9]+)\z/) {
- $self->{imap_opt}->{$sec}->{batch_size} = $bs;
+ $self->{cfg_opt}->{$sec}->{batch_size} = $bs;
} else {
warn "$k=$bs is not an integer\n";
}
} else {
warn "$k=$bs is not an integer\n";
}
my ($self, $mic, $uri, $l_uid) = @_;
$l_uid ||= 1;
my $sec = uri_section($uri);
my ($self, $mic, $uri, $l_uid) = @_;
$l_uid ||= 1;
my $sec = uri_section($uri);
- my $bs = ($self->{imap_opt}->{$sec}->{batch_size} // 1) * 10000;
+ my $bs = ($self->{cfg_opt}->{$sec}->{batch_size} // 1) * 10000;
my ($eml_cb, @args) = @{$self->{eml_each}};
$self->{quiet} or warn "# $uri syncing flags 1:$l_uid\n";
for (my $n = 1; $n <= $l_uid; $n += $bs) {
my ($eml_cb, @args) = @{$self->{eml_each}};
$self->{quiet} or warn "# $uri syncing flags 1:$l_uid\n";
for (my $n = 1; $n <= $l_uid; $n += $bs) {
my $m = $mod ? " [(UID % $mod) == $shard]" : '';
warn "# $uri fetching UID $l_uid:$r_uid$m\n";
}
my $m = $mod ? " [(UID % $mod) == $shard]" : '';
warn "# $uri fetching UID $l_uid:$r_uid$m\n";
}
- my $bs = $self->{imap_opt}->{$sec}->{batch_size} // 1;
+ my $bs = $self->{cfg_opt}->{$sec}->{batch_size} // 1;
my $req = $mic->imap4rev1 ? 'BODY.PEEK[]' : 'RFC822.PEEK';
my $key = $req;
$key =~ s/\.PEEK//;
my $req = $mic->imap4rev1 ? 'BODY.PEEK[]' : 'RFC822.PEEK';
my $key = $req;
$key =~ s/\.PEEK//;
for my $uri (@{$self->{imap_order}}) {
my $sec = uri_section($uri);
my $mic = $mics->{$sec};
for my $uri (@{$self->{imap_order}}) {
my $sec = uri_section($uri);
my $mic = $mics->{$sec};
- my $intvl = $self->{imap_opt}->{$sec}->{pollInterval};
+ my $intvl = $self->{cfg_opt}->{$sec}->{pollInterval};
if ($mic->has_capability('IDLE') && !$intvl) {
if ($mic->has_capability('IDLE') && !$intvl) {
- $intvl = $self->{imap_opt}->{$sec}->{idleInterval};
+ $intvl = $self->{cfg_opt}->{$sec}->{idleInterval};
push @$idle, [ $uri, $intvl // () ];
} else {
push @{$poll->{$intvl || 120}}, $uri;
push @$idle, [ $uri, $intvl // () ];
} else {
push @{$poll->{$intvl || 120}}, $uri;