2 # kill or delete a message
4 # Copyright (c) 1998 Dirk Koopman G1TLH
11 my ($self, $line) = @_;
12 my @f = split /\s+/, $line;
18 my $call = $self->call;
27 return (1, $self->msg('e5')) if $self->priv < 5;
29 } elsif ($f =~ /^ex/io) {
30 return (1, $self->msg('e5')) if $self->priv < 6;
32 } elsif ($f =~ /^\d+$/o) {
33 $ref = DXMsg::get($f);
35 push @out, "Msg $f not found";
38 if ($self->priv < 5 && $ref->to ne $call && $ref->from ne $call) {
39 push @out, "Msg $f not available";
43 } elsif ($f =~ /(\d+)-(\d+)/) {
46 @refs = grep { !($self->priv < 5 && $_->to ne $call && $_->from ne $call) } DXMsg::get_all() unless @refs;
47 @refs = grep { $_->msgno >= $from && $_->msgno <= $to } @refs;
48 } elsif ($f =~ /^fr/io) {
52 @refs = grep { !($self->priv < 5 && $_->to ne $call && $_->from ne $call) } DXMsg::get_all() unless @refs;
53 @refs = grep { $_->from =~ m{$f}i } @refs;
55 } elsif ($f =~ /^to/io) {
59 @refs = grep { !($self->priv < 5 && $_->to ne $call && $_->from ne $call) } DXMsg::get_all() unless @refs;
60 @refs = grep { $_->to =~ m{$f}i } @refs;
63 push @out, "invalid argument '$f'";
68 foreach $ref ( @refs) {
70 push @out, $self->msg('m18', $ref->msgno);
73 my $tonode = $ref->tonode;
74 $ref->stop_msg($tonode) if $tonode;
75 $ref->mark_delete($expunge ? 0 : undef);
76 push @out, $self->msg('m12', $ref->msgno);
77 Log('msg', "Message $ref->{msgno} from $ref->{from} to $ref->{to} deleted by $call");
79 DXChannel::broadcast_nodes(DXProt::pc49($ref->{from}, $ref->{subject}), $main::me);