line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MMS::Mail::Message::Parsed; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
86192
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
148
|
|
4
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
156
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
32
|
use base 'MMS::Mail::Message'; |
|
3
|
|
|
|
|
20
|
|
|
3
|
|
|
|
|
3247
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
MMS::Mail::Message::Parsed - A class representing a parsed MMS (or picture) message, that has been parsed by an MMS::Mail::Provider class. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.06 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
This class is used by MMS::Mail::Parser to provide a final data storage class after the MMS has been parsed by the MMS::Mail::Provider class. It inherits from the MMS::Mail::Message class and extends it's methods to allow access to parsed properties. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 METHODS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
The MMS::Mail::Message::Parsed class inherits all the methods from it's parent class MMS::Mail::Message. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 Constructor |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=over |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=item C |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Return a new MMS::Mail::Message::Parsed object. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=back |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 Regular Methods |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=over |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item C MIME::Entity |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Instance method - Adds the supplied MIME::Entity attachment to the image stack for the message. This method is mainly used by the MMS::Mail::Provider class to add images while parsing. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item C MIME::Entity |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Instance method - Adds the supplied MIME::Entity attachment to the video stack for the message. This method is mainly used by the MMS::Mail::Provider class to add videos while parsing. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item C |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Instance method - Returns an array reference to an array of images from the message. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item C |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Instance method - Returns an array reference to an array of videos from the message. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item C STRING |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Instance method - Returns the MMS mobile number the message was sent from when invoked with no supplied parameter. When supplied with a parameter it sets the object property to the supplied parameter. This property is not set by the MMS::Mail::Provider class but is set by it's subclasses. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item C STRING |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Instance method - Expects a mime-type to be passed as an argument and a regular expression match using the supplied string is applied to each attachment in the attachment stack of the message object and a reference to an array of objects where the mime-type matches the supplied string is returned. In the event no attachment was matched to the supplied mime-type an undef value is returned. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=back |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 AUTHOR |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Rob Lee, C<< >> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 BUGS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
75
|
|
|
|
|
|
|
C, or through the web interface at |
76
|
|
|
|
|
|
|
L. |
77
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
78
|
|
|
|
|
|
|
your bug as I make changes. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 NOTES |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Please read the Perl artistic license ('perldoc perlartistic') : |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
85
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES |
86
|
|
|
|
|
|
|
OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
As per usual this module is sprinkled with a little Deb magic. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Copyright 2005 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
|
|
|
|
|
|
|
=head1 SEE ALSO |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L, L, L |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
my @Accessors=( "phone_number", |
106
|
|
|
|
|
|
|
"images", |
107
|
|
|
|
|
|
|
"videos" |
108
|
|
|
|
|
|
|
); |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# Class data retrieval |
111
|
|
|
|
|
|
|
sub _Accessors { |
112
|
3
|
|
|
3
|
|
26
|
return \@Accessors; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(@{__PACKAGE__->_Accessors}); |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub new { |
118
|
|
|
|
|
|
|
|
119
|
1
|
|
|
1
|
1
|
15
|
my $type = shift; |
120
|
|
|
|
|
|
|
|
121
|
1
|
|
|
|
|
3
|
my $self = {}; |
122
|
1
|
|
|
|
|
11
|
$self = SUPER::new $type( @_ ); |
123
|
|
|
|
|
|
|
|
124
|
1
|
50
|
|
|
|
71
|
if (defined($self->{message})) { |
125
|
0
|
|
|
|
|
0
|
$self->SUPER::_clone_data($self->{message}); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
1
|
|
|
|
|
3
|
$self->{images} = []; |
129
|
1
|
|
|
|
|
3
|
$self->{videos} = []; |
130
|
|
|
|
|
|
|
|
131
|
1
|
|
|
|
|
6
|
return $self; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub add_image { |
135
|
|
|
|
|
|
|
|
136
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
137
|
0
|
|
|
|
|
0
|
my $image = shift; |
138
|
|
|
|
|
|
|
|
139
|
0
|
0
|
|
|
|
0
|
unless (defined($image)) { |
140
|
0
|
|
|
|
|
0
|
return 0; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
0
|
push @{$self->{images}}, $image; |
|
0
|
|
|
|
|
0
|
|
144
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
0
|
return 1; |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
sub add_video { |
150
|
|
|
|
|
|
|
|
151
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
152
|
0
|
|
|
|
|
0
|
my $video = shift; |
153
|
|
|
|
|
|
|
|
154
|
0
|
0
|
|
|
|
0
|
unless(defined $video) { |
155
|
0
|
|
|
|
|
0
|
return 0; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
0
|
push @{$self->{videos}}, $video; |
|
0
|
|
|
|
|
0
|
|
159
|
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
0
|
return 1; |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
sub retrieve_attachments { |
165
|
|
|
|
|
|
|
|
166
|
1
|
|
|
1
|
1
|
3585
|
my $self = shift; |
167
|
1
|
|
|
|
|
3
|
my $type = shift; |
168
|
|
|
|
|
|
|
|
169
|
1
|
50
|
|
|
|
5
|
unless (defined $type) { |
170
|
1
|
|
|
|
|
7
|
return []; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
my @mimeattachments; |
174
|
0
|
|
|
|
|
|
foreach my $attachment (@{$self->attachments}) { |
|
0
|
|
|
|
|
|
|
175
|
0
|
0
|
|
|
|
|
if ($attachment->mime_type =~ /$type/) { |
176
|
0
|
|
|
|
|
|
push @mimeattachments, $attachment; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
0
|
0
|
|
|
|
|
if (@mimeattachments>0) { |
181
|
0
|
|
|
|
|
|
return \@mimeattachments; |
182
|
|
|
|
|
|
|
} else { |
183
|
0
|
|
|
|
|
|
return []; |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
1; # End of MMS::Mail::Message::Parsed |