line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2019 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.02. |
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
|
|
1008
|
use vars '$VERSION'; |
|
25
|
|
|
|
|
46
|
|
|
25
|
|
|
|
|
1068
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.008'; |
12
|
|
|
|
|
|
|
|
13
|
25
|
|
|
25
|
|
121
|
use base 'Mail::Box::Message'; |
|
25
|
|
|
|
|
37
|
|
|
25
|
|
|
|
|
1983
|
|
14
|
|
|
|
|
|
|
|
15
|
25
|
|
|
25
|
|
133
|
use strict; |
|
25
|
|
|
|
|
68
|
|
|
25
|
|
|
|
|
452
|
|
16
|
25
|
|
|
25
|
|
101
|
use warnings; |
|
25
|
|
|
|
|
47
|
|
|
25
|
|
|
|
|
676
|
|
17
|
|
|
|
|
|
|
|
18
|
25
|
|
|
25
|
|
139
|
use List::Util qw/sum/; |
|
25
|
|
|
|
|
53
|
|
|
25
|
|
|
|
|
17678
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub init($) |
22
|
1304
|
|
|
1304
|
0
|
11737
|
{ my ($self, $args) = @_; |
23
|
1304
|
|
|
|
|
3685
|
$self->SUPER::init($args); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$self->fromLine($args->{from_line}) |
26
|
1304
|
50
|
|
|
|
2353
|
if exists $args->{from_line}; |
27
|
|
|
|
|
|
|
|
28
|
1304
|
|
|
|
|
2462
|
$self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub coerce($) |
32
|
98
|
|
|
98
|
1
|
939
|
{ my ($self, $message) = @_; |
33
|
98
|
50
|
|
|
|
394
|
return $message if $message->isa(__PACKAGE__); |
34
|
98
|
|
|
|
|
291
|
$self->SUPER::coerce($message)->labelsToStatus; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub write(;$) |
39
|
126
|
|
|
126
|
1
|
173
|
{ my $self = shift; |
40
|
126
|
|
33
|
|
|
229
|
my $out = shift || select; |
41
|
|
|
|
|
|
|
|
42
|
126
|
|
|
|
|
209
|
my $escaped = $self->escapedBody; |
43
|
126
|
|
|
|
|
242
|
$out->print($self->fromLine); |
44
|
|
|
|
|
|
|
|
45
|
126
|
|
|
|
|
25331
|
my $size = sum 0, map {length($_)} @$escaped; |
|
5271
|
|
|
|
|
5912
|
|
46
|
|
|
|
|
|
|
|
47
|
126
|
|
|
|
|
351
|
my $head = $self->head; |
48
|
126
|
|
|
|
|
692
|
$head->set('Content-Length' => $size); |
49
|
126
|
|
|
|
|
9145
|
$head->set('Lines' => scalar @$escaped); |
50
|
126
|
|
|
|
|
7785
|
$head->print($out); |
51
|
|
|
|
|
|
|
|
52
|
126
|
|
|
|
|
23324
|
$out->print($_) for @$escaped; |
53
|
126
|
|
|
|
|
18015
|
$out->print("\n"); |
54
|
126
|
|
|
|
|
862
|
$self; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub clone() |
58
|
45
|
|
|
45
|
1
|
59
|
{ my $self = shift; |
59
|
45
|
|
|
|
|
118
|
my $clone = $self->SUPER::clone; |
60
|
45
|
|
|
|
|
709
|
$clone->{MBMM_from_line} = $self->{MBMM_from_line}; |
61
|
45
|
|
|
|
|
136
|
$clone; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#------------------------------------------- |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub fromLine(;$) |
68
|
126
|
|
|
126
|
1
|
159
|
{ my $self = shift; |
69
|
|
|
|
|
|
|
|
70
|
126
|
50
|
|
|
|
230
|
$self->{MBMM_from_line} = shift if @_; |
71
|
126
|
|
66
|
|
|
449
|
$self->{MBMM_from_line} ||= $self->head->createFromLine; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub escapedBody() |
76
|
126
|
|
|
126
|
1
|
236
|
{ my @lines = shift->body->lines; |
77
|
126
|
|
|
|
|
8136
|
s/^(\>*From )/>$1/ for @lines; |
78
|
126
|
|
|
|
|
231
|
\@lines; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
#------------------------------------------ |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub readFromParser($) |
85
|
1304
|
|
|
1304
|
1
|
2159
|
{ my ($self, $parser) = @_; |
86
|
1304
|
|
|
|
|
3292
|
my ($start, $fromline) = $parser->readSeparator; |
87
|
1304
|
100
|
|
|
|
113234
|
return unless $fromline; |
88
|
|
|
|
|
|
|
|
89
|
1264
|
|
|
|
|
2840
|
$self->{MBMM_from_line} = $fromline; |
90
|
1264
|
|
|
|
|
1825
|
$self->{MBMM_begin} = $start; |
91
|
|
|
|
|
|
|
|
92
|
1264
|
50
|
|
|
|
3521
|
$self->SUPER::readFromParser($parser) or return; |
93
|
1264
|
|
|
|
|
18814
|
$self; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
4063
|
|
|
4063
|
0
|
6867
|
sub loadHead() { shift->head } |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub loadBody() |
100
|
27
|
|
|
27
|
1
|
42
|
{ my $self = shift; |
101
|
|
|
|
|
|
|
|
102
|
27
|
|
|
|
|
67
|
my $body = $self->body; |
103
|
27
|
100
|
|
|
|
172
|
return $body unless $body->isDelayed; |
104
|
|
|
|
|
|
|
|
105
|
21
|
|
|
|
|
58
|
my ($begin, $end) = $body->fileLocation; |
106
|
21
|
|
|
|
|
58
|
my $parser = $self->folder->parser; |
107
|
21
|
|
|
|
|
81
|
$parser->filePosition($begin); |
108
|
|
|
|
|
|
|
|
109
|
21
|
|
|
|
|
451
|
my $newbody = $self->readBody($parser, $self->head); |
110
|
21
|
50
|
|
|
|
68031
|
unless($newbody) |
111
|
0
|
|
|
|
|
0
|
{ $self->log(ERROR => 'Unable to read delayed body.'); |
112
|
0
|
|
|
|
|
0
|
return; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
21
|
|
|
|
|
198
|
$self->log(PROGRESS => 'Loaded delayed body.'); |
116
|
21
|
|
|
|
|
421
|
$self->storeBody($newbody->contentInfoFrom($self->head)); |
117
|
|
|
|
|
|
|
|
118
|
21
|
|
|
|
|
5927
|
$newbody; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub fileLocation() |
123
|
626
|
|
|
626
|
1
|
156408
|
{ my $self = shift; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
wantarray |
126
|
|
|
|
|
|
|
? ($self->{MBMM_begin}, ($self->body->fileLocation)[1]) |
127
|
626
|
100
|
|
|
|
1605
|
: $self->{MBMM_begin}; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub moveLocation($) |
132
|
271
|
|
|
271
|
1
|
370
|
{ my ($self, $dist) = @_; |
133
|
271
|
|
|
|
|
441
|
$self->{MBMM_begin} -= $dist; |
134
|
|
|
|
|
|
|
|
135
|
271
|
|
|
|
|
513
|
$self->head->moveLocation($dist); |
136
|
271
|
|
|
|
|
4035
|
$self->body->moveLocation($dist); |
137
|
271
|
|
|
|
|
1429
|
$self; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
#------------------------------------------- |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
1; |