line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2020 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
|
|
1109
|
use vars '$VERSION'; |
|
25
|
|
|
|
|
59
|
|
|
25
|
|
|
|
|
1359
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.009'; |
12
|
|
|
|
|
|
|
|
13
|
25
|
|
|
25
|
|
149
|
use base 'Mail::Box::Message'; |
|
25
|
|
|
|
|
52
|
|
|
25
|
|
|
|
|
2447
|
|
14
|
|
|
|
|
|
|
|
15
|
25
|
|
|
25
|
|
160
|
use strict; |
|
25
|
|
|
|
|
55
|
|
|
25
|
|
|
|
|
525
|
|
16
|
25
|
|
|
25
|
|
125
|
use warnings; |
|
25
|
|
|
|
|
48
|
|
|
25
|
|
|
|
|
933
|
|
17
|
|
|
|
|
|
|
|
18
|
25
|
|
|
25
|
|
155
|
use List::Util qw/sum/; |
|
25
|
|
|
|
|
59
|
|
|
25
|
|
|
|
|
22417
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub init($) |
22
|
1304
|
|
|
1304
|
0
|
13638
|
{ my ($self, $args) = @_; |
23
|
1304
|
|
|
|
|
4088
|
$self->SUPER::init($args); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$self->fromLine($args->{from_line}) |
26
|
1304
|
50
|
|
|
|
2803
|
if exists $args->{from_line}; |
27
|
|
|
|
|
|
|
|
28
|
1304
|
|
|
|
|
2916
|
$self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub coerce($) |
32
|
98
|
|
|
98
|
1
|
1167
|
{ my ($self, $message) = @_; |
33
|
98
|
50
|
|
|
|
476
|
return $message if $message->isa(__PACKAGE__); |
34
|
98
|
|
|
|
|
376
|
$self->SUPER::coerce($message)->labelsToStatus; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub write(;$) |
39
|
126
|
|
|
126
|
1
|
188
|
{ my $self = shift; |
40
|
126
|
|
33
|
|
|
270
|
my $out = shift || select; |
41
|
|
|
|
|
|
|
|
42
|
126
|
|
|
|
|
252
|
my $escaped = $self->escapedBody; |
43
|
126
|
|
|
|
|
315
|
$out->print($self->fromLine); |
44
|
|
|
|
|
|
|
|
45
|
126
|
|
|
|
|
31975
|
my $size = sum 0, map {length($_)} @$escaped; |
|
5271
|
|
|
|
|
7192
|
|
46
|
|
|
|
|
|
|
|
47
|
126
|
|
|
|
|
445
|
my $head = $self->head; |
48
|
126
|
|
|
|
|
837
|
$head->set('Content-Length' => $size); |
49
|
126
|
|
|
|
|
11430
|
$head->set('Lines' => scalar @$escaped); |
50
|
126
|
|
|
|
|
9530
|
$head->print($out); |
51
|
|
|
|
|
|
|
|
52
|
126
|
|
|
|
|
30459
|
$out->print($_) for @$escaped; |
53
|
126
|
|
|
|
|
22045
|
$out->print("\n"); |
54
|
126
|
|
|
|
|
987
|
$self; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub clone() |
58
|
45
|
|
|
45
|
1
|
76
|
{ my $self = shift; |
59
|
45
|
|
|
|
|
146
|
my $clone = $self->SUPER::clone; |
60
|
45
|
|
|
|
|
880
|
$clone->{MBMM_from_line} = $self->{MBMM_from_line}; |
61
|
45
|
|
|
|
|
169
|
$clone; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#------------------------------------------- |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub fromLine(;$) |
68
|
126
|
|
|
126
|
1
|
182
|
{ my $self = shift; |
69
|
|
|
|
|
|
|
|
70
|
126
|
50
|
|
|
|
269
|
$self->{MBMM_from_line} = shift if @_; |
71
|
126
|
|
66
|
|
|
565
|
$self->{MBMM_from_line} ||= $self->head->createFromLine; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub escapedBody() |
76
|
126
|
|
|
126
|
1
|
262
|
{ my @lines = shift->body->lines; |
77
|
126
|
|
|
|
|
10200
|
s/^(\>*From )/>$1/ for @lines; |
78
|
126
|
|
|
|
|
276
|
\@lines; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
#------------------------------------------ |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub readFromParser($) |
85
|
1304
|
|
|
1304
|
1
|
2435
|
{ my ($self, $parser) = @_; |
86
|
1304
|
|
|
|
|
3946
|
my ($start, $fromline) = $parser->readSeparator; |
87
|
1304
|
100
|
|
|
|
139604
|
return unless $fromline; |
88
|
|
|
|
|
|
|
|
89
|
1264
|
|
|
|
|
3290
|
$self->{MBMM_from_line} = $fromline; |
90
|
1264
|
|
|
|
|
2089
|
$self->{MBMM_begin} = $start; |
91
|
|
|
|
|
|
|
|
92
|
1264
|
50
|
|
|
|
4253
|
$self->SUPER::readFromParser($parser) or return; |
93
|
1264
|
|
|
|
|
22242
|
$self; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
4063
|
|
|
4063
|
0
|
7834
|
sub loadHead() { shift->head } |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub loadBody() |
100
|
27
|
|
|
27
|
1
|
50
|
{ my $self = shift; |
101
|
|
|
|
|
|
|
|
102
|
27
|
|
|
|
|
109
|
my $body = $self->body; |
103
|
27
|
100
|
|
|
|
224
|
return $body unless $body->isDelayed; |
104
|
|
|
|
|
|
|
|
105
|
21
|
|
|
|
|
76
|
my ($begin, $end) = $body->fileLocation; |
106
|
21
|
|
|
|
|
75
|
my $parser = $self->folder->parser; |
107
|
21
|
|
|
|
|
100
|
$parser->filePosition($begin); |
108
|
|
|
|
|
|
|
|
109
|
21
|
|
|
|
|
548
|
my $newbody = $self->readBody($parser, $self->head); |
110
|
21
|
50
|
|
|
|
82017
|
unless($newbody) |
111
|
0
|
|
|
|
|
0
|
{ $self->log(ERROR => 'Unable to read delayed body.'); |
112
|
0
|
|
|
|
|
0
|
return; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
21
|
|
|
|
|
299
|
$self->log(PROGRESS => 'Loaded delayed body.'); |
116
|
21
|
|
|
|
|
513
|
$self->storeBody($newbody->contentInfoFrom($self->head)); |
117
|
|
|
|
|
|
|
|
118
|
21
|
|
|
|
|
7169
|
$newbody; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub fileLocation() |
123
|
626
|
|
|
626
|
1
|
179814
|
{ my $self = shift; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
wantarray |
126
|
|
|
|
|
|
|
? ($self->{MBMM_begin}, ($self->body->fileLocation)[1]) |
127
|
626
|
100
|
|
|
|
1874
|
: $self->{MBMM_begin}; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub moveLocation($) |
132
|
271
|
|
|
271
|
1
|
465
|
{ my ($self, $dist) = @_; |
133
|
271
|
|
|
|
|
495
|
$self->{MBMM_begin} -= $dist; |
134
|
|
|
|
|
|
|
|
135
|
271
|
|
|
|
|
627
|
$self->head->moveLocation($dist); |
136
|
271
|
|
|
|
|
3038
|
$self->body->moveLocation($dist); |
137
|
271
|
|
|
|
|
1835
|
$self; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
#------------------------------------------- |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
1; |