]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Inbox.pm
feed: support publicinbox.<name>.feedmax
[public-inbox.git] / lib / PublicInbox / Inbox.pm
index 8c639082a4189f6ad91cb3e0ec3a2e9612bc41d2..5503980fc0ca3d297d6062709b3dfacb44aae800 100644 (file)
@@ -29,11 +29,22 @@ sub _weaken_later ($) {
        $WEAKEN->{"$self"} = $self;
 }
 
+sub _set_uint ($$$) {
+       my ($opts, $field, $default) = @_;
+       my $val = $opts->{$field};
+       if (defined $val) {
+               $val = $val->[-1] if ref($val) eq 'ARRAY';
+               $val = undef if $val !~ /\A\d+\z/;
+       }
+       $opts->{$field} = $val || $default;
+}
+
 sub new {
        my ($class, $opts) = @_;
        my $v = $opts->{address} ||= 'public-inbox@example.com';
        my $p = $opts->{-primary_address} = ref($v) eq 'ARRAY' ? $v->[0] : $v;
        $opts->{domain} = ($p =~ /\@(\S+)\z/) ? $1 : 'localhost';
+       _set_uint($opts, 'feedmax', 25);
        weaken($opts->{-pi_config});
        bless $opts, $class;
 }