line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2021 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-Message. 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::Message::Convert::MailInternet; |
10
|
1
|
|
|
1
|
|
686
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
64
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.011'; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
6
|
use base 'Mail::Message::Convert'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
477
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
16
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
543
|
use Mail::Internet; |
|
1
|
|
|
|
|
10908
|
|
|
1
|
|
|
|
|
33
|
|
19
|
1
|
|
|
1
|
|
7
|
use Mail::Header; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
20
|
1
|
|
|
1
|
|
5
|
use Mail::Message; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
21
|
1
|
|
|
1
|
|
5
|
use Mail::Message::Head::Complete; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
22
|
1
|
|
|
1
|
|
6
|
use Mail::Message::Body::Lines; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
410
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub export($@) |
28
|
1
|
|
|
1
|
1
|
1014
|
{ my ($thing, $message) = (shift, shift); |
29
|
|
|
|
|
|
|
|
30
|
1
|
50
|
|
|
|
11
|
croak "Export message must be a Mail::Message, but is a ".ref($message)."." |
31
|
|
|
|
|
|
|
unless $message->isa('Mail::Message'); |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
8
|
my $mi_head = Mail::Header->new; |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
46
|
my $head = $message->head; |
36
|
1
|
|
|
|
|
8
|
foreach my $field ($head->orderedFields) |
37
|
7
|
|
|
|
|
735
|
{ $mi_head->add($field->Name, scalar $field->foldedBody); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Mail::Internet->new |
41
|
1
|
|
|
|
|
95
|
( Header => $mi_head |
42
|
|
|
|
|
|
|
, Body => [ $message->body->lines ] |
43
|
|
|
|
|
|
|
, @_ |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
#------------------------------------------ |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my @pref_order = qw/From To Cc Subject Date In-Reply-To References |
51
|
|
|
|
|
|
|
Content-Type/; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub from($@) |
54
|
1
|
|
|
1
|
1
|
273
|
{ my ($thing, $mi) = (shift, shift); |
55
|
|
|
|
|
|
|
|
56
|
1
|
50
|
|
|
|
9
|
croak "Converting from Mail::Internet but got a ".ref($mi).'.' |
57
|
|
|
|
|
|
|
unless $mi->isa('Mail::Internet'); |
58
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
13
|
my $head = Mail::Message::Head::Complete->new; |
60
|
1
|
|
|
|
|
3
|
my $body = Mail::Message::Body::Lines->new(data => [ @{$mi->body} ]); |
|
1
|
|
|
|
|
4
|
|
61
|
|
|
|
|
|
|
|
62
|
1
|
|
|
|
|
5
|
my $mi_head = $mi->head; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# The tags of Mail::Header are unordered, but we prefer some ordering. |
65
|
1
|
|
|
|
|
9
|
my %tags = map {lc $_ => ucfirst $_} $mi_head->tags; |
|
5
|
|
|
|
|
26
|
|
66
|
1
|
|
|
|
|
3
|
my @tags; |
67
|
1
|
|
|
|
|
5
|
foreach (@pref_order) |
68
|
8
|
100
|
|
|
|
23
|
{ push @tags, $_ if delete $tags{lc $_}; |
69
|
|
|
|
|
|
|
} |
70
|
1
|
|
|
|
|
5
|
push @tags, sort values %tags; |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
3
|
foreach my $name (@tags) |
73
|
|
|
|
|
|
|
{ $head->add($name, $_) |
74
|
5
|
|
|
|
|
16
|
foreach $mi_head->get($name); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
10
|
Mail::Message->new(head => $head, body => $body, @_); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
#------------------------------------------ |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |