1. added $actiondata to filter line to allow per action data such as no of hops
authordjk <djk>
Mon, 15 Mar 1999 17:59:38 +0000 (17:59 +0000)
committerdjk <djk>
Mon, 15 Mar 1999 17:59:38 +0000 (17:59 +0000)
2. fixed a silly problem in talk for non-existant callsigns
3. Added sysop command

14 files changed:
Changes
cmd/Commands_en.hlp
cmd/set/password.pl
cmd/talk.pl
filter/spots/GB7DJK.pl.issue
filter/spots/K1XX.pl.issue
perl/DXChannel.pm
perl/DXCommandmode.pm
perl/DXProt.pm
perl/DXUser.pm
perl/Filter.pm
perl/Messages
perl/convert_users.pl
perl/import_users.pl

diff --git a/Changes b/Changes
index 9c61e121a9cb05d40ea5d9c67a8d34fc1361491f..cf84bb9948b451c5ebd2a1fe3c3f480c522a4040 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,7 @@
+15Mar99=======================================================================
+1. added $actiondata to filter line to allow per action data such as no of hops
+2. fixed a silly problem in talk for non-existant callsigns
+3. Added sysop command
 02Mar99========================================================================
 1. Changed DXUser so that it uses a homemade import/export hash routine 
 2. DXUser now uses a DB_BTREE file
index 51cdc93b721bb7889765995a76ec8ccc14f7d014..a9e0e9f2ac9e50b01aa9bc547d4b08136a775d19 100644 (file)
@@ -274,10 +274,6 @@ of output from a command is more than this. The default is 20. Setting it
 explicitly to 0 will disable paging. 
   SET/PAGE 30
   SET/PAGE 0
-
-=== 0^SHOW/PROGRAM^Show the locations of all the included program modules
-Show the name and location where every program module was load from. This
-is useful for checking where you think you have loaded a .pm file from. 
  
 === 9^SET/PRIVILEGE <n> <call> [<call..]^Set privilege level on a call
 Set the privilege level on a callsign. The privilege levels that pertain
@@ -292,6 +288,11 @@ to commands are as default:-
 If you are a sysop and you come in as a normal user on a remote connection
 your privilege will automatically be set to 0.
 
+=== 9^SET/PASSWORD <callsign> <string>^Set a users password
+The password for a user can only be set by a full sysop. The string can contain
+any characters but any spaces are removed (you can type in spaces - but they
+won't appear in the password). You can see the result with STAT/USER.
 === 0^SET/QRA <locator>^Set your QRA locator
 === 9^SET/SYS_QRA <locator>^Set your cluster QRA locator
 Tell the system what your QRA (or Maidenhead) locator is. If you have not
@@ -361,6 +362,10 @@ together with the internal country no, the CQ and ITU regions.
 
 See also SHOW/DXCC
 
+=== 0^SHOW/PROGRAM^Show the locations of all the included program modules
+Show the name and location where every program module was load from. This
+is useful for checking where you think you have loaded a .pm file from. 
+
 === 0^SHOW/WWV^Show last 10 WWV broadcasts
 === 0^SHOW/WWV <n>^Show last <n> WWV broadcasts
 Display the most recent WWV information that has been received by the system
@@ -380,6 +385,28 @@ and stuff.
 
 Only the fields that are defined (in perl term) will be displayed.
 
+=== 0^SYSOP^Regain your privileges if you login remotely
+The system automatically reduces your privilege level to that of a normal user 
+if you login in remotely. This command allows you to regain your normal privilege
+level. It uses the normal system: five numbers are returned that are indexes into 
+the character array that is your assigned password (see set/password). The indexes
+start from zero. 
+
+You are expected to return a string which contains the characters required in the
+correct order. You may intersperse those characters with others to obscure your 
+reply for any watchers. For example (and these values are for explanation :-):
+
+password = 012345678901234567890123456789
+ > sysop
+22 10 15 17 3
+you type:-
+aa2bbbb0ccc5ddd7xxx3n
+or 2 0 5 7 3
+or 20573
+
+They will all match. If there is no password you will still be offered numbers but
+nothing will happen when you input a string. Any match is case sensitive.
+
 === 0^TALK <call> <text>^Send a text message to another station
 === 0^TALK <call> > <node> <text>^Send a text message to another station via a node
 Send a short message to any other station that is visible on the cluster
index b408278df2356b12da3a7c2b4571e7e3bfe99712..1aa425f610686a229cce343e06e01af1fd6d4e8b 100644 (file)
@@ -4,27 +4,26 @@
 # Copyright (c) 1998 Iain Phillips G0RDI
 # 21-Dec-1998
 #
-# Syntax:      set/pass <password> <callsign>
+# Syntax:      set/pass <callsign> <password> 
 #
 
 my ($self, $line) = @_;
 my @args = split /\s+/, $line;
-my $call;
-my $pass = shift @args;
+my $call = shift @args;
 my @out;
 my $user;
 my $ref;
 
 return (1, $self->msg('e5')) if $self->priv < 9;
 
-foreach $call (@args) {
-       $call = uc $call;
-       if ($ref = DXUser->get_current($call)) {
-               $ref->passwd($pass);
-               $ref->put();
-               push @out, $self->msg("password", $call);
-       } else {
-               push @out, $self->msg('e3', 'User record for', $call);
-       }
+if ($ref = DXUser->get_current($call)) {
+       $line =~ s/^\s*$call\s+//;
+       $line =~ s/\s+//og;                    # remove any blanks
+       $ref->passwd($line);
+       $ref->put();
+       push @out, $self->msg("password", $call);
+} else {
+       push @out, $self->msg('e3', 'User record for', $call);
 }
+
 return (1, @out);
index ebde8888ebd106101c082af5afff612489a218d7..2d647d0f68a635291149884fe504df29307ad83e 100644 (file)
@@ -29,7 +29,7 @@ my $ref = DXCluster->get($call);
 # if we haven't got an explicit via and we can't see them, try their node
 unless ($ref || $via) {
        my $user = DXUser->get($call);
-       $ref = DXCluster->get_exact($user->node);
+       $ref = DXCluster->get_exact($user->node) if $user;
        if ($ref) {
                $via = $user->node;
                push @out, "trying via $via..";
index 006ea2bfa1bb50ec8626016378e9a729144ea362..c69136cdf8fd39ad11f7c66a9f165402771cfb32 100644 (file)
 #   10 = spotter's itu
 #   11 = spotter's cq
 #
+# The spot data (in this case '15') is the used as the hop count
+# if this is missing then the normal default applies
+#
 
 $in = [
-          [ 1, 9, 'n', [ 14,15 ] ],   # 14 and 15 is CQ region for europe   
-          [ 1, 11, 'n', [ 14,15 ] ],  
+          [ 1, 9, 'n', [ 14,15 ], 15 ],   # 14 and 15 is CQ region for europe   
+          [ 1, 11, 'n', [ 14,15 ], 15 ],  
        [ 0, 0, 'd' ],
 ];
index 3f226ef15c4e74999fb11c3a12f49e59bb71be5c..e116564ff8518508a04fef881ad54244d8fd1533 100644 (file)
 #   10 = spotter's itu
 #   11 = spotter's cq
 #
+# The spot data (in this case '15') is the used as the hop count
+# if this is missing then the normal default applies
+#
 
 $in = [
-          [ 1, 5, 'n', [ 226 ] ],         # dxcc country 226 is the US
-          [ 1, 6, 'a', [ 226 ] ],
+          [ 1, 5, 'n', [ 226 ], 15 ],         # dxcc country 226 is the US
+          [ 1, 6, 'a', [ 226 ], 15 ],
        [ 0, 0, 'd' ],                  # default action (don't forward)
 ];
index 2b4fda78a20bf554916139a28157b52d20621342..e3878ecf719f6fe2c8181a2d11c8323821d59c0f 100644 (file)
@@ -73,6 +73,7 @@ use vars qw(%channels %valid);
                  annfilter => '9,Announce Filter',
                  wwvfilter => '9,WWV Filter',
                  spotfilter => '9,Spot Filter',
+                 passwd => '9,Passwd List,parray',
                 );
 
 # create a new channel object [$obj = DXChannel->new($call, $msg_conn_obj, $user_obj)]
index bce0255fd4750002963821575ccd462f5173ddda..d05af70a2936bd67c3ee9aec70b5a3142c8c0426 100644 (file)
@@ -133,6 +133,20 @@ sub normal
                } else {
                        $self->state('prompt');
                }
+       } elsif ($self->{state} eq 'sysop') {
+               my $passwd = $self->{user}->passwd;
+               my @pw = split / */, $passwd;
+               if ($passwd) {
+                       my @l = @{$self->{passwd}};
+                       my $str = "$pw[$l[0]].*$pw[$l[1]].*$pw[$l[2]].*$pw[$l[3]].*$pw[$l[4]]";
+                       if ($cmdline =~ /$str/) {
+                               $self->{priv} = $self->{user}->priv;
+                       } else {
+                               $self->send($self->msg('sorry'));
+                       }
+               }
+               delete $self->{passwd};
+               $self->state('prompt');
        } else {
                @ans = run_cmd($self, $cmdline);           # if length $cmdline;
                
index f218d5f33e223ab0a7de0ca25422493c9c240aab..7f145114feb61ecd5a9f9c66af2a797b61fc6c7b 100644 (file)
@@ -234,11 +234,17 @@ sub normal
                        my $dxchan;
        
                        # send it if it isn't the except list and isn't isolated and still has a hop count
+                       # taking into account filtering and so on
                        foreach $dxchan (@dxchan) {
                                next if $dxchan == $self;
-                               my $filter = Filter::it($dxchan->{spotfilter}, @spot) if $dxchan->{spotfilter};
-                               my $routeit = adjust_hops($dxchan, $line);  # adjust its hop count by node name
-                               next unless $routeit;
+                               my $routeit;
+                               my ($filter, $hops) = Filter::it($dxchan->{spotfilter}, @spot) if $dxchan->{spotfilter};
+                               if ($hops) {
+                                       $line =~ s/\^H\d+\^\~$/\^H$hops\^\~/;
+                               } else {
+                                       $routeit = adjust_hops($dxchan, $line);  # adjust its hop count by node name
+                                       next unless $routeit;
+                               }
                                if ($filter) {
                                        $dxchan->send($routeit) if $routeit;
                                } else {
@@ -808,7 +814,7 @@ sub broadcast_list
                
                if ($sort eq 'dx') {
                    next unless $dxchan->{dx};
-                       $filter = Filter::it($dxchan->{spotfilter}, @{$fref}) if ref $fref;
+                       ($filter) = Filter::it($dxchan->{spotfilter}, @{$fref}) if ref $fref;
                        next unless $filter;
                }
                next if $sort eq 'ann' && !$dxchan->{ann};
index 9ebc31d934c9bea25a55aaa49b2b7318a1844929..97aca375c325bccac68ac9fb609c46a4fc86ca19 100644 (file)
@@ -76,7 +76,7 @@ sub init
        my ($pkg, $fn, $mode) = @_;
   
        confess "need a filename in User" if !$fn;
-       $fn .= ".new";
+       $fn .= ".v2";
        if ($mode) {
                $dbm = tie (%u, 'DB_File', $fn, O_CREAT|O_RDWR, 0666, $DB_BTREE) or confess "can't open user file: $fn ($!)";
        } else {
index 4f1f4e5336d51228d9c1b266f054a3b1d1344cf7..2981a7b75e6d9f06523f314f1e2c70ce5542215d 100644 (file)
@@ -23,7 +23,7 @@
 #
 # <some comment>
 # @in = (
-#      [ action, fieldno, fieldsort, comparison ],
+#      [ action, fieldno, fieldsort, comparison, action data ],
 #      ...
 # );
 #
@@ -37,7 +37,8 @@
 # numeric, 'r' is ranges of pairs of numeric values and 'd' is default.
 #
 # Filter::it basically goes thru the list of comparisons from top to
-# bottom and when one matches it will return the action. The fields
+# bottom and when one matches it will return the action and the action data as a list. 
+# The fields
 # are the element nos of the list that is presented to Filter::it. Element
 # 0 is the first field of the list.
 #
@@ -69,27 +70,30 @@ sub init
 sub it
 {
        my $filter = shift;
+       my ($action, $field, $fieldsort, $comp, $actiondata);
        my $ref;
 
        # default action is 1
-       return 1 if !$filter;
-       
+       $action = 1;
+       $actiondata = "";
+       return ($action, $actiondata) if !$filter;
+
        for $ref (@{$filter}) {
-               my ($action, $field, $fieldsort, $comp) = @{$ref};
+               ($action, $field, $fieldsort, $comp, $actiondata) = @{$ref};
                if ($fieldsort eq 'n') {
                        my $val = $_[$field];
-                       return $action  if grep $_ == $val, @{$comp};
+                       return ($action, $actiondata)  if grep $_ == $val, @{$comp};
                } elsif ($fieldsort eq 'r') {
                        my $val = $_[$field];
                        my $i;
                        my @range = @{$comp};
                        for ($i = 0; $i < @range; $i += 2) {
-                               return $action if $val >= $range[$i] && $val <= $range[$i+1];
+                               return ($action, $actiondata)  if $val >= $range[$i] && $val <= $range[$i+1];
                        }
                } elsif ($fieldsort eq 'a') {
-                       return $action  if $_[$field] =~ m{$comp};
+                       return ($action, $actiondata)  if $_[$field] =~ m{$comp};
                } else {
-                       return $action;      # the default action
+                       return ($action, $actiondata);      # the default action
                }
        }
 }
@@ -133,7 +137,8 @@ sub write_out
        }
 
        my $today = localtime;
-       print FILTER "#
+       print FILTER "#!/usr/bin/perl
+#
 # Filter for $call stored $today
 #
 \$in = [
@@ -141,7 +146,7 @@ sub write_out
 
        my $ref;
        for $ref (@_) {
-               my ($action, $field, $fieldsort, $comp) = @{$ref};
+               my ($action, $field, $fieldsort, $comp, $actiondata) = @{$ref};
                print FILTER "\t[ $action, $field, $fieldsort,";
                if ($fieldsort eq 'n' || $fieldsort eq 'r') {
                        print FILTER "[ ", join (',', $comp), " ],";
index 0bd8bd2853340ca0108aee4c77bba719eee2cdac..4be9b10920a94cdf19dd4377f2211f268c4d5b3b 100644 (file)
@@ -104,6 +104,7 @@ package DXM;
                                shutting => '$main::mycall shutting down...',
                                sloc => 'Cluster lat $_[0] long $_[1], DON\'T FORGET TO CHANGE YOUR DXVars.pm',
                                sqra => 'Cluster QRA Locator$_[0], DON\'T FORGET TO CHANGE YOUR DXVars.pm',
+                               sorry => 'Sorry',
                                talks => 'Talk flag set on $_[0]',
                                talku => 'Talk flag unset on $_[0]',
                                usernf => '*** User record for $_[0] not found ***',
index bb39213145fbd66ae1eeff8890ed125546cb417f..4aa3978b19d03dfed622a5cab7287c13bc717332 100755 (executable)
@@ -51,7 +51,7 @@ package DXUser;
 
 for $a (@all) {
        my $ref = DXUser->get($a);
-       my $s = $ref->encode();
+       my $s = $ref->encode() if $ref;
        print OUT "'$a' => q{$s},\n" if $a;
        $count++;
 }
index 3111e064d8cd221b513d35ef599cf02cf3aa8791..d4cecbfded37907c933edae41524c301869dee8f 100755 (executable)
@@ -23,9 +23,8 @@ use DXUser;
 use Carp;
 
 $userfn = $ARGV[0] if @ARGV;
-unless ($userfn) {
-       croak "need a filename";
-}
+croak "need a filename" unless $userfn;
+croak "$userfn.asc doesn't exist" unless -e "$userfn.asc";
 
 DXUser->init($userfn, 1);