You can get rid of any message to or originating from your callsign using
this command. You can remove more than one message at a time.
-=== 5^KILL-^
+=== 5^KILL <from>-<to>^Remove a range of messages from the system
+=== 5^KILL FROM <call>^Remove all messages from a callsign
+=== 5^KILL TO <call>^Remove all messages to a callsign
+=== 5^KILL FULL <msgno> [<msgno]^Remove a message from the entire cluster
+Remove this message from the entire cluster system as well as your node.
+
+=== 5^KILL^
As a sysop you can kill any message on the system.
=== 5^MERGE <node> [<no spots>/<no wwv>]^Ask for the latest spots and WWV
# $Id$
#
+use strict;
+
my ($self, $line) = @_;
my @f = split /\s+/, $line;
my $msgno;
my @out;
my @body;
my $ref;
+my @refs;
my $call = $self->call;
my $full;
-if ($f[0] =~ /^f/io) {
- return (1, $self->msg('e5')) if $self->priv < 5;
- $full = 1;
- shift @f;
-}
-
# $DB::single = 1;
-for $msgno (@f) {
- $ref = DXMsg::get($msgno);
- if (!$ref) {
- push @out, "Msg $msgno not found";
- next;
- }
- if ($self->priv < 5 &&
- (($ref->private && $ref->to ne $self->call && $ref->from ne $self->call) ||
- ($ref->private == 0 && $ref->from ne $self->call))) {
- push @out, "Msg $msgno not available";
- next;
- }
- Log('msg', "Message $ref->{msgno} from $ref->{from} to $ref->{to} deleted by $call");
- if ($full) {
- DXProt::broadcast_all_ak1a(DXProt::pc49($self->call, $ref->{subject}), $DXProt::me);
- }
- $ref->del_msg;
- push @out, "Message $msgno deleted";
+while (@f) {
+ my $f = shift @f;
+ if ($f =~ /^fu/io) {
+ return (1, $self->msg('e5')) if $self->priv < 5;
+ $full = 1;
+ } elsif ($f =~ /^\d+$/o) {
+ $ref = DXMsg::get($f);
+ if (!$ref) {
+ push @out, "Msg $f not found";
+ next;
+ }
+ if ($self->priv < 5 && $ref->to ne $call && $ref->from ne $call) {
+ push @out, "Msg $f not available";
+ next;
+ }
+ push @refs, $ref;
+ } elsif ($f =~ /(\d+)-(\d+)/) {
+ my $from = $1;
+ my $to = $2;
+ @refs = grep { !($self->priv < 5 && $_->to ne $call && $_->from ne $call) } DXMsg::get_all() unless @refs;
+ @refs = grep { $_->msgno >= $from && $_->msgno < $to } @refs;
+ } elsif ($f =~ /^fr/io) {
+ $f = shift @f;
+ if ($f) {
+ $f = shellregex($f);
+ @refs = grep { !($self->priv < 5 && $_->to ne $call && $_->from ne $call) } DXMsg::get_all() unless @refs;
+ @refs = grep { $_->from =~ m{$f}i } @refs;
+ }
+ } elsif ($f =~ /^to/io) {
+ $f = shift @f;
+ if ($f) {
+ $f = shellregex($f);
+ @refs = grep { !($self->priv < 5 && $_->to ne $call && $_->from ne $call) } DXMsg::get_all() unless @refs;
+ @refs = grep { $_->to =~ m{$f}i } @refs;
+ }
+ } else {
+ push @out, "invalid argument '$f'";
+ return (1, @out);
+ }
+}
+
+foreach $ref ( @refs) {
+ Log('msg', "Message $ref->{msgno} from $ref->{from} to $ref->{to} deleted by $call");
+ if ($full) {
+ DXProt::broadcast_all_ak1a(DXProt::pc49($self->call, $ref->{subject}), $DXProt::me);
+ }
+ $ref->del_msg;
+ push @out, "Message $ref->{msgno} deleted";
}
return (1, @out);