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));
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...',
+ m22 => 'Startup Script for $_[0] not found/error $!',
maxconnect => 'Max connections on $_[0] set to $_[1]',
msg1 => 'Bulletin Messages Queued',
msg2 => 'Private Messages Queued',
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 {
sub clean
{
my $s = shift;
- $s =~ s/[^-\w\.]//g;
+ $s =~ s/([-\w\d_]+)/$1/g;
return $s;
}
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));
}