2 # show the contents of the message directory
4 # Copyright (c) Dirk Koopman G1TLH
9 my ($self, $line) = @_;
10 my @f = split /\s+/, $line;
16 my @all = grep {!$_->private || !($self->priv < 5 && $_->to ne $self->call && $_->from ne $self->call)} (DXMsg::get_all());
17 return (1, $self->msg('e3', 'directory', $line)) unless @all;
20 my $to = $all[@all-1]->msgno;
28 } elsif ($f =~ /^O/o) { # dir/own
29 @ref = grep { $_->to eq $self->call || $_->from eq $self->call } @all;
31 } elsif ($f =~ /^N/o) { # dir/new
32 @ref = grep { $_->t > $self->user->lastin } @all;
34 } elsif ($f =~ /^S/o) { # dir/subject
37 $f =~ s{(.)}{"\Q$1"}ge;
38 @ref = grep { $_->subject =~ m{$f}i } @all;
41 } elsif ($f eq '>' || $f =~ /^T/o){
45 @ref = grep { $_->to =~ m{$f} } @all;
48 } elsif ($f eq '<' || $f =~ /^F/o){
52 @ref = grep { $_->from =~ m{$f} } @all;
55 } elsif ($f =~ /^(\d+)-(\d+)$/) { # a range of items
58 } elsif ($f =~ /^\d+$/ && $f > 0) { # a number of items
64 @ref = @all unless $sel || @ref;
67 if ($from != 0 || $to != $all[@all-1]->msgno) {
68 @ref = grep {$_->msgno >= $from && $_->msgno <= $to} @ref;
76 last if ++$count >= $n;
79 push @out, $self->msg('e3', 'directory', $line);