]> dxcluster.net Git - spider.git/commitdiff
Fix unset/startup cmd
authorDirk Koopman <djk@tobit.co.uk>
Wed, 22 Apr 2020 23:03:08 +0000 (00:03 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Wed, 22 Apr 2020 23:03:08 +0000 (00:03 +0100)
cmd/unset/startup.pl
perl/Messages
perl/Msg.pm
perl/Script.pm

index 60efbda6f9cf8976d37d41fb753045336c2bb9c9..a08601c424a5b3444fda2e6f6fe89a55aca4cd9e 100644 (file)
@@ -9,8 +9,4 @@ my ($self, $line) = @_;
 return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
 return (1, $self->msg('e5')) if $line && $self->priv < 5;
 
 return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
 return (1, $self->msg('e5')) if $line && $self->priv < 5;
 
-my @out;
-
-Script::erase($line || $self->call);
-push @out, $self->msg('done');
-return (1, @out);
+return (1, Script::erase($self));
index 8d64f7967e38abf32aac49cb97d57ca93ae60a9b..625fd5eeda12be66d50d09fe5584e926d70a2759 100644 (file)
@@ -206,8 +206,9 @@ package DXM;
                                m17 => 'Sorry, cannot send messages in $_[0] mode',
                                m18 => 'Sorry, message $_[0] is currently set to KEEP',
                                m19 => 'Startup Script for $_[0] saved, $_[1] lines',
                                m17 => 'Sorry, cannot send messages in $_[0] mode',
                                m18 => 'Sorry, message $_[0] is currently set to KEEP',
                                m19 => 'Startup Script for $_[0] saved, $_[1] lines',
-                               m20 => 'Empty Startup Script for $_[0] deleted',
+                               m20 => 'Startup Script for $_[0] deleted',
                                m21 => '$_[0] Working...',
                                m21 => '$_[0] Working...',
+                               m22 => 'Startup Script for $_[0] not found/error $!',
                                maxconnect => 'Max connections on $_[0] set to $_[1]',
                                msg1 => 'Bulletin Messages Queued',
                                msg2 => 'Private Messages Queued',
                                maxconnect => 'Max connections on $_[0] set to $_[1]',
                                msg1 => 'Bulletin Messages Queued',
                                msg2 => 'Private Messages Queued',
index 4400fe8d76482050f5d8974b599a6fcdeed55559..3c4b51f3d0d2504adff8ccaf7bd61781bf6163f9 100644 (file)
@@ -279,7 +279,7 @@ sub disconnect
                if ($sock->{buffer}) {
                        my $lth = length $sock->{buffer};
                        Mojo::IOLoop->timer($disc_waittime, sub {
                if ($sock->{buffer}) {
                        my $lth = length $sock->{buffer};
                        Mojo::IOLoop->timer($disc_waittime, sub {
-                                                                       dbg("Buffer contained $lth data , coordinated for $disc_waittime secs, now disconnecting $call") if $dbg;
+                                                                       dbg("Buffer contained $lth characters, coordinated for $disc_waittime secs, now disconnecting $call") if $dbg;
                                                                        _close_it($conn);
                                                                });
                } else {
                                                                        _close_it($conn);
                                                                });
                } else {
index 716ee46e84d1f9655d02a5659609b79aeeb55685..1e94ce595325e61cb69bd4c14ceb140330100751 100644 (file)
@@ -22,7 +22,7 @@ my $base = "$main::root/scripts";
 sub clean
 {
        my $s = shift;
 sub clean
 {
        my $s = shift;
-       $s =~ s/[^-\w\.]//g;
+       $s =~ s/([-\w\d_]+)/$1/g;
        return $s;
 }
 
        return $s;
 }
 
@@ -118,5 +118,26 @@ sub lines
 sub erase
 {
        my $self = shift;
 sub erase
 {
        my $self = shift;
-       unlink $self->{fn};
+       my $call = clean($self->call);
+
+       my $fn;
+       my $try;
+
+       $try = "$base/" . clean(lc $self->call);
+       if (-w $try) {
+               $fn = $try;
+       } else {
+               $try = "$base/" . clean(uc $self->call);
+               if (-w $try) {
+                       $fn = $try;
+               }
+       }
+
+       if ($fn && -w $fn) {
+               unless (unlink $fn) {
+                       return ($self->msg('m22'. $call)); 
+               }
+               return ($self->msg('m20', $call));
+       }
+       return ($self->msg('e3', "unset/startup", $call));
 }
 }