[Rt-commit] rt branch, 4.2/switch-mime-header-replace, created. rt-4.2.3-85-gc1f6f0e
Alex Vandiver
alexmv at bestpractical.com
Wed Apr 16 16:23:52 EDT 2014
The branch, 4.2/switch-mime-header-replace has been created
at c1f6f0e13b785be40140f505d00bf171f3b0af2f (commit)
- Log -----------------------------------------------------------------
commit c1f6f0e13b785be40140f505d00bf171f3b0af2f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Apr 16 16:17:58 2014 -0400
Switch from deprecated MIME::Head->set() to ->replace()
MIME::Tools 4.x (in 1998) deprecated ->set, in preference to the more
explicit ->replace() call; ->set is no longer documented in POD, in
fact. Switch all places which use the former to using the latter.
Fixes I#18417
diff --git a/lib/RT/Action/SendForward.pm b/lib/RT/Action/SendForward.pm
index 0a7949c..0e744a8 100644
--- a/lib/RT/Action/SendForward.pm
+++ b/lib/RT/Action/SendForward.pm
@@ -110,12 +110,12 @@ sub Prepare {
my $txn_attachment = $self->TransactionObj->Attachments->First;
for my $header (qw/From To Cc Bcc/) {
if ( $txn_attachment->GetHeader( $header ) ) {
- $mime->head->set( $header => $txn_attachment->GetHeader($header) );
+ $mime->head->replace( $header => $txn_attachment->GetHeader($header) );
}
}
if ( RT->Config->Get('ForwardFromUser') ) {
- $mime->head->set( 'X-RT-Sign' => 0 );
+ $mime->head->replace( 'X-RT-Sign' => 0 );
}
$self->SUPER::Prepare();
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index facdb38..59a492b 100644
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -384,7 +384,7 @@ sub SendEmail {
if (my $precedence = RT->Config->Get('DefaultMailPrecedence')
and !$args{'Entity'}->head->get("Precedence")
) {
- $args{'Entity'}->head->set( 'Precedence', $precedence );
+ $args{'Entity'}->head->replace( 'Precedence', $precedence );
}
if ( $TransactionObj && !$TicketObj
@@ -398,15 +398,15 @@ sub SendEmail {
require RT::Date;
my $date = RT::Date->new( RT->SystemUser );
$date->SetToNow;
- $head->set( 'Date', $date->RFC2822( Timezone => 'server' ) );
+ $head->replace( 'Date', $date->RFC2822( Timezone => 'server' ) );
}
unless ( $head->get('MIME-Version') ) {
# We should never have to set the MIME-Version header
- $head->set( 'MIME-Version', '1.0' );
+ $head->replace( 'MIME-Version', '1.0' );
}
unless ( $head->get('Content-Transfer-Encoding') ) {
# fsck.com #5959: Since RT sends 8bit mail, we should say so.
- $head->set( 'Content-Transfer-Encoding', '8bit' );
+ $head->replace( 'Content-Transfer-Encoding', '8bit' );
}
if ( RT->Config->Get('Crypt')->{'Enable'} ) {
@@ -585,10 +585,10 @@ sub SendEmailUsingTemplate {
return -1;
}
- $mail->head->set( $_ => Encode::encode_utf8( $args{ $_ } ) )
+ $mail->head->replace( $_ => Encode::encode_utf8( $args{ $_ } ) )
foreach grep defined $args{$_}, qw(To Cc Bcc From);
- $mail->head->set( $_ => $args{ExtraHeaders}{$_} )
+ $mail->head->replace( $_ => $args{ExtraHeaders}{$_} )
foreach keys %{ $args{ExtraHeaders} };
SetInReplyTo( Message => $mail, InReplyTo => $args{'InReplyTo'} );
@@ -1011,7 +1011,7 @@ sub DeleteRecipientsFromHead {
my %skip = map { lc $_ => 1 } @_;
foreach my $field ( qw(To Cc Bcc) ) {
- $head->set( $field =>
+ $head->replace( $field =>
join ', ', map $_->format, grep !$skip{ lc $_->address },
Email::Address->parse( $head->get( $field ) )
);
@@ -1069,8 +1069,8 @@ sub SetInReplyTo {
if @references > 10;
my $mail = $args{'Message'};
- $mail->head->set( 'In-Reply-To' => Encode::encode_utf8(join ' ', @rtid? (@rtid) : (@id)) ) if @id || @rtid;
- $mail->head->set( 'References' => Encode::encode_utf8(join ' ', @references) );
+ $mail->head->replace( 'In-Reply-To' => Encode::encode_utf8(join ' ', @rtid? (@rtid) : (@id)) ) if @id || @rtid;
+ $mail->head->replace( 'References' => Encode::encode_utf8(join ' ', @references) );
}
sub PseudoReference {
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index f2cb21b..a7f859a 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -2502,7 +2502,7 @@ sub MakeMIMEEntity {
Data => \@content,
);
if ( !$args{'Subject'} && !( defined $args{'Body'} && length $args{'Body'} ) ) {
- $Message->head->set( 'Subject' => $filename );
+ $Message->head->replace( 'Subject' => $filename );
}
# Attachment parts really shouldn't get a Message-ID or "interface"
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 46c8f68..8cb5891 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -1603,7 +1603,7 @@ sub _RecordNote {
my $org = RT->Config->Get('Organization');
my $msgid = $args{'MIMEObj'}->head->get('Message-ID');
unless (defined $msgid && $msgid =~ /<(rt-.*?-\d+-\d+)\.(\d+-0-0)\@\Q$org\E>/) {
- $args{'MIMEObj'}->head->set(
+ $args{'MIMEObj'}->head->replace(
'RT-Message-ID' => Encode::encode_utf8(
RT::Interface::Email::GenMessageId( Ticket => $self )
)
@@ -3041,10 +3041,10 @@ sub Forward {
Data => $args{Content},
);
- $mime->head->set(
+ $mime->head->replace(
$_ => RT::Interface::Email::EncodeToMIME( String => $args{$_} ) )
for grep defined $args{$_}, qw(Subject To Cc Bcc);
- $mime->head->set(
+ $mime->head->replace(
From => RT::Interface::Email::EncodeToMIME(
String => RT::Interface::Email::GetForwardFrom(
Transaction => $args{Transaction},
-----------------------------------------------------------------------
More information about the rt-commit
mailing list