done more work on directory now really quite ak1a compatible
authordjk <djk>
Sun, 23 May 1999 15:32:32 +0000 (15:32 +0000)
committerdjk <djk>
Sun, 23 May 1999 15:32:32 +0000 (15:32 +0000)
made sure that a channel has a privilege - even if it is 0

Changes
cmd/Aliases
cmd/Commands_en.hlp
cmd/directory.pl
cmd/show/dx.pl
perl/DXChannel.pm

diff --git a/Changes b/Changes
index d5fa4718dc31037674edde1dc44e40a36328a865..ead5ce087437f2a79d5490d3250877d5f8f37fc5 100644 (file)
--- 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
index 578f86621fe60f260917aa26aa730c63f539e0db..3aaddb28318b2a249aba6f4816572e19225d95cc 100644 (file)
@@ -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',
        ],
index d5f57c03d8fff668c0e5048cdc35416f6badbe90..d982c3e39d0df51e73180fc5d134eedfa1408090 100644 (file)
@@ -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 <call>^List all messages to <call>
+=== 0^DIRECTORY FROM <call>^List all messages from <call>
+=== 0^DIRECTORY SUBJECT <string>^List all messages with <string> in subject
+=== 0^DIRECTORY <nn>^List last <nn> messages
+=== 0^DIRECTORY <from>-<to>^List messages <from> message <to> 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 <call>
+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 [<filearea>]^List the contents of a filearea
+=== 0^SHOW/FILES [<filearea> [<string>]]^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 <filearea> 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 <callsign>^Interrogate the prefix database 
index 1581041cb4ce5d6d6149fdcc9457c2462731b396..f5d1566d12cb4d53bba749474fc4600087573622 100644 (file)
@@ -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;
index d52826dff67ed4b3dc4e16ebdb6d17f8767fcdfa..700138b6d27de3e55c40cf83409583fb7d2b5e83 100644 (file)
@@ -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";
 }
 
index 9bde6aa8fe4a30829b5dfed54895ec92250fd0b7..754cd5387127edab92d73b6ebec42a93199b5f05 100644 (file)
@@ -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;