line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2023 by [Mark Overmeer]. |
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.03. |
5
|
|
|
|
|
|
|
# This code is part of distribution Mail-Box. Meta-POD processed with |
6
|
|
|
|
|
|
|
# OODoc into POD and HTML manual-pages. See README.md |
7
|
|
|
|
|
|
|
# Copyright Mark Overmeer. Licensed under the same terms as Perl itself. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Mail::Box::File::Message; |
10
|
25
|
|
|
25
|
|
1097
|
use vars '$VERSION'; |
|
25
|
|
|
|
|
57
|
|
|
25
|
|
|
|
|
1376
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.010'; |
12
|
|
|
|
|
|
|
|
13
|
25
|
|
|
25
|
|
171
|
use base 'Mail::Box::Message'; |
|
25
|
|
|
|
|
60
|
|
|
25
|
|
|
|
|
2467
|
|
14
|
|
|
|
|
|
|
|
15
|
25
|
|
|
25
|
|
189
|
use strict; |
|
25
|
|
|
|
|
74
|
|
|
25
|
|
|
|
|
589
|
|
16
|
25
|
|
|
25
|
|
138
|
use warnings; |
|
25
|
|
|
|
|
60
|
|
|
25
|
|
|
|
|
908
|
|
17
|
|
|
|
|
|
|
|
18
|
25
|
|
|
25
|
|
157
|
use List::Util qw/sum/; |
|
25
|
|
|
|
|
70
|
|
|
25
|
|
|
|
|
22512
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub init($) |
22
|
1304
|
|
|
1304
|
0
|
13429
|
{ my ($self, $args) = @_; |
23
|
1304
|
|
|
|
|
3910
|
$self->SUPER::init($args); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$self->fromLine($args->{from_line}) |
26
|
1304
|
50
|
|
|
|
2790
|
if exists $args->{from_line}; |
27
|
|
|
|
|
|
|
|
28
|
1304
|
|
|
|
|
2846
|
$self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub coerce($) |
32
|
98
|
|
|
98
|
1
|
1161
|
{ my ($self, $message) = @_; |
33
|
98
|
50
|
|
|
|
485
|
return $message if $message->isa(__PACKAGE__); |
34
|
98
|
|
|
|
|
374
|
$self->SUPER::coerce($message)->labelsToStatus; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub write(;$) |
39
|
126
|
|
|
126
|
1
|
217
|
{ my $self = shift; |
40
|
126
|
|
33
|
|
|
279
|
my $out = shift || select; |
41
|
|
|
|
|
|
|
|
42
|
126
|
|
|
|
|
294
|
my $escaped = $self->escapedBody; |
43
|
126
|
|
|
|
|
309
|
$out->print($self->fromLine); |
44
|
|
|
|
|
|
|
|
45
|
126
|
|
|
|
|
31975
|
my $size = sum 0, map {length($_)} @$escaped; |
|
5271
|
|
|
|
|
7181
|
|
46
|
|
|
|
|
|
|
|
47
|
126
|
|
|
|
|
454
|
my $head = $self->head; |
48
|
126
|
|
|
|
|
836
|
$head->set('Content-Length' => $size); |
49
|
126
|
|
|
|
|
11032
|
$head->set('Lines' => scalar @$escaped); |
50
|
126
|
|
|
|
|
9446
|
$head->print($out); |
51
|
|
|
|
|
|
|
|
52
|
126
|
|
|
|
|
28945
|
$out->print($_) for @$escaped; |
53
|
126
|
|
|
|
|
22094
|
$out->print("\n"); |
54
|
126
|
|
|
|
|
956
|
$self; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub clone() |
58
|
45
|
|
|
45
|
1
|
85
|
{ my $self = shift; |
59
|
45
|
|
|
|
|
142
|
my $clone = $self->SUPER::clone; |
60
|
45
|
|
|
|
|
987
|
$clone->{MBMM_from_line} = $self->{MBMM_from_line}; |
61
|
45
|
|
|
|
|
168
|
$clone; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#------------------------------------------- |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub fromLine(;$) |
68
|
126
|
|
|
126
|
1
|
186
|
{ my $self = shift; |
69
|
|
|
|
|
|
|
|
70
|
126
|
50
|
|
|
|
259
|
$self->{MBMM_from_line} = shift if @_; |
71
|
126
|
|
66
|
|
|
534
|
$self->{MBMM_from_line} ||= $self->head->createFromLine; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub escapedBody() |
76
|
126
|
|
|
126
|
1
|
268
|
{ my @lines = shift->body->lines; |
77
|
126
|
|
|
|
|
10818
|
s/^(\>*From )/>$1/ for @lines; |
78
|
126
|
|
|
|
|
254
|
\@lines; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
#------------------------------------------ |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub readFromParser($) |
85
|
1304
|
|
|
1304
|
1
|
2529
|
{ my ($self, $parser) = @_; |
86
|
1304
|
|
|
|
|
3766
|
my ($start, $fromline) = $parser->readSeparator; |
87
|
1304
|
100
|
|
|
|
143601
|
return unless $fromline; |
88
|
|
|
|
|
|
|
|
89
|
1264
|
|
|
|
|
3296
|
$self->{MBMM_from_line} = $fromline; |
90
|
1264
|
|
|
|
|
2029
|
$self->{MBMM_begin} = $start; |
91
|
|
|
|
|
|
|
|
92
|
1264
|
50
|
|
|
|
4125
|
$self->SUPER::readFromParser($parser) or return; |
93
|
1264
|
|
|
|
|
21240
|
$self; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
4063
|
|
|
4063
|
0
|
7439
|
sub loadHead() { shift->head } |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub loadBody() |
100
|
27
|
|
|
27
|
1
|
51
|
{ my $self = shift; |
101
|
|
|
|
|
|
|
|
102
|
27
|
|
|
|
|
71
|
my $body = $self->body; |
103
|
27
|
100
|
|
|
|
198
|
return $body unless $body->isDelayed; |
104
|
|
|
|
|
|
|
|
105
|
21
|
|
|
|
|
81
|
my ($begin, $end) = $body->fileLocation; |
106
|
21
|
|
|
|
|
76
|
my $parser = $self->folder->parser; |
107
|
21
|
|
|
|
|
102
|
$parser->filePosition($begin); |
108
|
|
|
|
|
|
|
|
109
|
21
|
|
|
|
|
524
|
my $newbody = $self->readBody($parser, $self->head); |
110
|
21
|
50
|
|
|
|
82558
|
unless($newbody) |
111
|
0
|
|
|
|
|
0
|
{ $self->log(ERROR => 'Unable to read delayed body.'); |
112
|
0
|
|
|
|
|
0
|
return; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
21
|
|
|
|
|
237
|
$self->log(PROGRESS => 'Loaded delayed body.'); |
116
|
21
|
|
|
|
|
545
|
$self->storeBody($newbody->contentInfoFrom($self->head)); |
117
|
|
|
|
|
|
|
|
118
|
21
|
|
|
|
|
7221
|
$newbody; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub fileLocation() |
123
|
626
|
|
|
626
|
1
|
180352
|
{ my $self = shift; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
wantarray |
126
|
|
|
|
|
|
|
? ($self->{MBMM_begin}, ($self->body->fileLocation)[1]) |
127
|
626
|
100
|
|
|
|
1918
|
: $self->{MBMM_begin}; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub moveLocation($) |
132
|
271
|
|
|
271
|
1
|
518
|
{ my ($self, $dist) = @_; |
133
|
271
|
|
|
|
|
471
|
$self->{MBMM_begin} -= $dist; |
134
|
|
|
|
|
|
|
|
135
|
271
|
|
|
|
|
611
|
$self->head->moveLocation($dist); |
136
|
271
|
|
|
|
|
3229
|
$self->body->moveLocation($dist); |
137
|
271
|
|
|
|
|
1755
|
$self; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
#------------------------------------------- |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
1; |