added inscript test to selected commands

fixed problem with dxcommandmode in perl < 5.8
added spanish translations for script commands
This commit is contained in:
minima 2005-01-15 22:03:46 +00:00
parent 117cd27e25
commit 5f2487385b
32 changed files with 69 additions and 29 deletions

View File

@ -1,3 +1,9 @@
15Jan05=======================================================================
1. knocked over a few possible ways of people annoying other people thru
the use of scripts
2. Fixed problem in DXCommandmode with an indirect call that did not work
in perl < 5.8.0.
3. Add Spanish translations of new scripting commands in help.
13Jan05=======================================================================
1. Fixed prompting in languages other than English.
2. Fixed language problem with spoof, but that simply hides a whole can of

View File

@ -1754,8 +1754,6 @@ SEND messages to the sysop.
=== 6^SET/STARTUP <call>^Create a user startup script
=== 0^SET/STARTUP^Create your own startup script
=== 6^UNSET/STARTUP <call>^Remove a user startup script
=== 0^UNSET/STARTUP^Remove your own startup script
Create a startup script of DXSpider commands which will be executed
everytime that you login into this node. You can only input the whole
script afresh, it is not possible to 'edit' it. Inputting a new script is
@ -1766,6 +1764,10 @@ You may find the (curiously named) command BLANK useful to break
up the output. If you simply want a blank line, it is easier to
input one or more spaces and press the <return> key.
See UNSET/STARTUP to remove a script.
=== 6^UNSET/STARTUP <call>^Remove a user startup script
=== 0^UNSET/STARTUP^Remove your own startup script
You can remove your startup script with UNSET/STARTUP.
=== 5^SET/SPIDER <call> [<call>..]^Make the callsign an DXSpider node

View File

@ -1739,6 +1739,30 @@ en modo de SOLO-RECIBIR no pudiendo usar los comandos DX, ANN, etc.
La única excepción que se le hace a un usuario no registrado es la
de poder enviar un TALK o un mensaje al sysop.
=== 6^SET/STARTUP <Indicativo> Crea un fichero de inicio de conexión para un usuario.
=== 0^SET/STARTUP Crea tu propio fichero de inicio de conexión.
Crea un fichero de conexión con los comandos del cluster que se
ejecutarán cada vez que conectes. Sólo se puede crear el fichero
completo, no pudiéndolo editar parcialmente. Hacer un fichero
personal de inicio de conexión es como hacer un mensaje con el
comando SEND. Para terminar el fichero escribe: /EX en la última
línea, para abandonar la creación de este fichero escribe: /ABORT.
Puedes encontrar útil el comando "BLANK" para que la salida de datos
que pedimos en el fichero de conexión la tengamos en líneas separadas.
Si sólo quieres una línea en blanco, puedes hacer una línea con uno o
más espacios en blanco y darle ENTER.
Puedes borrar tu fichero de conexión con el comando UNSET/STARTUP.
SHOW/STARTUP <Indicativo> Ver el fichero de inicio de conexión de un usuario.
SHOW/STARTUP Ver tu propio fichero de inicio de conexión
Para ver el contenido del fichero de conexión creado con SET/STARTUP.
=== 6^UNSET/STARTUP <Indicativo> Borra el fichero de inicio de conexión de un usuario
=== 0^UNSET/STARTUP Borra tu fichero de inicio de conexión.
Puedes borrar tu fichero de conexión con el comando UNSET/STARTUP.
=== 0^SET/TALK^Acepta mensajes TALK
=== 0^UNSET/TALK^Deshabilita la recepción de mensajes TALK
@ -2118,6 +2142,10 @@ especifiques. podr
sh/route n2tly
=== 6^SHOW/STARTUP <Indicativo> Ver el fichero de inicio de conexión de un usuario.
=== 0^SHOW/STARTUP Ver tu propio fichero de inicio de conexión
Para ver el contenido del fichero de conexión creado con SET/STARTUP.
=== 0^SHOW/SATELLITE <nombre> [<horas> <intervalo>]^Muestra datos de seguimiento
Muestra los datos para el seguimiento desde tu situación para un satélite
que elijas, desde ahora o para las próximas horas.

View File

@ -17,7 +17,7 @@
my ($self, $line) = @_;
my @f = split /\s+/, $line;
return (1, $self->msg('e5')) if $self->remotecmd;
return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
return (1, $self->msg('e9')) if !@f;
return (1, $self->msg('e28')) unless $self->registered;

View File

@ -5,6 +5,7 @@
#
my $self = shift;
return (1, $self->msg('e5')) if $self->inscript;
# log out text
if ($self->is_user && -e "$main::data/logout") {

View File

@ -10,7 +10,7 @@
my ($self, $line) = @_;
my @f = split /\s+/, $line, 2;
return (1, $self->msg('e5')) if $self->remotecmd;
return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
return (1, $self->msg('e34')) unless @f == 2;
return (1, $self->msg('e28')) unless $self->registered;

View File

@ -16,7 +16,7 @@ my $mycall = $self->call;
return (1, $self->msg('e7', $call)) unless $dxchan;
return (1, $self->msg('e31', $call)) unless $dxchan->is_user;
if ($self->remotecmd) {
if ($self->remotecmd || $self->inscript) {
Log('DXCommand', "$mycall is trying to 'demo' to $call remotely");
return (1, $self->msg('e5'));
}

View File

@ -9,7 +9,7 @@
#
my ($self, $line) = @_;
return (1, $self->msg('e5')) if $self->priv < 9 || $self->remotecmd;
return (1, $self->msg('e5')) if $self->priv < 9 || $self->remotecmd || $self->inscript;
Log('DXCommand', $self->call . " do $line" );
eval "$line";
return (1, $@ ? $@ : "Ok, done $line" );

View File

@ -16,7 +16,7 @@ my $freq;
my @out;
my $valid = 0;
my $localonly;
return (1, $self->msg('e5')) if $self->remotecmd;
return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
return (1, $self->msg('e28')) unless $self->registered;
my @bad;

View File

@ -14,7 +14,7 @@ my @body;
my $ref;
my $fn;
return (1, $self->msg("e5")) if $self->priv < 9 || $self->consort ne 'local' || $self->remotecmd;
return (1, $self->msg("e5")) if $self->priv < 9 || $self->consort ne 'local' || $self->remotecmd || $self->inscript;
return (1, $self->msg("export1")) unless @f == 2 && $f[0] =~ /^\d+$/;
$msgno = $f[0];

View File

@ -9,7 +9,7 @@ my $self = shift;
my $line = shift;
my @f = split /\s+/, $line;
return (1, $self->msg('e5')) if $self->priv < 8 || $self->remotecmd;
return (1, $self->msg('e5')) if $self->priv < 8 || $self->remotecmd || $self->inscript;
my $call = uc shift @f;
my $dxchan = DXChannel->get($call);

View File

@ -9,7 +9,7 @@
#
my ($self, $line) = @_;
return (1, $self->msg('e5')) if $self->priv < 9 || $self->remotecmd;
return (1, $self->msg('e5')) if $self->priv < 9 || $self->remotecmd || $self->inscript;
my ($date_req, $time_req);
my $app_req = '>';

View File

@ -17,7 +17,7 @@
# $Id$
#
my ($self, $line) = @_;
return (1, $self->msg('e5')) if $self->remotecmd;
return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
return (1, $self->msg('e36')) unless $self->state =~ /^prompt/;
my @out;

View File

@ -20,7 +20,7 @@ if ($self->priv < 9) {
foreach $call (@args) {
$call = uc $call;
unless ($self->remotecmd) {
unless ($self->remotecmd || $self->inscript) {
if ($ref = DXUser->get_current($call)) {
$ref->lockout(1);
$ref->put();

View File

@ -13,7 +13,7 @@ my @out;
my $user;
my $ref;
if ($self->remotecmd) {
if ($self->remotecmd || $self->inscript) {
$call ||= $self->call;
Log('DXCommand', $self->call . " attempted to change passphrase for $call remotely");
return (1, $self->msg('e5'));

View File

@ -14,7 +14,7 @@ my @out;
my $user;
my $ref;
if ($self->remotecmd) {
if ($self->remotecmd || $self->inscript) {
$call ||= $self->call;
Log('DXCommand', $self->call . " attempted to change password for $call remotely");
return (1, $self->msg('e5'));

View File

@ -15,7 +15,7 @@ my @out;
my $user;
my $ref;
if ($self->priv < 9 || $self->remotecmd) {
if ($self->priv < 9 || $self->remotecmd || $self->inscript) {
Log('DXCommand', $self->call . " attempted to set privilege $priv for @args");
return (1, $self->msg('e5'));
}
@ -26,7 +26,7 @@ if ($priv < 0 || $priv > 9) {
foreach $call (@args) {
$call = uc $call;
unless ($self->remotecmd) {
unless ($self->remotecmd || $self->inscript) {
if ($ref = DXChannel->get($call)) {
$ref->priv($priv);
$ref->user->priv($priv);

View File

@ -21,7 +21,7 @@ return (1, $self->msg('reginac')) unless $main::reqreg;
foreach $call (@args) {
$call = uc $call;
unless ($self->remotecmd) {
unless ($self->remotecmd || $self->inscript) {
if ($ref = DXUser->get_current($call)) {
$ref->registered(1);
$ref->put();

View File

@ -6,7 +6,7 @@
# $Id$
#
my ($self, $line) = @_;
return (1, $self->msg('e5')) if $self->remotecmd;
return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
return (1, $self->msg('e5')) if $line && $self->priv < 6;
return (1, $self->msg('e36')) unless $self->state =~ /^prompt/;

View File

@ -6,7 +6,7 @@
# $Id$
#
my ($self, $line) = @_;
return (1, $self->msg('e5')) if $self->remotecmd;
return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
return (1, $self->msg('e5')) if $line && $self->priv < 5;
my @out;

View File

@ -9,7 +9,7 @@
#
my ($self, $line) = @_;
return (1, $self->msg('e5')) if $self->priv < 9 || $self->remotecmd;
return (1, $self->msg('e5')) if $self->priv < 9 || $self->remotecmd || $self->inscript;
return (1, $self->msg('e9')) unless $line;
my @f = split /\s+/, $line;
my $f;

View File

@ -15,7 +15,7 @@ my $mylang = $self->lang;
my ($call, $newline) = split /\s+/, $line, 2;
return (1, $self->msg('nodee1', $call)) if DXChannel->get($call);
if ($self->remotecmd) {
if ($self->remotecmd || $self->inscript) {
Log('DXCommand', "$mycall is trying to spoof $call remotely");
return (1, $self->msg('e5'));
}

View File

@ -12,7 +12,7 @@ my $via;
my $line;
my $from = $self->call;
my @out;
return (1, $self->msg('e5')) if $self->remotecmd;
return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
# analyse the line there are four situations...
# 1) talk call

View File

@ -20,7 +20,7 @@ if ($self->priv < 9) {
foreach $call (@args) {
$call = uc $call;
unless ($self->remotecmd) {
unless ($self->remotecmd || $self->inscript) {
if ($ref = DXUser->get_current($call)) {
$ref->lockout(0);
$ref->put();

View File

@ -12,7 +12,7 @@ my @out;
my $user;
my $ref;
if ($self->remotecmd) {
if ($self->remotecmd || $self->inscript) {
Log('DXCommand', $self->call . " attempted to unset passphrase for @args remotely");
return (1, $self->msg('e5'));
}

View File

@ -12,7 +12,7 @@ my @out;
my $user;
my $ref;
if ($self->remotecmd) {
if ($self->remotecmd || $self->inscript) {
Log('DXCommand', $self->call . " attempted to unset password for @args remotely");
return (1, $self->msg('e5'));
}

View File

@ -21,7 +21,7 @@ return (1, $self->msg('reginac')) unless $main::reqreg;
foreach $call (@args) {
$call = uc $call;
unless ($self->remotecmd) {
unless ($self->remotecmd || $self->inscript) {
if ($ref = DXUser->get_current($call)) {
$ref->registered(0);
$ref->put();

View File

@ -6,7 +6,7 @@
# $Id$
#
my ($self, $line) = @_;
return (1, $self->msg('e5')) if $self->remotecmd;
return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
return (1, $self->msg('e5')) if $line && $self->priv < 5;
my @out;

View File

@ -23,7 +23,7 @@ my $from = $self->call;
my $t = ztime(time);
my $tonode;
my $sysopflag;
return (1, $self->msg('e5')) if $self->remotecmd;
return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
return (1, $self->msg('e28')) unless $self->registered;
if ($sort eq "FULL") {

View File

@ -116,6 +116,7 @@ $count = 0;
newroute => '1,New Style Routing,yesno',
ve7cc => '0,VE7CC program special,yesno',
lastmsgpoll => '0,Last Msg Poll,atime',
inscript => '9,In a script,yesno',
);
use vars qw($VERSION $BRANCH);

View File

@ -958,7 +958,7 @@ sub do_entry_stuff
my $loc = $self->{loc} || confess "local var gone missing" ;
if ($line eq "\032" || $line eq '%1A' || uc $line eq "/EX") {
no strict 'refs';
push @out, $loc->{endaction}($self);
push @out, &{$loc->{endaction}}($self); # like this for < 5.8.0
$self->func(undef);
$self->state('prompt');
} elsif ($line eq "\031" || uc $line eq "/ABORT" || uc $line eq "/QUIT") {

View File

@ -57,7 +57,9 @@ sub run
my $dxchan = shift;
foreach my $l (@{$self->{lines}}) {
unless ($l =~ /^\s*\#/ || $l =~ /^\s*$/) {
$dxchan->inscript(1);
my @out = DXCommandmode::run_cmd($dxchan, $l);
$dxchan->inscript(0);
if ($dxchan->can('send_ans')) {
$dxchan->send_ans(@out);
} else {