-sub imapd_refresh_step { # PublicInbox::ConfigIter cb
- my ($pi_cfg, $section, $imapd) = @_;
- if (defined($section)) {
- return if $section !~ m!\Apublicinbox\.([^/]+)\z!;
- my $ibx = $pi_cfg->lookup_name($1) or return;
- imapd_refresh_ibx($ibx, $imapd->{imapd_next});
- } else { # undef == "EOF"
- imapd_refresh_finalize($imapd, $pi_cfg);
- }
-}
-
-sub refresh_groups {
- my ($self, $sig) = @_;
- my $pi_cfg = PublicInbox::Config->new;
- if ($sig) { # SIGHUP is handled through the event loop
- $self->{imapd_next} = { dummies => {}, mailboxes => {} };
- my $iter = PublicInbox::ConfigIter->new($pi_cfg,
- \&imapd_refresh_step, $self);
- $iter->event_step;
- } else { # initial start is synchronous
- $self->{dummies} = {};
- $pi_cfg->each_inbox(\&imapd_refresh_ibx, $self);
- imapd_refresh_finalize($self, $pi_cfg);
- }
-}
-