13 |
|
|
14 |
require Message::Body::Text; |
require Message::Body::Text; |
15 |
push @ISA, qw(Message::Body::Text); |
push @ISA, qw(Message::Body::Text); |
16 |
|
require Message::Header::Message; |
17 |
|
|
18 |
%DEFAULT = ( |
%DEFAULT = ( |
19 |
-_ARRAY_NAME => 'value', |
-_ARRAY_NAME => 'value', |
42 |
my %option = @_; |
my %option = @_; |
43 |
$self->SUPER::_init (%$DEFAULT, %option); |
$self->SUPER::_init (%$DEFAULT, %option); |
44 |
$self->{value} = []; |
$self->{value} = []; |
|
require Message::Header::Message; |
|
45 |
$self->{option}->{value_type}->{per_message} = ['Message::Header',{ |
$self->{option}->{value_type}->{per_message} = ['Message::Header',{ |
46 |
-format => 'message-delivery-status-per-message', |
-format => 'message-delivery-status-per-message', |
47 |
-ns_default_phuri => $Message::Header::Message::DeliveryStatus::OPTION{namespace_uri}, |
-ns_default_phuri => $Message::Header::Message::DeliveryStatus::OPTION{namespace_uri}, |
126 |
## Returns returned item value \$item-value, \%option |
## Returns returned item value \$item-value, \%option |
127 |
sub _item_return_value ($\$\%) { |
sub _item_return_value ($\$\%) { |
128 |
unless (ref ${$_[1]}) { |
unless (ref ${$_[1]}) { |
129 |
${$_[1]} = $_[0]->_parse_value (body_part => ${$_[1]}) |
${$_[1]} = $_[0]->_parse_value (per_recipient => ${$_[1]}) |
130 |
if $_[2]->{parse}; |
if $_[2]->{parse}; |
131 |
} |
} |
132 |
${$_[1]}; |
${$_[1]}; |
163 |
my $self = shift; |
my $self = shift; |
164 |
my $np = shift; |
my $np = shift; |
165 |
if (defined $np) { |
if (defined $np) { |
|
$np = $self->_parse_value (per_message => $np) if $self->{option}->{parse_all}; |
|
166 |
$self->{per_message} = $np; |
$self->{per_message} = $np; |
167 |
} |
} |
168 |
|
$self->{per_message} = $self->_parse_value (per_message => $self->{per_message}) |
169 |
|
if ($self->{option}->{parse_all} && defined $np) |
170 |
|
|| (defined wantarray); |
171 |
$self->{per_message}; |
$self->{per_message}; |
172 |
} |
} |
173 |
|
|
185 |
for (grep {/^-/} keys %o) {$option{substr ($_, 1)} = $o{$_}} |
for (grep {/^-/} keys %o) {$option{substr ($_, 1)} = $o{$_}} |
186 |
$self->_delete_empty; |
$self->_delete_empty; |
187 |
$self->add ({-parse => 1}, '') unless $#{ $self->{value} } + 1; |
$self->add ({-parse => 1}, '') unless $#{ $self->{value} } + 1; |
188 |
join ("\x0D\x0A", $self->{per_message}, @{ $self->{value} }) . "\x0D\x0A"; |
join ("\x0D\x0A", $self->{per_message}, @{ $self->{value} }); |
189 |
} |
} |
190 |
*as_string = \&stringify; |
*as_string = \&stringify; |
191 |
|
|
216 |
&& !$exist->{ $option->{fill_reporting_mta_name}.$ns }) { |
&& !$exist->{ $option->{fill_reporting_mta_name}.$ns }) { |
217 |
my $rmta = $hdr->field ($option->{fill_reporting_mta_name}); |
my $rmta = $hdr->field ($option->{fill_reporting_mta_name}); |
218 |
$rmta->type ('dns'); |
$rmta->type ('dns'); |
219 |
$rmta->value ('localhost'); |
$rmta->value (&Message::Util::get_host_fqdn || 'localhost'); |
220 |
} |
} |
221 |
} |
} |
222 |
sub _fill_fields_pr ($\%\%) { |
sub _fill_fields_pr ($\%\%) { |
229 |
if ($option->{fill_final_recipient} && !$exist->{ 'final-recipient'.$ns }) { |
if ($option->{fill_final_recipient} && !$exist->{ 'final-recipient'.$ns }) { |
230 |
my $fr = $hdr->field ('final-recipient'); |
my $fr = $hdr->field ('final-recipient'); |
231 |
$fr->type ('rfc822'); |
$fr->type ('rfc822'); |
232 |
$fr->value ('foo@bar.invalid'); |
$fr->value ('foo@'. (&Message::Util::get_host_fqdn || 'bar.invalid')); |
233 |
} |
} |
234 |
if ($option->{fill_status} && !$exist->{ 'status'.$ns }) { |
if ($option->{fill_status} && !$exist->{ 'status'.$ns }) { |
235 |
my $fr = $hdr->add (status => '4.0.0'); |
my $fr = $hdr->add (status => '4.0.0'); |