+# delete a message
+sub del_msg
+{
+ my $self = shift;
+
+ # remove it from the active message list
+ @msg = map { $_ != $self ? $_ : () } @msg;
+
+ # remove the file
+ unlink filename($self->{msgno});
+}
+
+# read in a message header
+sub read_msg_header
+{
+ my $fn = shift;
+ my $file;
+ my $line;
+ my $ref;
+ my @f;
+ my $size;
+
+ $file = new FileHandle;
+ if (!open($file, $fn)) {
+ print "Error reading $fn $!\n";
+ return undef;
+ }
+ $size = -s $fn;
+ $line = <$file>; # first line
+ chomp $line;
+ $size -= length $line;
+ if (! $line =~ /^===/o) {
+ print "corrupt first line in $fn ($line)\n";
+ return undef;
+ }
+ $line =~ s/^=== //o;
+ @f = split /\^/, $line;
+ $ref = DXMsg->alloc(@f);
+
+ $line = <$file>; # second line
+ chomp $line;
+ $size -= length $line;
+ if (! $line =~ /^===/o) {
+ print "corrupt second line in $fn ($line)\n";
+ return undef;
+ }
+ $line =~ s/^=== //o;
+ $ref->{gotit} = [];
+ @f = split /\^/, $line;
+ push @{$ref->{goit}}, @f;
+ $ref->{size} = $size;
+
+ close($file);
+
+ return $ref;
+}
+
+# read in a message header
+sub read_msg_body
+{
+ my $self = shift;
+ my $msgno = $self->{msgno};
+ my $file;
+ my $line;
+ my $fn = filename($msgno);
+ my @out;
+
+ $file = new FileHandle;
+ if (!open($file, $fn)) {
+ print "Error reading $fn $!\n";
+ return undef;
+ }
+ chomp (@out = <$file>);
+ close($file);
+
+ shift @out if $out[0] =~ /^=== \d+\^/;
+ shift @out if $out[0] =~ /^=== \d+\^/;
+ return @out;
+}
+