1. added $actiondata to filter line to allow per action data such as no of hops
[spider.git] / perl / DXCommandmode.pm
index 2094cbfaea51d6e9abdf4cec110ac1b29093f3f3..d05af70a2936bd67c3ee9aec70b5a3142c8c0426 100644 (file)
@@ -22,6 +22,7 @@ use DXLogPrint;
 use DXBearing;
 use CmdAlias;
 use FileHandle;
+use Filter;
 use Carp;
 
 use strict;
@@ -87,6 +88,9 @@ sub start
        $self->send($self->msg('qll')) if !$user->qra || (!$user->lat && !$user->long);
        $self->send($self->msg('hnodee1')) if !$user->qth;
        $self->send($self->msg('msgnew')) if DXMsg::for_me($call);
+
+       # get the filters
+       $self->{spotfilter} = Filter::read_in('spots', $call);
        
        $self->send($self->msg('pr', $call));
 }
@@ -129,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;