2 # show the contents of the message directory
4 # Copyright (c) Dirk Koopman G1TLH
9 my ($self, $line) = @_;
10 my @f = split /\s+/, $line;
18 my @all = grep {!$_->private || !($self->priv < 5 && $_->to ne $self->call && $_->from ne $self->call)} (DXMsg::get_all());
19 @all = grep {!$_->delete || ($self->priv >= 5 && $_->delete)} @all;
21 return (1, $self->msg('dir1')) unless @all;
24 my $to = $all[@all-1]->msgno;
32 } elsif ($f =~ /^O/o) { # dir/own
33 @ref = grep { $_->to eq $self->call || $_->from eq $self->call } @all;
35 } elsif ($f =~ /^N/o) { # dir/new
36 @ref = grep { $_->t > $self->user->lastin } @all;
38 } elsif ($f =~ /^S/o) { # dir/subject
41 $f =~ s{(.)}{"\Q$1"}ge;
42 @ref = grep { $_->subject =~ m{$f}i } @all;
45 } elsif ($f eq '>' || $f =~ /^T/o){
49 @ref = grep { $_->to =~ m{$f} } @all;
52 } elsif ($f eq '<' || $f =~ /^F/o){
56 @ref = grep { $_->from =~ m{$f} } @all;
59 } elsif ($f =~ /^(\d+)-(\d+)$/) { # a range of items
62 } elsif ($f =~ /^\d+$/ && $f > 0) { # a number of items
68 @ref = @all unless $sel || @ref;
71 if ($from != 0 || $to != $all[@all-1]->msgno) {
72 @ref = grep {$_->msgno >= $from && $_->msgno <= $to} @ref;
80 last if ++$count >= $n;
83 push @out, $self->msg('dir1');