line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Email::Delete::Maildir; |
2
|
|
|
|
|
|
|
# $Id: Maildir.pm,v 1.1 2004/12/17 18:03:16 cwest Exp $ |
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
52
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use vars qw[$VERSION]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
68
|
|
6
|
|
|
|
|
|
|
$VERSION = '2.002'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use Email::Simple; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
269
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub delete_message { |
11
|
1
|
|
|
1
|
0
|
4
|
my %args = @_; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
|
|
2
|
my @files; |
14
|
|
|
|
|
|
|
# Whatever in F is undelivered yet, right? |
15
|
1
|
|
|
|
|
3
|
foreach my $sect ( qw( new cur ) ) { |
16
|
|
|
|
|
|
|
# What if C<$args{from}> is something but directory? Never mind, just skip it. |
17
|
2
|
50
|
|
|
|
68
|
opendir my($dh), "$args{from}/$sect" or next; |
18
|
2
|
|
|
|
|
60
|
while(my $mail = readdir $dh) { |
19
|
|
|
|
|
|
|
# Faild to open subfolder? Here? Immaterial, go away. |
20
|
7
|
100
|
|
|
|
312
|
-f "$args{from}/$sect/$mail" or next; |
21
|
3
|
50
|
|
|
|
120
|
open my $fh, '<', "$args{from}/$sect/$mail" or next; |
22
|
3
|
50
|
|
|
|
5
|
my $msg = Email::Simple->new(do { local $/; <$fh>; }) or next; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
137
|
|
23
|
3
|
100
|
|
|
|
408
|
$args{matching}->($msg) and push @files, "$args{from}/$sect/$mail"; |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
}; |
26
|
1
|
|
|
|
|
215
|
return unlink @files; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |