line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MMS::Mail::Provider::UKOrange; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
31013
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use base 'MMS::Mail::Provider'; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
991
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
12563
|
use MMS::Mail::Message::Parsed; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
MMS::Mail::Provider::UKOrange - This provides a class for parsing an MMS::Mail::Message object that has been sent via the UK Orange network. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Version 0.06 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
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 Orange network. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 METHODS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
The following are the top-level methods of the MMS::Mail::Parser::0range class. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 Constructor |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=over |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=item C |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Return a new MMS::Mail::Provider::0range 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 NOTES |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Please read the Perl artistic license ('perldoc perlartistic') : |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
67
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES |
68
|
|
|
|
|
|
|
OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Thanks to Paul and Nige for the sample messages. |
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
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub parse { |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
93
|
0
|
|
|
|
|
|
my $message = shift; |
94
|
|
|
|
|
|
|
|
95
|
0
|
0
|
|
|
|
|
unless (defined $message) { |
96
|
0
|
|
|
|
|
|
return undef; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
my $skiptext = "This Orange Multi Media Message was sent wirefree"; |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
my $parsed = new MMS::Mail::Message::Parsed(message=>$message); |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
$parsed->header_subject($message->header_subject); |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
foreach my $element (@{$parsed->attachments}) { |
|
0
|
|
|
|
|
|
|
106
|
0
|
0
|
|
|
|
|
if ($element->mime_type eq 'text/plain') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
107
|
0
|
0
|
|
|
|
|
if ($element->bodyhandle->as_string ne "") { |
108
|
0
|
0
|
|
|
|
|
if ($element->bodyhandle->as_string !~ /$skiptext/m) { |
109
|
0
|
|
|
|
|
|
$parsed->body_text($element->bodyhandle->as_string); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
} elsif ($element->mime_type =~ /jpeg$/) { |
113
|
0
|
|
|
|
|
|
$parsed->add_image($element); |
114
|
|
|
|
|
|
|
} elsif ($element->mime_type =~ /^video/) { |
115
|
0
|
|
|
|
|
|
$parsed->add_video($element); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
# Set mobile number property to a VALID number |
120
|
0
|
|
|
|
|
|
$parsed->phone_number($self->retrieve_phone_number($parsed->header_from)); |
121
|
0
|
|
|
|
|
|
return $parsed; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
1; # End of MMS::Mail::Provider::UKOrange |