| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# This code is part of Perl distribution Mail-Box version 4.01. |
|
2
|
|
|
|
|
|
|
# The POD got stripped from this file by OODoc version 3.05. |
|
3
|
|
|
|
|
|
|
# For contributors see file ChangeLog. |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# This software is copyright (c) 2001-2025 by Mark Overmeer. |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under |
|
8
|
|
|
|
|
|
|
# the same terms as the Perl 5 programming language system itself. |
|
9
|
|
|
|
|
|
|
# SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package Mail::Box::Dir;{ |
|
13
|
|
|
|
|
|
|
our $VERSION = '4.01'; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
14
|
|
|
14
|
|
9751
|
use parent 'Mail::Box'; |
|
|
14
|
|
|
|
|
35
|
|
|
|
14
|
|
|
|
|
105
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
14
|
|
|
14
|
|
1179
|
use strict; |
|
|
14
|
|
|
|
|
30
|
|
|
|
14
|
|
|
|
|
377
|
|
|
19
|
14
|
|
|
14
|
|
80
|
use warnings; |
|
|
14
|
|
|
|
|
87
|
|
|
|
14
|
|
|
|
|
1070
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
14
|
|
|
14
|
|
88
|
use Log::Report 'mail-box', import => [ qw/__x error warning/ ]; |
|
|
14
|
|
|
|
|
54
|
|
|
|
14
|
|
|
|
|
132
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
14
|
|
|
14
|
|
11336
|
use Mail::Box::Dir::Message (); |
|
|
14
|
|
|
|
|
45
|
|
|
|
14
|
|
|
|
|
444
|
|
|
24
|
14
|
|
|
14
|
|
107
|
use Mail::Message::Body::Lines (); |
|
|
14
|
|
|
|
|
40
|
|
|
|
14
|
|
|
|
|
268
|
|
|
25
|
14
|
|
|
14
|
|
144
|
use Mail::Message::Body::File (); |
|
|
14
|
|
|
|
|
31
|
|
|
|
14
|
|
|
|
|
271
|
|
|
26
|
14
|
|
|
14
|
|
3395
|
use Mail::Message::Body::Delayed (); |
|
|
14
|
|
|
|
|
36
|
|
|
|
14
|
|
|
|
|
338
|
|
|
27
|
14
|
|
|
14
|
|
85
|
use Mail::Message::Body::Multipart (); |
|
|
14
|
|
|
|
|
30
|
|
|
|
14
|
|
|
|
|
223
|
|
|
28
|
14
|
|
|
14
|
|
86
|
use Mail::Message::Head (); |
|
|
14
|
|
|
|
|
29
|
|
|
|
14
|
|
|
|
|
299
|
|
|
29
|
14
|
|
|
14
|
|
7939
|
use Mail::Message::Head::Delayed (); |
|
|
14
|
|
|
|
|
85
|
|
|
|
14
|
|
|
|
|
530
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
14
|
|
|
14
|
|
590
|
use File::Spec::Functions qw/rel2abs/; |
|
|
14
|
|
|
|
|
784
|
|
|
|
14
|
|
|
|
|
11486
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#-------------------- |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub init($) |
|
36
|
35
|
|
|
35
|
0
|
88
|
{ my ($self, $args) = @_; |
|
37
|
|
|
|
|
|
|
|
|
38
|
35
|
|
33
|
98
|
|
375
|
$args->{body_type} //= sub { 'Mail::Message::Body::Lines' }; |
|
|
98
|
|
|
|
|
352
|
|
|
39
|
35
|
|
|
|
|
207
|
$self->SUPER::init($args); |
|
40
|
|
|
|
|
|
|
|
|
41
|
35
|
|
|
|
|
83
|
my $class = ref $self; |
|
42
|
35
|
|
33
|
|
|
272
|
my $directory = $self->{MBD_directory} = $args->{directory} || $self->directory; |
|
43
|
|
|
|
|
|
|
|
|
44
|
35
|
100
|
33
|
|
|
940
|
if(-d $directory) {;} |
|
|
|
50
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
elsif($args->{create} && $class->create($directory, %$args)) { ;} |
|
46
|
|
|
|
|
|
|
else |
|
47
|
0
|
|
|
|
|
0
|
{ error __x"no directory {dir} for folder of type.", dir => $directory, type => $class; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# About locking |
|
51
|
|
|
|
|
|
|
|
|
52
|
35
|
|
50
|
|
|
253
|
my $lf = $args->{lock_file} // '.lock'; |
|
53
|
35
|
|
|
|
|
263
|
$self->locker->filename(rel2abs $lf, $directory); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Check if we can write to the folder, if we need to. |
|
56
|
|
|
|
|
|
|
|
|
57
|
35
|
50
|
66
|
|
|
229
|
if($self->writable && -e $directory && ! -w $directory) |
|
|
|
|
66
|
|
|
|
|
|
58
|
0
|
|
|
|
|
0
|
{ warning __x"folder directory {dir} is write-protected.", dir => $directory; |
|
59
|
0
|
|
|
|
|
0
|
$self->access('r'); |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
35
|
|
|
|
|
170
|
$self; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
#-------------------- |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub organization() { 'DIRECTORY' } |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
#-------------------- |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub directory() |
|
72
|
153
|
|
|
153
|
1
|
438
|
{ my $self = shift; |
|
73
|
153
|
|
66
|
|
|
962
|
$self->{MBD_directory} ||= $self->folderToDirectory($self->name, $self->folderdir); |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub nameOfSubFolder($;$) |
|
77
|
70
|
|
|
70
|
1
|
180
|
{ my ($thing, $name) = (shift, shift); |
|
78
|
70
|
50
|
|
|
|
239
|
my $parent = @_ ? shift : ref $thing ? $thing->directory : undef; |
|
|
|
100
|
|
|
|
|
|
|
79
|
70
|
50
|
|
|
|
354
|
defined $parent ? "$parent/$name" : $name; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
#-------------------- |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub folderToDirectory($$) |
|
85
|
91
|
|
|
91
|
1
|
261
|
{ my ($class, $name, $folderdir) = @_; |
|
86
|
91
|
100
|
|
|
|
456
|
my $dir = ($name =~ m#^=\/?(.*)# ? "$folderdir/$1" : $name); |
|
87
|
91
|
|
|
|
|
479
|
$dir =~ s!/$!!r; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub storeMessage($) |
|
91
|
780
|
|
|
780
|
1
|
1419
|
{ my ($self, $message) = @_; |
|
92
|
780
|
|
|
|
|
2728
|
$self->SUPER::storeMessage($message); |
|
93
|
780
|
100
|
|
|
|
2046
|
my $fn = $message->filename or return $message; |
|
94
|
738
|
|
|
|
|
3613
|
$self->{MBD_by_fn}{$fn} = $message; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
|
98
|
0
|
|
|
0
|
1
|
|
sub messageInFile($) { $_[0]->{MBD_by_fn}{$_[1]} } |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
101
|
0
|
|
|
0
|
1
|
|
sub readMessageFilenames() { $_[0]->notImplemented } |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |