[Rt-commit] r5274 - in rt/branches/3.7-EXPERIMENTAL: .
ruz at bestpractical.com
ruz at bestpractical.com
Mon May 22 09:18:48 EDT 2006
Author: ruz
Date: Mon May 22 09:18:47 2006
New Revision: 5274
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm
Log:
r3103 at cubic-pc: cubic | 2006-05-22 17:18:15 +0400
* "$self->TransactionObj->Attachments->First" call this beast only once
* we have Attachment::GetHeader method, use it
* use RowsPerPage(1) trick, but I think we need FirstOnly method
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/SendEmail.pm Mon May 22 09:18:47 2006
@@ -495,12 +495,8 @@
# If there are no recipients, don't try to send the message.
# If the transaction has content and has the header RT-Squelch-Replies-To
- if ( $self->TransactionObj->Attachments->First() ) {
- if (
- $self->TransactionObj->Attachments->First->GetHeader(
- 'RT-DetectedAutoGenerated')
- )
- {
+ if ( my $attachment = $self->TransactionObj->Attachments->First ) {
+ if ( $attachment->GetHeader( 'RT-DetectedAutoGenerated') ) {
# What do we want to do with this? It's probably (?) a bounce
# caused by one of the watcher addresses being broken.
@@ -535,11 +531,7 @@
}
- my $squelch =
- $self->TransactionObj->Attachments->First->GetHeader(
- 'RT-Squelch-Replies-To');
-
- if ($squelch) {
+ if ( my $squelch = $attachment->GetHeader('RT-Squelch-Replies-To') ) {
@blacklist = split( /,/, $squelch );
}
}
@@ -661,23 +653,18 @@
my $self = shift;
my $subject;
- my $message = $self->TransactionObj->Attachments;
if ( $self->TemplateObj->MIMEObj->head->get('Subject') ) {
return ();
}
+
+ my $message = $self->TransactionObj->Attachments;
+ $message->RowsPerPage(1);
if ( $self->{'Subject'} ) {
$subject = $self->{'Subject'};
}
- elsif ( ( $message->First() ) && ( $message->First->Headers ) ) {
- my $header = $message->First->Headers();
- $header =~ s/\n\s+/ /g;
- if ( $header =~ /^Subject: (.*?)$/m ) {
- $subject = $1;
- }
- else {
- $subject = $self->TicketObj->Subject();
- }
-
+ elsif ( my $first = $message->First ) {
+ my $tmp = $first->GetHeader('Subject');
+ $subject = defined $tmp? $tmp: $self->TicketObj->Subject;
}
else {
$subject = $self->TicketObj->Subject();
More information about the Rt-commit
mailing list