-sub list_match_domain ($$$) {
- my ($self, $env, $hide_key) = @_;
- my $list = [];
- my $host = $env->{HTTP_HOST} // $env->{SERVER_NAME};
- $host =~ s/:[0-9]+\z//;
- $self->{pi_config}->each_inbox(\&list_match_domain_i, $list, $hide_key,
- qr!\A(?:https?:)?//\Q$host\E(?::[0-9]+)?/!i);
- $list;
-}
-
-sub list_404 ($$) { [] }
-
-# TODO: +cgit
-my %VALID = (
- all => \&list_all,
- 'match=domain' => \&list_match_domain,
- 404 => \&list_404,
-);
-
-sub set_cb ($$$) {
- my ($pi_config, $k, $default) = @_;
- my $v = $pi_config->{lc $k} // $default;
- $VALID{$v} || do {
- warn <<"";
-`$v' is not a valid value for `$k'
-$k be one of `all', `match=domain', or `404'
-
- $VALID{$default};
- };
+sub list_match_i { # ConfigIter callback
+ my ($cfg, $section, $re, $ctx) = @_;
+ if (defined($section)) {
+ return if $section !~ m!\Apublicinbox\.([^/]+)\z!;
+ my $ibx = $cfg->lookup_name($1) or return;
+ if (!$ibx->{-hide}->{$ctx->hide_key} &&
+ grep(/$re/, @{$ibx->{url}})) {
+ $ctx->ibx_entry($ibx);
+ }
+ } else { # undef == "EOF"
+ $ctx->{-wcb}->($ctx->psgi_triple);
+ }