diff options
Diffstat (limited to 'lib/Youri/Submit/Action/Mail.pm')
-rw-r--r-- | lib/Youri/Submit/Action/Mail.pm | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/lib/Youri/Submit/Action/Mail.pm b/lib/Youri/Submit/Action/Mail.pm index 7ef8380..5df20e6 100644 --- a/lib/Youri/Submit/Action/Mail.pm +++ b/lib/Youri/Submit/Action/Mail.pm @@ -1,9 +1,9 @@ # $Id$ -package Youri::Upload::Action::Mail; +package Youri::Submit::Action::Mail; =head1 NAME -Youri::Upload::Action::Mail - Mail notification +Youri::Submit::Action::Mail - Mail notification =head1 DESCRIPTION @@ -17,7 +17,7 @@ use MIME::Entity; use Encode qw/from_to/; use Carp; use Youri::Package; -use base qw/Youri::Upload::Action/; +use base qw/Youri::Submit::Action/; sub _init { my $self = shift; @@ -57,22 +57,12 @@ sub run { return unless $package->is_source(); my $from = $package->get_packager(); - my $section = $repository->_get_section($package, $target, $define); # force from adress if defined $from =~ s/<.*>/<$self->{_from}>/ if $self->{_from}; - my $subject = - ($self->{_prefix} ? '[' . $self->{_prefix} . '] ' : '' ) . "$target " . ($section ? "$section " : '') . - $package->get_revision_name(); - my $information = $package->get_information(); - my $last_change = $package->get_last_change(); - my $content = - $information . "\n" . - $last_change->[Youri::Package::CHANGE_AUTHOR] . ":\n" . - join( - '', map { "- $_\n" } @{$last_change->[Youri::Package::CHANGE_TEXT]} - ); + my $subject = $self->get_subject($package, $repository, $target, $define); + my $content = $self->get_content($package, $repository, $target, $define); # ensure proper codeset conversion # for informations coming from package @@ -105,6 +95,33 @@ sub run { } +sub get_subject { + my ($self, $package, $repository, $target, $define) = @_; + croak "Not a class method" unless ref $self; + + my $section = $repository->_get_section($package, $target, $define); + return + ($self->{_prefix} ? '[' . $self->{_prefix} . '] ' : '' ) . + . "$target " . ($section ? "$section " : '' ) . + $package->as_formated_string('%{name}-%{version}-%{release}'); +} + +sub get_content { + my ($self, $package, $repository, $target, $define) = @_; + croak "Not a class method" unless ref $self; + + my $information = $package->get_information(); + my $last_change = $package->get_last_change(); + + return + $information . "\n" . + $last_change->[Youri::Package::CHANGE_AUTHOR] . ":\n" . + join( + '', map { "- $_\n" } @{$last_change->[Youri::Package::CHANGE_TEXT]} + ); +} + + =head1 COPYRIGHT AND LICENSE Copyright (C) 2002-2006, YOURI project |