Existing callers in LeiExternal actually depend on this,
and LeiAuth shouldn't need to be creating a config file
just to do a conversion against an anonymous IMAP server.
if (!@st) {
unless ($creat) {
delete $self->{cfg};
if (!@st) {
unless ($creat) {
delete $self->{cfg};
+ return bless {}, 'PublicInbox::Config';
}
my (undef, $cfg_dir, undef) = File::Spec->splitpath($f);
-d $cfg_dir or mkpath($cfg_dir) or die "mkpath($cfg_dir): $!\n";
}
my (undef, $cfg_dir, undef) = File::Spec->splitpath($f);
-d $cfg_dir or mkpath($cfg_dir) or die "mkpath($cfg_dir): $!\n";
sub auth_start {
my ($self, $lei, $post_auth_cb, @args) = @_;
sub auth_start {
my ($self, $lei, $post_auth_cb, @args) = @_;
- $lei->_lei_cfg(1); # workers may need to read config
my $op = $lei->workers_start($self, 'auth', 1, {
'net_merge' => [ \&net_merge, $lei ],
'' => [ \&auth_eof, $lei, $post_auth_cb, @args ],
my $op = $lei->workers_start($self, 'auth', 1, {
'net_merge' => [ \&net_merge, $lei ],
'' => [ \&auth_eof, $lei, $post_auth_cb, @args ],
sub externals_each {
my ($self, $cb, @arg) = @_;
sub externals_each {
my ($self, $cb, @arg) = @_;
- my $cfg = $self->_lei_cfg(0);
+ my $cfg = $self->_lei_cfg;
my %boost;
for my $sec (grep(/\Aexternal\./, @{$cfg->{-section_order}})) {
my $loc = substr($sec, length('external.'));
my %boost;
for my $sec (grep(/\Aexternal\./, @{$cfg->{-section_order}})) {
my $loc = substr($sec, length('external.'));
# shell completion helper called by lei__complete
sub _complete_forget_external {
my ($self, @argv) = @_;
# shell completion helper called by lei__complete
sub _complete_forget_external {
my ($self, @argv) = @_;
- my $cfg = $self->_lei_cfg(0);
+ my $cfg = $self->_lei_cfg;
my ($cur, $re) = _complete_url_common(\@argv);
# FIXME: bash completion off "http:" or "https:" when the last
# character is a colon doesn't work properly even if we're
my ($cur, $re) = _complete_url_common(\@argv);
# FIXME: bash completion off "http:" or "https:" when the last
# character is a colon doesn't work properly even if we're
sub _complete_add_external { # for bash, this relies on "compopt -o nospace"
my ($self, @argv) = @_;
sub _complete_add_external { # for bash, this relies on "compopt -o nospace"
my ($self, @argv) = @_;
- my $cfg = $self->_lei_cfg(0);
+ my $cfg = $self->_lei_cfg;
my ($cur, $re) = _complete_url_common(\@argv);
require URI;
map {
my ($cur, $re) = _complete_url_common(\@argv);
require URI;
map {