forked from operasoftware/Courriel--MMS
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plain_content method; new subclasses
- Loading branch information
Zbigniew Lukasiak
committed
Sep 5, 2011
1 parent
c17864b
commit 064f9b1
Showing
11 changed files
with
667 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
use strict; | ||
use warnings; | ||
|
||
package Courriel::MMS::Plugin::O2Ie; | ||
use namespace::autoclean; | ||
use Moose; | ||
|
||
extends 'Courriel::MMS'; | ||
|
||
# --- Class methods --- | ||
|
||
sub match { | ||
my $class = shift; | ||
my $email = shift; | ||
|
||
return 1 if $email->from =~ /mms\.o2\.ie/; | ||
return; | ||
} | ||
|
||
|
||
# --- Instance methods --- | ||
|
||
around subject => sub { | ||
my $orig = shift; | ||
my $self = shift; | ||
my $subject = $self->$orig; | ||
return undef if $subject eq 'Multimedia message'; | ||
return $subject; | ||
}; | ||
|
||
__PACKAGE__->meta()->make_immutable(); | ||
|
||
1; | ||
|
||
__END__ | ||
# ABSTRACT: L<Courriel::MMS> extension for dealing with MMS messages from O2 Ireland. | ||
=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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
use strict; | ||
use warnings; | ||
|
||
package Courriel::MMS::Plugin::RadiolinjaFI; | ||
use namespace::autoclean; | ||
use Moose; | ||
|
||
extends 'Courriel::MMS'; | ||
|
||
# --- Class methods --- | ||
|
||
sub match { | ||
my $class = shift; | ||
my $email = shift; | ||
|
||
return 1 if $email->from =~ /mmsc\.radiolinja\.fi/; | ||
return; | ||
} | ||
|
||
|
||
# --- Instance methods --- | ||
|
||
around plain_content => sub { | ||
my $orig = shift; | ||
my $self = shift; | ||
my $content = $self->$orig(); | ||
return '' if $content eq 'This is a HTML message, sorry'; | ||
return $content; | ||
}; | ||
|
||
|
||
|
||
__PACKAGE__->meta()->make_immutable(); | ||
|
||
1; | ||
|
||
__END__ | ||
# ABSTRACT: L<Courriel::MMS> extension for dealing with MMS messages from Telenor SE. | ||
=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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
use strict; | ||
use warnings; | ||
|
||
package Courriel::MMS::Plugin::Tele2LT; | ||
use namespace::autoclean; | ||
use Moose; | ||
|
||
extends 'Courriel::MMS'; | ||
|
||
# --- Class methods --- | ||
|
||
sub match { | ||
my $class = shift; | ||
my $email = shift; | ||
|
||
return 1 if $email->from =~ /mms\.tele2/; | ||
return; | ||
} | ||
|
||
|
||
# --- Instance methods --- | ||
|
||
around subject => sub { | ||
my $orig = shift; | ||
my $self = shift; | ||
my $subject = $self->$orig; | ||
return undef if $subject =~ /MMS via e-mail/; | ||
return $subject; | ||
}; | ||
|
||
__PACKAGE__->meta()->make_immutable(); | ||
|
||
1; | ||
|
||
__END__ | ||
# ABSTRACT: L<Courriel::MMS> extension for dealing with MMS messages from Tele2 Lithuania. | ||
=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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
use strict; | ||
use warnings; | ||
|
||
package Courriel::MMS::Plugin::TelenorSE; | ||
use namespace::autoclean; | ||
use Moose; | ||
|
||
extends 'Courriel::MMS'; | ||
|
||
# --- Class methods --- | ||
|
||
sub match { | ||
my $class = shift; | ||
my $email = shift; | ||
|
||
return 1 if $email->from =~ /mms-email\.telenor\.se/; | ||
return; | ||
} | ||
|
||
|
||
# --- Instance methods --- | ||
|
||
around plain_content => sub { | ||
my $orig = shift; | ||
my $self = shift; | ||
my $content = $self->$orig(); | ||
my $html = $self->html_body_part->content; | ||
if( $html =~ m#<h1.*?</div>\n<div class="text-400">\n(.*?)\n</div>#s ){ | ||
$content = $content . $1; | ||
} | ||
return $content; | ||
}; | ||
|
||
|
||
|
||
__PACKAGE__->meta()->make_immutable(); | ||
|
||
1; | ||
|
||
__END__ | ||
# ABSTRACT: L<Courriel::MMS> extension for dealing with MMS messages from Telenor SE. | ||
=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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
use strict; | ||
use warnings; | ||
|
||
package Courriel::MMS::Plugin::VodafoneDE; | ||
use namespace::autoclean; | ||
use Moose; | ||
|
||
extends 'Courriel::MMS'; | ||
|
||
# --- Class methods --- | ||
|
||
sub match { | ||
my $class = shift; | ||
my $email = shift; | ||
|
||
return 1 if $email->from =~ /mmsmail\.vodafone\.de/; | ||
return; | ||
} | ||
|
||
|
||
# --- Instance methods --- | ||
|
||
around subject => sub { | ||
my $orig = shift; | ||
my $self = shift; | ||
my $subject = $self->$orig; | ||
return undef if $subject eq 'Sie haben eine MMS erhalt'; | ||
return $subject; | ||
}; | ||
|
||
override plain_content => sub { | ||
my $self = shift; | ||
my $part = $self->first_part_matching( | ||
sub { | ||
my $part = shift; | ||
my $mime = $part->mime_type(); | ||
return if $mime ne 'text/plain'; | ||
return if $part->content =~ m#http://www.vodafone.de#; | ||
return 1; | ||
} | ||
); | ||
return $part->content if $part; | ||
return; | ||
}; | ||
|
||
|
||
__PACKAGE__->meta()->make_immutable(); | ||
|
||
1; | ||
|
||
__END__ | ||
# ABSTRACT: L<Courriel::MMS> extension for dealing with MMS messages from Vodafone DE. | ||
=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. |
Oops, something went wrong.