forked from operasoftware/Courriel--MMS
/
VodafoneUK.pm
73 lines (46 loc) · 1.27 KB
/
VodafoneUK.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
use strict;
use warnings;
package Courriel::MMS::Plugin::VodafoneUK;
use namespace::autoclean;
use Moose;
extends 'Courriel::MMS';
# --- Class methods ---
sub match {
my $class = shift;
my $email = shift;
return 1 if $email->from =~ /mms\.vodafone\.co\.uk$/;
return;
}
# --- Instance methods ---
around 'get_mms_images' => sub {
my $orig = shift;
my $self = shift;
return grep { $_->[0] !~ m#images/vf\d+\.jpg# } $self->$orig( @_ );
};
around plain_content => sub {
my $orig = shift;
my $self = shift;
my $content = $self->$orig();
return $content if defined( $content ) and length $content and $content !~ /Message text/;
my $html = $self->html_body_part->content;
if( $html =~ m#<td class="subject">(.*?)</td>.*?<td class="black">(.*?)</td>#s ){
return $2;
}
return;
};
__PACKAGE__->meta()->make_immutable();
1;
__END__
# ABSTRACT: L<Courriel::MMS> extension for dealing with MMS messages from Vodafone UK.
=head1 SYNOPSIS
=head1 DESCRIPTION
=head1 CLASS METHODS
=head1 INSTANCE METHODS
=head2 C<get_mms_images>
=head1 SEE ALSO
=head2 L<<< Courriel >>>
=head1 AUTHOR
Zbigniew Łukasiak, E<lt>zlukasiak@opera.comE<gt>
=head1 LICENSE AND COPYRIGHT
Copyright (c), 2011 Opera Software ASA.
All rights reserved.