- }
-
- # now save all the 'to' callsigns for later
- my $to = $oref->from;
- $loc->{to} = [ $to ]; # to is an array
- $loc->{subject} = $oref->subject;
- $loc->{subject} = "Re: " . $loc->{subject} if !($loc->{subject} =~ /^Re:.\s/io);
-
- # find me and set the state and the function on my state variable to
- # keep calling me for every line until I relinquish control
- $self->func("DXMsg::do_send_stuff");
- $self->state('sendbody');
- #push @out, $self->msg('sendsubj');
- push @out, "Reply to: $to";
- push @out, "Subject : $loc->{subject}";
- push @out, "Enter Message /EX (^Z) to send or /ABORT (^Y) to exit";
+ my $oref;
+
+ # check we have a reply number
+ # $DB::single = 1;
+
+ if ($i < @f) {
+ $oref = DXMsg::get($f[$i]);
+ if (!$oref) {
+ delete $self->{loc};
+ return (0, "can't access message $i");
+ }
+ } else {
+ if (!($oref = DXMsg::get($self->lastread))) {
+ delete $self->{loc};
+ #return (0, $self->msg('esend2'));
+ return (0, "need a message number");
+ }
+ }
+
+ # now save all the 'to' callsigns for later
+ my $to = $oref->from;
+ $loc->{to} = [ $to ]; # to is an array
+ $loc->{subject} = $oref->subject;
+ $loc->{subject} = "Re: " . $loc->{subject} if !($loc->{subject} =~ /^Re:\s/io);
+
+ # find me and set the state and the function on my state variable to
+ # keep calling me for every line until I relinquish control
+ $self->func("DXMsg::do_send_stuff");
+ $self->state('sendbody');
+ #push @out, $self->msg('sendsubj');
+ push @out, "Reply to: $to";
+ push @out, "Subject : $loc->{subject}";
+ push @out, "Enter Message /EX (^Z) to send or /ABORT (^Y) to exit";