add sysop defined 'run' script and privilege commands
[spider.git] / cmd / run.pl
diff --git a/cmd/run.pl b/cmd/run.pl
new file mode 100644 (file)
index 0000000..4a04c4c
--- /dev/null
@@ -0,0 +1,32 @@
+#
+# the run command
+#
+# run a script from the scripts directory
+#
+# Copyright (c) 1998 Dirk Koopman G1TLH
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @f = split /\s+/, $line;
+my @out;
+
+while (@f) {
+       my $f = shift @f;
+       
+       if (is_callsign(uc $f) && $self->priv < 8 && uc $f ne $self->call) {
+               push @out, $self->msg('e5');
+               next;
+       }
+       $f =~ s|[^-\w/]||g;
+       my $script = new Script(lc $f);
+       unless ($script) {
+               push @out, $self->msg('e3', 'script', $f);
+               next;
+       }
+       $script->run($self);
+}
+
+return (1, @out);
+