2 # a universal message mangling routine which allows the sysop
3 # tinker with the properties of a message
5 # Copyright (c) 1999 Dirk Koopman G1TLH
10 my ($self, $line) = @_;
11 return (1, $self->msg('e5')) if $self->priv < 6;
13 # a line is cmd, msgno, data
14 my @f = split /\s+/, $line, 3;
21 $cmd = shift @f if @f && $f[0] =~ /^\w+$/;
22 $msgno = shift @f if @f && $f[0] =~ /^\d+$/;
25 if ($cmd =~ /^qu/i && !$msgno) {
27 return (1, $self->msg('msg1'));
31 return (1, $self->msg('msg2'));
34 return (1, $self->msg('msgu')) unless $cmd && $msgno;
38 my $ref = DXMsg::get($msgno);
39 return (1, $self->msg('m13', $msgno)) unless $ref;
47 $new = $ref->to(uc $data);
48 } elsif ($cmd =~ /^fr/i) {
51 $new = $ref->from(uc $data);
52 } elsif ($cmd =~ /^pr/i) {
54 $old = $ref->private ? 'P' : 'B';
57 } elsif ($cmd =~ /^nop/i || $cmd =~ /^bu/i) {
59 $old = $ref->private ? 'P' : 'B';
62 } elsif ($cmd =~ /^re/i) {
64 $old = $ref->read ? 'Read' : 'Unread';
67 } elsif ($cmd =~ /^(nore|unre)/i) {
69 $old = $ref->read ? 'Read' : 'Unread';
72 } elsif ($cmd =~ /^rr/i) {
74 $old = $ref->rrreq ? 'RR Req' : 'No RR Req';
77 } elsif ($cmd =~ /^norr/i) {
79 $old = $ref->rrreq ? 'RR Req' : 'No RR Req';
82 } elsif ($cmd =~ /^ke/i) {
84 $old = $ref->keep ? 'Keep' : 'No Keep';
87 } elsif ($cmd =~ /^noke/i) {
89 $old = $ref->keep ? 'Keep' : 'No Keep';
92 } elsif ($cmd =~ /^node/i) {
94 $old = $ref->delete ? 'Delete' : 'Not Delete';
97 } elsif ($cmd =~ /^su/i) {
100 $new = $ref->subject($data);
101 } elsif ($cmd =~ /^wa/i) {
103 $old = cldatetime($ref->waitt) || 'None';
107 return (1, $self->msg('e15', $cmd));
110 # store changes and return
111 $ref->store( [ $ref->read_msg_body() ] );
112 return(1, $self->msg('msg3', $msgno, $m, $old, $new));