line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2022 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.03. |
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
|
|
600
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.012'; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
5
|
use base 'Mail::Message::Convert'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
394
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
15
|
|
16
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
444
|
use Mail::Internet; |
|
1
|
|
|
|
|
9495
|
|
|
1
|
|
|
|
|
29
|
|
19
|
1
|
|
|
1
|
|
6
|
use Mail::Header; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
16
|
|
20
|
1
|
|
|
1
|
|
4
|
use Mail::Message; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
15
|
|
21
|
1
|
|
|
1
|
|
12
|
use Mail::Message::Head::Complete; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
22
|
1
|
|
|
1
|
|
4
|
use Mail::Message::Body::Lines; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
14
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
326
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub export($@) |
28
|
1
|
|
|
1
|
1
|
807
|
{ my ($thing, $message) = (shift, shift); |
29
|
|
|
|
|
|
|
|
30
|
1
|
50
|
|
|
|
10
|
croak "Export message must be a Mail::Message, but is a ".ref($message)."." |
31
|
|
|
|
|
|
|
unless $message->isa('Mail::Message'); |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
7
|
my $mi_head = Mail::Header->new; |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
42
|
my $head = $message->head; |
36
|
1
|
|
|
|
|
7
|
foreach my $field ($head->orderedFields) |
37
|
7
|
|
|
|
|
630
|
{ $mi_head->add($field->Name, scalar $field->foldedBody); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Mail::Internet->new |
41
|
1
|
|
|
|
|
78
|
( 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
|
223
|
{ 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
|
|
|
|
|
11
|
my $head = Mail::Message::Head::Complete->new; |
60
|
1
|
|
|
|
|
2
|
my $body = Mail::Message::Body::Lines->new(data => [ @{$mi->body} ]); |
|
1
|
|
|
|
|
4
|
|
61
|
|
|
|
|
|
|
|
62
|
1
|
|
|
|
|
16
|
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
|
|
|
|
|
22
|
|
66
|
1
|
|
|
|
|
3
|
my @tags; |
67
|
1
|
|
|
|
|
2
|
foreach (@pref_order) |
68
|
8
|
100
|
|
|
|
20
|
{ push @tags, $_ if delete $tags{lc $_}; |
69
|
|
|
|
|
|
|
} |
70
|
1
|
|
|
|
|
4
|
push @tags, sort values %tags; |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
2
|
foreach my $name (@tags) |
73
|
|
|
|
|
|
|
{ $head->add($name, $_) |
74
|
5
|
|
|
|
|
14
|
foreach $mi_head->get($name); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
9
|
Mail::Message->new(head => $head, body => $body, @_); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
#------------------------------------------ |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |