line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MMS::Mail::Provider::UKVodafone; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20307
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use base 'MMS::Mail::Provider'; |
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
1023
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
16076
|
use MIME::Entity; |
|
1
|
|
|
|
|
238592
|
|
|
1
|
|
|
|
|
33
|
|
9
|
1
|
|
|
1
|
|
14
|
use MMS::Mail::Message::Parsed; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
10
|
1
|
|
|
1
|
|
1234
|
use HTML::TableExtract; |
|
1
|
|
|
|
|
60938
|
|
|
1
|
|
|
|
|
9
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
MMS::Mail::Provider::UKVodafone - This provides a class for parsing an MMS::Mail::Message object that has been sent via the UK Vodafone network. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 VERSION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Version 0.07 |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
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 Vodafone network. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 METHODS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
The following are the top-level methods of the MMS::Mail::Parser::UKVodafone class. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 Constructor |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=over |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=item C |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Return a new MMS::Mail::Provider::UKVodafone object. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=back |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 Regular Methods |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=over |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item C MMS::Mail::Message |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
The C method is called as an instance method. It parses the MMS::Mail::Message object and returns an MMS::Mail::Message::Parsed object. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=back |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 AUTHOR |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Rob Lee, C<< >> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 BUGS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
59
|
|
|
|
|
|
|
C, or through the web interface at |
60
|
|
|
|
|
|
|
L. |
61
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
62
|
|
|
|
|
|
|
your bug as I make changes. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 NOTES |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Please read the Perl artistic license ('perldoc perlartistic') : |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
69
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES |
70
|
|
|
|
|
|
|
OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
As per usual this module is sprinkled with a little Deb magic. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Copyright 2005 Rob Lee, all rights reserved. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
81
|
|
|
|
|
|
|
under the same terms as Perl itself. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 SEE ALSO |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
L, L, L |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub parse { |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
92
|
0
|
|
|
|
|
|
my $message = shift; |
93
|
|
|
|
|
|
|
|
94
|
0
|
0
|
|
|
|
|
unless (defined $message) { |
95
|
0
|
|
|
|
|
|
return undef; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
my $parsed = new MMS::Mail::Message::Parsed(message=>$message); |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
my $htmltext=undef; |
101
|
0
|
|
|
|
|
|
foreach my $element (@{$parsed->attachments}) { |
|
0
|
|
|
|
|
|
|
102
|
0
|
0
|
|
|
|
|
if ($element->mime_type eq 'text/html') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
$htmltext = $element->bodyhandle->as_string; |
104
|
|
|
|
|
|
|
} elsif ($element->mime_type =~ /jpeg$/) { |
105
|
0
|
|
|
|
|
|
my $header = $element->head; |
106
|
0
|
0
|
|
|
|
|
if ($header->recommended_filename() !~ /(images\/vf3\.jpg|images\/vf4\.jpg|images\/vf6\.jpg)/) { |
107
|
0
|
|
|
|
|
|
$parsed->add_image($element); |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
} elsif ($element->mime_type =~ /^video/) { |
110
|
0
|
|
|
|
|
|
$parsed->add_video($element); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
0
|
0
|
|
|
|
|
unless (defined $htmltext) { |
115
|
0
|
|
|
|
|
|
return undef; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
my $te1 = new HTML::TableExtract( depth => 0, count => 3 ); |
119
|
0
|
|
|
|
|
|
$te1->parse($htmltext); |
120
|
0
|
|
|
|
|
|
foreach my $ts1 ($te1->table_states) { |
121
|
0
|
|
|
|
|
|
foreach my $row1 ($ts1->rows) { |
122
|
0
|
|
|
|
|
|
foreach my $ele (@$row1) { |
123
|
0
|
0
|
0
|
|
|
|
if ((defined $ele) && ($ele ne '')) { |
124
|
0
|
|
|
|
|
|
$parsed->header_subject($ele); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
my $te2 = new HTML::TableExtract( depth => 1, count => 0 ); |
131
|
0
|
|
|
|
|
|
$te2->parse($htmltext); |
132
|
0
|
|
|
|
|
|
my $text; |
133
|
0
|
|
|
|
|
|
foreach my $ts2 ($te2->table_states) { |
134
|
0
|
|
|
|
|
|
foreach my $row2 ($ts2->rows) { |
135
|
0
|
|
|
|
|
|
$text = join('\n', @$row2); |
136
|
|
|
|
|
|
|
} |
137
|
0
|
0
|
0
|
|
|
|
if ((defined $text) && $text ne "") { |
138
|
0
|
|
|
|
|
|
$parsed->body_text($text); |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
# Set mobile number property to a VALID number |
143
|
0
|
|
|
|
|
|
$parsed->phone_number($self->retrieve_phone_number($parsed->header_from)); |
144
|
0
|
|
|
|
|
|
return $parsed; |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
1; # End of MMS::Mail::Provider::UKVodafone |