| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MMS::Mail::Provider; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
19713
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
57
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
29
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
785
|
use MMS::Mail::Message::Parsed; |
|
|
1
|
|
|
|
|
4921
|
|
|
|
1
|
|
|
|
|
7
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
MMS::Mail::Provider - This provides a base class for parsing an MMS::Mail::Message object into a MMS::Mail::Message::Parsed object. |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.07 |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
This class provides a parse method for parsing an MMS::Mail::Message object into an MMS::Mail::Message::Parsed object for 'generic' MMS messages (or ones that cannot be identified as coming from a specific provider). |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 METHODS |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
The following are the top-level methods of the MMS::Mail::Provider class. |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 Constructor |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=over |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=item C |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Return a new MMS::Mail::Provider object. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=back |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 Regular Methods |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=over |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item C MMS::Mail::Message |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Instance method - The C method parses the MMS::Mail::Message and returns an MMS::Mail::Message::Parsed. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item C STRING |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Instance method - This method splits the provided string on @ and returns the first list element from the split, replacing any leading + character with 00. This seems to be the convention used by most UK providers and may work for other non-UK providers. |
|
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 new { |
|
90
|
0
|
|
|
0
|
1
|
|
my $type = shift; |
|
91
|
0
|
|
|
|
|
|
my $self = {}; |
|
92
|
0
|
|
|
|
|
|
bless $self, $type; |
|
93
|
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
return $self; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub parse { |
|
98
|
|
|
|
|
|
|
|
|
99
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
100
|
0
|
|
|
|
|
|
my $message = shift; |
|
101
|
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
my $parsed = new MMS::Mail::Message::Parsed( message=>$message); |
|
103
|
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
$parsed->header_subject($message->header_subject); |
|
105
|
0
|
|
|
|
|
|
$parsed->body_text($message->body_text); |
|
106
|
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
$parsed->images($parsed->retrieve_attachments('^image')); |
|
108
|
0
|
|
|
|
|
|
$parsed->videos($parsed->retrieve_attachments('^video')); |
|
109
|
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
return $parsed; |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub retrieve_phone_number { |
|
115
|
|
|
|
|
|
|
|
|
116
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
117
|
0
|
|
|
|
|
|
my $from = shift; |
|
118
|
|
|
|
|
|
|
|
|
119
|
0
|
0
|
|
|
|
|
unless (defined($from)) { |
|
120
|
0
|
|
|
|
|
|
return undef; |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
# Set mobile number property to a VALID number |
|
124
|
|
|
|
|
|
|
# |
|
125
|
|
|
|
|
|
|
# This works on the idea the form is in format |
|
126
|
|
|
|
|
|
|
# 0000000000@someprovider.net |
|
127
|
|
|
|
|
|
|
# |
|
128
|
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
my ($number, undef) = split /\@/, $from; |
|
130
|
0
|
0
|
|
|
|
|
if ($number =~ /^\+/) { |
|
131
|
0
|
|
|
|
|
|
$number =~ s/^\+/00/; |
|
132
|
|
|
|
|
|
|
} else { |
|
133
|
0
|
|
|
|
|
|
$number = "00".$number; |
|
134
|
|
|
|
|
|
|
} |
|
135
|
0
|
0
|
|
|
|
|
unless ($number =~ /\D+/) { |
|
136
|
0
|
|
|
|
|
|
return $number; |
|
137
|
|
|
|
|
|
|
} |
|
138
|
0
|
|
|
|
|
|
return undef; |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
1; # End of MMS::Mail::Provider |