]> dxcluster.org Git - spider.git/commitdiff
put field 2 check for PC11 back to 'm'
authorminima <minima>
Wed, 1 Nov 2000 13:26:13 +0000 (13:26 +0000)
committerminima <minima>
Wed, 1 Nov 2000 13:26:13 +0000 (13:26 +0000)
Changes
perl/DXProt.pm
perl/Filter.pm
perl/Messages
perl/Spot.pm

diff --git a/Changes b/Changes
index 9b62c193beb82aa90746f5a3fbc536edc3b84355..224afe82a9e3bb0086b9a1f823c51ae40a4e3387 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,5 @@
+01Nov00=======================================================================
+1. put PC11 field 2 check back to m for pc text.
 31Oct00=======================================================================
 1. add 0x8e to the list of characters we clobber (make xterm go into graphics
 mode).
index 6ee7e13445d93d5a3a55f7242a2994791ab32f19..db342dfb028c5b0dd57d9fc6415024f167f2821b 100644 (file)
@@ -53,7 +53,7 @@ $baddxfn = "$main::data/baddx.pl";
 @checklist = 
 (
  [ qw(c c m bp bc c) ],                        # pc10
- [ qw(f c d t m c c h) ],              # pc11
+ [ qw(f m d t m c c h) ],              # pc11
  [ qw(c bc m bp bm p h) ],             # pc12
  [ qw(c h) ],                                  # 
  [ qw(c h) ],                                  # 
index 3d42fc34bc4fe73e4dd8d84548f2a397ae8a2afa..060f7ea8d75e7637b6931ff02032624db26f574f 100644 (file)
@@ -246,6 +246,70 @@ sub print
        return $self->{name};
 }
 
+package Filter::Cmd;
+
+use strict;
+use vars qw(@ISA);
+@ISA = qw(Filter);
+
+# the general purpose command processor
+# this is called as a subroutine not as a method
+sub process_cmd
+{
+       my ($self, $dxchan, $line) = @_;
+       my $ntoken = 0;
+       my $fno = 1;
+       my $filter;
+       my ($flag, $call);
+
+       # check the line for non legal characters
+       return ('ill', $dxchan->msg('e19')) if $line =~ /[^\s\w,_\/]/;
+       
+       while (my @f = split /\s+/, $line) {
+               if ($ntoken == 0) {
+                       
+                       if (@f && $dxchan->priv >= 9 && DXUser->get($f[0])) {
+                               $call = shift @f;
+                               if ($f[0] eq 'input') {
+                                       shift @f;
+                                       $flag++;
+                               }
+                       } else {
+                               $call = $dxchan->call;
+                       }
+
+                       if (@f && $f[0] =~ /^\d+$/) {
+                               $fno = shift @f;
+                       }
+
+                       $filter = Filter::read_in('spots', $call, $flag) or new Filter ('spots', $call, $flag);
+                       
+                       $ntoken++;
+                       next;
+               }
+
+               # do the rest of the filter tokens
+               if (@f) {
+                       my $tok = shift @f;
+                       if (@f) {
+                               my $val = shift @f;
+
+                               my $fref;
+                               foreach $fref (@$self) {
+                                       if ($fref->[0] eq $tok) {
+                                               
+                                       }
+                               }
+                       } else {
+                               return ('no', $dxchan->msg('filter2', $tok));
+                       }
+               }
+               
+       }
+       $flag = $flag ? "in_" : "";
+       return (0, $dxchan->msg('filter1', $fno, "$flag$call"));
+}
+
 package Filter::Old;
 
 use strict;
index 36168778025d849dfee108d5d704bf5f3aa40cbd..2b2ef76380e43153cd7a5ba1eaf6414234942f40 100644 (file)
@@ -37,6 +37,7 @@ package DXM;
                                db9 => 'Database $_[0] removed',
                                db10 => '$_[0] records imported into $_[1]',
                                db11 => 'Sending your request(s) to $_[0], please stand by...',
+                               dfreq1 => 'Invalid freq $_[0] need: eg 0/30000 or hf or hf/cw', 
                                dup => 'Sorry, this is a duplicate',
                                dx1 => 'Frequency $_[0] not in band (see show/band); usage: DX [BY call] freq call comments',
                                dx2 => 'Need a callsign; usage: DX [BY call] freq call comments',
@@ -60,6 +61,8 @@ package DXM;
                                e16 => 'File \"$_[0]\" exists',
                                e17 => 'Please don\'t use the words: @_ on here', 
                                e18 => 'Cannot connect to $_[0] ($!)',
+                               e19 => 'Invalid character in line',
+                               e20 => 'token $_[0] not recognised',
 
                                echoon => 'Echoing enabled',
                                echooff => 'Echoing disabled',
@@ -70,6 +73,8 @@ package DXM;
                                export1 => 'usage: export <msgno> <filename>',
                                export2 => '$_[3] has error exporting msg $_[0] to $_[1] ($_[2])',
                                export3 => '$_[2 ] exported msg $_[0] to $_[1]',
+                               filter1 => 'Filter $_[0] updated $_[1]',
+                               filter2 => 'Need a value for $_[0]',
                                grids => 'DX Grid flag set on $_[0]',
                                gridu => 'DX Grid flag unset on $_[0]',
                                helpe1 => 'Help system unavailable, tell sysop',
index e2b5c7eff3cd889f9780b153fa02d0049f10950e..c9178ddb13b3f8668d25676544d69a6365218512 100644 (file)
@@ -18,7 +18,7 @@ use Prefix;
 use DXDupe;
 
 use strict;
-use vars qw($fp $maxspots $defaultspots $maxdays $dirprefix $duplth $dupage);
+use vars qw($fp $maxspots $defaultspots $maxdays $dirprefix $duplth $dupage $filterdef);
 
 $fp = undef;
 $maxspots = 50;                                        # maximum spots to return
@@ -27,6 +27,49 @@ $maxdays = 35;                                       # normal maximum no of days to go back
 $dirprefix = "spots";
 $duplth = 20;                                  # the length of text to use in the deduping
 $dupage = 3*3600;               # the length of time to hold spot dups
+$filterdef = bless ([
+                         # tag, sort, field, priv, special parser 
+                         ['freq', 'r', 0, 0, \&decodefreq],
+                         ['call', 'c', 1],
+                         ['info', 't', 3],
+                         ['by', 'c', 4],
+                         ['call_dxcc', 'n', 5],
+                         ['by_dxcc', 'n', 6],
+                         ['origin', 'c', 7, 9],
+                         ['call_itu', 'n', 8],
+                         ['call_zone', 'n', 9],
+                         ['by_itu', 'n', 10],
+                         ['by_zone', 'n', 11],
+                         ['channel', 'n', 12, 9],
+                        ], 'Filter::Cmd');
+
+
+sub decodefreq
+{
+       my $dxchan = shift;
+       my $l = shift;
+       my @f = split /,/, $l;
+       my @out;
+       my $f;
+       
+       foreach $f (@f) {
+               my ($a, $b) = $f =~ m{^(\d+)/(\d+)$};
+               if ($a && $b) {
+                       push @out, $a, $b;
+               } elsif (($a, $b) = $f =~ m{^(\w+)(?:/(\w+))?$}) {
+                       $b = lc $b if $b;
+                       my @fr = Bands::get_freq(lc $a, $b);
+                       if (@fr) {
+                               push @out, @fr;    # add these to the list
+                       } else {
+                               return ('dfreq', $dxchan->msg('dfreq1', $f));
+                       }
+               } else {
+                       return ('dfreq', $dxchan->msg('e20', $f));
+               }
+       }
+       return (0, join(',', @out));                     
+}
 
 sub init
 {