| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# This code is part of Perl distribution Mail-Message version 4.04. |
|
2
|
|
|
|
|
|
|
# The POD got stripped from this file by OODoc version 3.06. |
|
3
|
|
|
|
|
|
|
# For contributors see file ChangeLog. |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# This software is copyright (c) 2001-2026 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::Message::Convert::MailInternet;{ |
|
13
|
|
|
|
|
|
|
our $VERSION = '4.04'; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
1031
|
use parent 'Mail::Message::Convert'; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
10
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
63
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
28
|
|
|
19
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
86
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
9
|
use Log::Report 'mail-message', import => [ qw/__x error/ ]; |
|
|
1
|
|
|
|
|
17
|
|
|
|
1
|
|
|
|
|
6
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
1047
|
use Mail::Internet (); |
|
|
1
|
|
|
|
|
21279
|
|
|
|
1
|
|
|
|
|
37
|
|
|
24
|
1
|
|
|
1
|
|
12
|
use Mail::Header (); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
22
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
6
|
use Mail::Message (); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
20
|
|
|
27
|
1
|
|
|
1
|
|
6
|
use Mail::Message::Head::Complete (); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
19
|
|
|
28
|
1
|
|
|
1
|
|
6
|
use Mail::Message::Body::Lines (); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
541
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#-------------------- |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub export($@) |
|
33
|
1
|
|
|
1
|
1
|
1084
|
{ my ($thing, $message) = (shift, shift); |
|
34
|
|
|
|
|
|
|
|
|
35
|
1
|
50
|
|
|
|
12
|
$message->isa('Mail::Message') |
|
36
|
|
|
|
|
|
|
or error __x"export message must be a Mail::Message object, but is {what UNKNOWN}.", what => $message; |
|
37
|
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
7
|
my $mi_head = Mail::Header->new; |
|
39
|
1
|
|
|
|
|
38
|
foreach my $field ($message->head->orderedFields) |
|
40
|
7
|
|
|
|
|
648
|
{ $mi_head->add($field->Name, scalar $field->foldedBody); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
85
|
Mail::Internet->new(Header => $mi_head, Body => [ $message->body->lines ], @_); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my @pref_order = qw/From To Cc Subject Date In-Reply-To References Content-Type/; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub from($@) |
|
50
|
1
|
|
|
1
|
1
|
424
|
{ my ($thing, $mi) = (shift, shift); |
|
51
|
|
|
|
|
|
|
|
|
52
|
1
|
50
|
|
|
|
13
|
$mi->isa('Mail::Internet') |
|
53
|
|
|
|
|
|
|
or error __x"converting from Mail::Internet but got {what UNKNOWN}.", what => $mi; |
|
54
|
|
|
|
|
|
|
|
|
55
|
1
|
|
|
|
|
18
|
my $head = Mail::Message::Head::Complete->new; |
|
56
|
1
|
|
|
|
|
3
|
my $body = Mail::Message::Body::Lines->new(data => [ @{$mi->body} ]); |
|
|
1
|
|
|
|
|
6
|
|
|
57
|
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
6
|
my $mi_head = $mi->head; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# The tags of Mail::Header are unordered, but we prefer some ordering. |
|
61
|
1
|
|
|
|
|
10
|
my %tags = map +(lc $_ => ucfirst $_), $mi_head->tags; |
|
62
|
1
|
|
|
|
|
23
|
my @tags; |
|
63
|
1
|
|
|
|
|
4
|
foreach (@pref_order) |
|
64
|
8
|
100
|
|
|
|
28
|
{ push @tags, $_ if delete $tags{lc $_}; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
1
|
|
|
|
|
5
|
push @tags, sort values %tags; |
|
67
|
|
|
|
|
|
|
|
|
68
|
1
|
|
|
|
|
4
|
foreach my $name (@tags) |
|
69
|
5
|
|
|
|
|
35
|
{ $head->add($name, $_) for $mi_head->get($name); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
15
|
Mail::Message->new(head => $head, body => $body, @_); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |