From: djk Date: Sun, 23 May 1999 15:32:32 +0000 (+0000) Subject: done more work on directory now really quite ak1a compatible X-Git-Tag: R_1_28~12 X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=af2f3a0a2f8e5d99e0072c194f20a1da2f559348;p=spider.git done more work on directory now really quite ak1a compatible made sure that a channel has a privilege - even if it is 0 --- diff --git a/Changes b/Changes index d5fa4718..ead5ce08 100644 --- a/Changes +++ b/Changes @@ -5,7 +5,8 @@ oldest one is lost for every one added above 20). 4. Added generalised shell globbing everywhere I think it is useful, including sh/dx, dir -5. Made dir more friendly and give more info, you can do > < and a number now. +5. Made dir more compatible with ak1a and added 'to' and 'from' call searching +it should now do everything that ak1a does except counts. 22May99======================================================================= 1. added check for -1 from Date::Parse and return undef for out of range dates 2. added show/files and type commands diff --git a/cmd/Aliases b/cmd/Aliases index 578f8662..3aaddb28 100644 --- a/cmd/Aliases +++ b/cmd/Aliases @@ -42,6 +42,8 @@ package CmdAlias; '^di\w*/n\w*', 'directory new', 'directory', '^di\w*/o\w*', 'directory own', 'directory', '^di\w*/s\w*', 'directory subject', 'directory', + '^di\w*/t\w*', 'directory to', 'directory', + '^di\w*/f\w*', 'directory from', 'directory', '^di\w*/(\d+)-(\d+)', 'directory $1-$2', 'directory', '^di\w*/(\d+)', 'directory $1', 'directory', ], diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index d5f57c03..d982c3e3 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -44,14 +44,31 @@ It will interrupt the cluster just after the debug command has finished. === 0^DIRECTORY^List messages === 0^DIRECTORY ALL^List all messages === 0^DIRECTORY OWN^List your own messages -=== 0^DIRECTORY NEW^List your own new messages -List the messages in the messages directory. +=== 0^DIRECTORY NEW^List all new messages +=== 0^DIRECTORY TO ^List all messages to +=== 0^DIRECTORY FROM ^List all messages from +=== 0^DIRECTORY SUBJECT ^List all messages with in subject +=== 0^DIRECTORY ^List last messages +=== 0^DIRECTORY -^List messages message message +List the messages in the messages directory. If there is a 'p' one space after the message number then it is a -personal message. +personal message. If there is a '-' between the message number and the +'p' then this indicates that the message has been read. -If there is a - after the message number then this indicates that the -message has been read. +You can use shell escape characters such as '*' and '?' in the +fields. + +You can combine some of the various directory commands together eg:- + + DIR TO G1TLH 5 +or + DIR SUBJECT IOTA 200-250 + +You can abbreviate all the commands to one letter and use ak1a syntax:- + + DIR/T G1* 10 + DIR/S QSL 10-100 5 === 5^DIRECTORY-^ Sysops can see all users' messages. @@ -355,7 +372,7 @@ e.g. SH/DXCC G SH/DXCC W on 20m info iota -=== 0^SHOW/FILES []^List the contents of a filearea +=== 0^SHOW/FILES [ []]^List the contents of a filearea SHOW/FILES on its own will show you a list of the various fileareas available on the system. To see the contents of a particular file area type:- @@ -363,6 +380,10 @@ area type:- where is the name of the filearea you want to see the contents of. +You can also use shell globbing characters like '*' and '?' in a +string to see a selection of files in a filearea eg:- + SH/FILES bulletins arld* + See also TYPE - to see the contents of a file. === 0^SHOW/PREFIX ^Interrogate the prefix database diff --git a/cmd/directory.pl b/cmd/directory.pl index 1581041c..f5d1566d 100644 --- a/cmd/directory.pl +++ b/cmd/directory.pl @@ -12,61 +12,60 @@ my @ref; my $ref; my @out; my $f; -my $n = 10; - -if (!@f) { - my @all = (DXMsg::get_all()); - my ($i, $count); - for ($i = $#all; $i > 0; $i--) { - $ref = $all[$i]; - next if $self->priv < 5 && $ref->private && $ref->to ne $self->call && $ref->from ne $self->call; - unshift @ref, $ref; - last if ++$count >= $n; - } -} +my $n = 0; +my @all = grep {!($self->priv < 5 && $_->private && $_->to ne $self->call && $_->from ne $self->call)} (DXMsg::get_all()); +my $sel = 0; +my $from = 0; +my $to = $all[@all-1]->msgno; while (@f) { $f = uc shift @f; if ($f eq 'ALL') { - foreach $ref (DXMsg::get_all()) { - next if $self->priv < 5 && $ref->private && $ref->to ne $self->call && $ref->from ne $self->call; - push @ref, $ref; - } - last; + @ref = @all; + $n = @ref; + $sel++; } elsif ($f =~ /^O/o) { # dir/own - foreach $ref (DXMsg::get_all()) { - push @ref, $ref if $ref->private && ($ref->to eq $self->call || $ref->from eq $self->call); - } + @ref = grep { $_->to eq $self->call || $_->from eq $self->call } @all; + $sel++; } elsif ($f =~ /^N/o) { # dir/new - foreach $ref (DXMsg::get_all()) { - push @ref, $ref if $ref->private && !$ref->read && $ref->to eq $self->call; + @ref = grep { $_->t > $self->user->lastin } @all; + $sel++; + } elsif ($f =~ /^S/o) { # dir/subject + $f = shift @f; + if ($f) { + $f =~ s{(.)}{"\Q$1"}ge; + @ref = grep { $_->subject =~ m{$f}i } @all; + $sel++; } - } elsif ($f eq '>' || $f eq 'TO'){ + } elsif ($f eq '>' || $f =~ /^T/o){ $f = uc shift @f; if ($f) { $f = shellregex($f); - foreach $ref (DXMsg::get_all()) { - next if $self->priv < 5 && $ref->private && $ref->to ne $self->call && $ref->from ne $self->call; - next unless $ref->to =~ m{$f}; - push @ref, $ref; - } + @ref = grep { $_->to =~ m{$f} } @all; + $sel++; } - } elsif ($f eq '<' || $f eq 'FROM'){ + } elsif ($f eq '<' || $f =~ /^F/o){ $f = uc shift @f; if ($f) { $f = shellregex($f); - foreach $ref (DXMsg::get_all()) { - next if $self->priv < 5 && $ref->private && $ref->to ne $self->call && $ref->from ne $self->call; - next unless $ref->from =~ m{$f}; - push @ref, $ref; - } + @ref = grep { $_->from =~ m{$f} } @all; + $sel++; } + } elsif ($f =~ /^(\d+)-(\d+)$/) { # a range of items + $from = $1; + $to = $2; } elsif ($f =~ /^\d+$/ && $f > 0) { # a number of items $n = $f; } } +$n = 10 unless $n; +@ref = @all unless $sel || @ref; + if (@ref) { + if ($from != 0 || $to != $all[@all-1]->msgno) { + @ref = grep {$_->msgno >= $from && $_->msgno <= $to} @ref; + } my $i = @ref - $n; $i = 0 unless $i > 0; my $count; diff --git a/cmd/show/dx.pl b/cmd/show/dx.pl index d52826df..700138b6 100644 --- a/cmd/show/dx.pl +++ b/cmd/show/dx.pl @@ -85,7 +85,7 @@ if (@freq) { # any info if ($info) { $expr .= " && " if $expr; - $info = shellregex($info); + $info =~ s{(.)}{"\Q$1"}ge; $expr .= "\$f3 =~ m{$info}io"; } diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index 9bde6aa8..754cd538 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -84,6 +84,7 @@ sub alloc die "trying to create a duplicate channel for $call" if $channels{$call}; $self->{call} = $call; + $self->{priv} = 0; $self->{conn} = $conn if defined $conn; # if this isn't defined then it must be a list if (defined $user) { $self->{user} = $user;