line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MMS::Mail::Provider::UKVirgin; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
21981
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use base 'MMS::Mail::Provider'; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
803
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6700
|
use MMS::Mail::Message::Parsed; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
MMS::Mail::Provider::UKVirgin - This provides a class for parsing an MMS::Mail::Message object that has been sent via the UK Virgin network. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Version 0.05 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This class provides a parse method for parsing an MMS::Mail::Message object into an MMS::Mail::Message::Parsed object for MMS messages sent from the UK Virgin network. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 METHODS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
The following are the top-level methods of the MMS::Mail::Parser::UKVirgin class. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 Constructor |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=over |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=item C |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Return a new MMS::Mail::Provider::UKVirgin object. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=back |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 Regular Methods |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=over |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item C MMS::Mail::Message |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
The C method is called as an instance method. It parses the MMS::Mail::Message object and returns an MMS::Mail::Message::Parsed object. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=back |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 AUTHOR |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Rob Lee, C<< >> |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 BUGS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
57
|
|
|
|
|
|
|
C, or through the web interface at |
58
|
|
|
|
|
|
|
L. |
59
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
60
|
|
|
|
|
|
|
your bug as I make changes. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 SUPPORT |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
perldoc MMS::Mail::Provider::UKVirgin |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
You can also look for information at: |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=over 4 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
L |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item * CPAN Ratings |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
L |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
L |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * Search CPAN |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
L |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=back |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Copyright 2006 Rob Lee, all rights reserved. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
97
|
|
|
|
|
|
|
under the same terms as Perl itself. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub parse { |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
104
|
0
|
|
|
|
|
|
my $message = shift; |
105
|
|
|
|
|
|
|
|
106
|
0
|
0
|
|
|
|
|
unless (defined $message) { |
107
|
0
|
|
|
|
|
|
return undef; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
my $parsed = new MMS::Mail::Message::Parsed(message=>$message); |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
my $text=undef; |
113
|
0
|
|
|
|
|
|
foreach my $element (@{$parsed->attachments}) { |
|
0
|
|
|
|
|
|
|
114
|
0
|
0
|
|
|
|
|
if ($element->mime_type eq 'text/plain') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
my $header = $element->head; |
116
|
0
|
0
|
0
|
|
|
|
if ((defined $header->recommended_filename) && ($header->recommended_filename eq 'mms.txt')) { |
117
|
0
|
|
|
|
|
|
$text = $element->bodyhandle->as_string; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
} elsif ($element->mime_type =~ /jpeg$/) { |
120
|
0
|
|
|
|
|
|
my $header = $element->head; |
121
|
0
|
0
|
0
|
|
|
|
if ( (defined $header->recommended_filename) && ($header->recommended_filename ne '')) { |
122
|
0
|
|
|
|
|
|
$parsed->add_image($element); |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
} elsif ($element->mime_type =~ /^video/) { |
125
|
0
|
|
|
|
|
|
$parsed->add_video($element); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
0
|
0
|
|
|
|
|
unless (defined $text) { |
130
|
0
|
|
|
|
|
|
return undef; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
$parsed->header_subject($message->header_subject); |
134
|
0
|
|
|
|
|
|
$parsed->body_text($text); |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# Cleanup the header_from and set phone number |
137
|
0
|
|
|
|
|
|
$parsed->header_from =~ /\"(.+)\"/; |
138
|
0
|
|
|
|
|
|
$parsed->header_from($1); |
139
|
0
|
|
|
|
|
|
my ($num,undef) = split(/@/, $parsed->header_from); |
140
|
0
|
|
|
|
|
|
$parsed->phone_number($num); |
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
return $parsed; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
1; # End of MMS::Mail::Provider::UKVirgin |