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