]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Inbox.pm
inbox: remove POSIX strftime import
[public-inbox.git] / lib / PublicInbox / Inbox.pm
index cde46258d02d630135f4efb12ba7b3d94178462e..76aeefbdd0e4b4c2c0d1d0bdc4353fd3d2e54d08 100644 (file)
@@ -9,7 +9,6 @@ use PublicInbox::Git;
 use PublicInbox::MID qw(mid2path);
 use Devel::Peek qw(SvREFCNT);
 use PublicInbox::MIME;
-use POSIX qw(strftime);
 
 my $cleanup_timer;
 eval {
@@ -95,6 +94,15 @@ sub new {
        if (defined $dir && -f "$dir/inbox.lock") {
                $opts->{version} = 2;
        }
+
+       # allow any combination of multi-line or comma-delimited hide entries
+       my $hide = {};
+       if (defined(my $h = $opts->{hide})) {
+               foreach my $v (@$h) {
+                       $hide->{$_} = 1 foreach (split(/\s*,\s*/, $v));
+               }
+               $opts->{-hide} = $hide;
+       }
        bless $opts, $class;
 }
 
@@ -333,4 +341,16 @@ sub recent {
        search($self)->{over_ro}->recent($opts, $after, $before);
 }
 
+sub modified {
+       my ($self) = @_;
+       if (my $srch = search($self)) {
+               my $msgs = $srch->{over_ro}->recent({limit => 1});
+               if (my $smsg = $msgs->[0]) {
+                       return $smsg->{ts};
+               }
+               return time;
+       }
+       git($self)->modified; # v1
+}
+
 1;