summaryrefslogtreecommitdiff
path: root/rt/lib/RT/Action
diff options
context:
space:
mode:
Diffstat (limited to 'rt/lib/RT/Action')
-rw-r--r--rt/lib/RT/Action/AutoOpen.pm8
-rwxr-xr-xrt/lib/RT/Action/Autoreply.pm6
-rw-r--r--rt/lib/RT/Action/CreateTickets.pm29
-rw-r--r--rt/lib/RT/Action/EscalatePriority.pm7
-rwxr-xr-xrt/lib/RT/Action/Generic.pm58
-rwxr-xr-xrt/lib/RT/Action/Notify.pm12
-rwxr-xr-xrt/lib/RT/Action/NotifyAsComment.pm6
-rw-r--r--rt/lib/RT/Action/RecordComment.pm30
-rw-r--r--rt/lib/RT/Action/RecordCorrespondence.pm30
-rw-r--r--rt/lib/RT/Action/ResolveMembers.pm6
-rwxr-xr-xrt/lib/RT/Action/SendEmail.pm223
-rw-r--r--rt/lib/RT/Action/SetPriority.pm6
-rw-r--r--rt/lib/RT/Action/UserDefined.pm6
13 files changed, 161 insertions, 266 deletions
diff --git a/rt/lib/RT/Action/AutoOpen.pm b/rt/lib/RT/Action/AutoOpen.pm
index 3423db93e..b28c50d3e 100644
--- a/rt/lib/RT/Action/AutoOpen.pm
+++ b/rt/lib/RT/Action/AutoOpen.pm
@@ -1,8 +1,8 @@
-# BEGIN BPS TAGGED BLOCK {{{
+# {{{ BEGIN BPS TAGGED BLOCK
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -42,7 +42,7 @@
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
#
-# END BPS TAGGED BLOCK }}}
+# }}} END BPS TAGGED BLOCK
# This Action will open the BASE if a dependent is resolved.
package RT::Action::AutoOpen;
@@ -74,8 +74,6 @@ sub Prepare {
if ( ( $self->TicketObj->Status eq 'open' )
|| ( ( $self->TicketObj->Status eq 'new' )
&& $self->TransactionObj->IsInbound )
- || ( defined $self->TransactionObj->Message->First
- && $self->TransactionObj->Message->First->GetHeader('RT-Control') =~ /\bno-autoopen\b/i )
) {
return undef;
diff --git a/rt/lib/RT/Action/Autoreply.pm b/rt/lib/RT/Action/Autoreply.pm
index c1ac5f897..6d2894f54 100755
--- a/rt/lib/RT/Action/Autoreply.pm
+++ b/rt/lib/RT/Action/Autoreply.pm
@@ -1,8 +1,8 @@
-# BEGIN BPS TAGGED BLOCK {{{
+# {{{ BEGIN BPS TAGGED BLOCK
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -42,7 +42,7 @@
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
#
-# END BPS TAGGED BLOCK }}}
+# }}} END BPS TAGGED BLOCK
package RT::Action::Autoreply;
require RT::Action::SendEmail;
diff --git a/rt/lib/RT/Action/CreateTickets.pm b/rt/lib/RT/Action/CreateTickets.pm
index b708f2ea5..68f402e4e 100644
--- a/rt/lib/RT/Action/CreateTickets.pm
+++ b/rt/lib/RT/Action/CreateTickets.pm
@@ -1,8 +1,8 @@
-# BEGIN BPS TAGGED BLOCK {{{
+# {{{ BEGIN BPS TAGGED BLOCK
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -42,7 +42,7 @@
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
#
-# END BPS TAGGED BLOCK }}}
+# }}} END BPS TAGGED BLOCK
package RT::Action::CreateTickets;
require RT::Action::Generic;
@@ -148,8 +148,8 @@ A convoluted example
push (@admins, $admin->EmailAddress);
}
}
- Queue: ___Approvals
- Type: approval
+ Queue: Approvals
+ Type: Approval
AdminCc: {join ("\nAdminCc: ",@admins) }
Depended-On-By: TOP
Refers-To: TOP
@@ -164,7 +164,7 @@ A convoluted example
Subject: Manager approval
Depended-On-By: TOP
Refers-On: {$Tickets{"approval"}->Id}
- Queue: ___Approvals
+ Queue: Approvals
Content-Type: text/plain
Content:
Your approval is requred for this ticket, too.
@@ -213,7 +213,7 @@ A complete list of acceptable fields for this beastie:
Fields marked with an * are required.
-Fields marked with a + may have multiple values, simply
+Fields marked with a + man have multiple values, simply
by repeating the fieldname on a new line with an additional value.
Fields marked with a ! are postponed to be processed after all
@@ -243,8 +243,8 @@ ok ($approvalsq->Id, "Created Approvals test queue");
my $approvals =
'===Create-Ticket: approval
-Queue: ___Approvals
-Type: approval
+Queue: Approvals
+Type: Approval
AdminCc: {join ("\nAdminCc: ",@admins) }
Depended-On-By: {$Tickets{"TOP"}->Id}
Refers-To: TOP
@@ -258,7 +258,7 @@ ENDOFCONTENT
===Create-Ticket: two
Subject: Manager approval.
Depended-On-By: approval
-Queue: ___Approvals
+Queue: Approvals
Content-Type: text/plain
Content:
Your minion approved ticket {$Tickets{"TOP"}->Id}. you ok with that?
@@ -565,14 +565,12 @@ sub CreateByTemplate {
# XXX: cargo cult programming that works. i'll be back.
use bytes;
- local %T::Tickets = %T::Tickets;
- local $T::TOP = $T::TOP;
- local $T::ID = $T::ID;
- $T::Tickets{'TOP'} = $T::TOP = $top if $top;
+ %T::Tickets = ();
my $ticketargs;
my ( @links, @postponed );
foreach my $template_id ( @{ $self->{'create_tickets'} } ) {
+ $T::Tickets{'TOP'} = $T::TOP = $top if $top;
$RT::Logger->debug("Workflow: processing $template_id of $T::TOP")
if $T::TOP;
@@ -630,8 +628,7 @@ sub UpdateByTemplate {
use bytes;
my @results;
- local %T::Tickets = %T::Tickets;
- local $T::ID = $T::ID;
+ %T::Tickets = ();
my $ticketargs;
my ( @links, @postponed );
diff --git a/rt/lib/RT/Action/EscalatePriority.pm b/rt/lib/RT/Action/EscalatePriority.pm
index c54992166..ace72dd1b 100644
--- a/rt/lib/RT/Action/EscalatePriority.pm
+++ b/rt/lib/RT/Action/EscalatePriority.pm
@@ -1,8 +1,8 @@
-# BEGIN BPS TAGGED BLOCK {{{
+# {{{ BEGIN BPS TAGGED BLOCK
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -42,8 +42,7 @@
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
#
-# END BPS TAGGED BLOCK }}}
-
+# }}} END BPS TAGGED BLOCK
=head1 NAME
RT::Action::EscalatePriority
diff --git a/rt/lib/RT/Action/Generic.pm b/rt/lib/RT/Action/Generic.pm
index cf7600a63..5e80f40d7 100755
--- a/rt/lib/RT/Action/Generic.pm
+++ b/rt/lib/RT/Action/Generic.pm
@@ -1,8 +1,8 @@
-# BEGIN BPS TAGGED BLOCK {{{
+# {{{ BEGIN BPS TAGGED BLOCK
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -42,8 +42,7 @@
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
#
-# END BPS TAGGED BLOCK }}}
-
+# }}} END BPS TAGGED BLOCK
=head1 NAME
RT::Action::Generic - a generic baseclass for RT Actions
@@ -85,31 +84,31 @@ sub new {
# {{{ sub _Init
sub _Init {
my $self = shift;
- my %args = ( Argument => undef,
- CurrentUser => undef,
- ScripActionObj => undef,
- ScripObj => undef,
- TemplateObj => undef,
- TicketObj => undef,
- TransactionObj => undef,
- Type => undef,
-
- @_ );
-
+ my %args = ( TransactionObj => undef,
+ TicketObj => undef,
+ ScripObj => undef,
+ TemplateObj => undef,
+ Argument => undef,
+ Type => undef,
+ CurrentUser => undef,
+ @_ );
+
+
$self->{'Argument'} = $args{'Argument'};
- $self->CurrentUser( $args{'CurrentUser'});
- $self->{'ScripActionObj'} = $args{'ScripActionObj'};
$self->{'ScripObj'} = $args{'ScripObj'};
- $self->{'TemplateObj'} = $args{'TemplateObj'};
$self->{'TicketObj'} = $args{'TicketObj'};
$self->{'TransactionObj'} = $args{'TransactionObj'};
+ $self->{'TemplateObj'} = $args{'TemplateObj'};
$self->{'Type'} = $args{'Type'};
+ $self->CurrentUser( $args{'CurrentUser'});
+ Scalar::Util::weaken($self->{'ScripObj'});
+ Scalar::Util::weaken($self->{'TicketObj'});
+ Scalar::Util::weaken($self->{'TemplateObj'});
+ Scalar::Util::weaken($self->{'TransactionObj'});
+
+
+
- Scalar::Util::weaken($self->{'ScripActionObj'});
- Scalar::Util::weaken($self->{'ScripObj'});
- Scalar::Util::weaken($self->{'TemplateObj'});
- Scalar::Util::weaken($self->{'TicketObj'});
- Scalar::Util::weaken($self->{'TransactionObj'});
}
# }}}
@@ -151,13 +150,6 @@ sub ScripObj {
}
# }}}
-# {{{ sub ScripActionObj
-sub ScripActionObj {
- my $self = shift;
- return($self->{'ScripActionObj'});
-}
-# }}}
-
# {{{ sub Type
sub Type {
my $self = shift;
@@ -213,11 +205,13 @@ sub DESTROY {
# We need to clean up all the references that might maybe get
# oddly circular
- $self->{'ScripActionObj'} = undef;
- $self->{'ScripObj'} = undef;
$self->{'TemplateObj'} =undef
$self->{'TicketObj'} = undef;
$self->{'TransactionObj'} = undef;
+ $self->{'ScripObj'} = undef;
+
+
+
}
# }}}
diff --git a/rt/lib/RT/Action/Notify.pm b/rt/lib/RT/Action/Notify.pm
index 0daaa5586..4131a8c68 100755
--- a/rt/lib/RT/Action/Notify.pm
+++ b/rt/lib/RT/Action/Notify.pm
@@ -1,8 +1,8 @@
-# BEGIN BPS TAGGED BLOCK {{{
+# {{{ BEGIN BPS TAGGED BLOCK
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -42,7 +42,7 @@
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
#
-# END BPS TAGGED BLOCK }}}
+# }}} END BPS TAGGED BLOCK
#
package RT::Action::Notify;
require RT::Action::SendEmail;
@@ -158,9 +158,9 @@ sub SetRecipients {
@{ $self->{'Bcc'} } = @Bcc;
}
else {
- @{ $self->{'To'} } = grep ( lc $_ ne lc $creator, @To );
- @{ $self->{'Cc'} } = grep ( lc $_ ne lc $creator, @Cc );
- @{ $self->{'Bcc'} } = grep ( lc $_ ne lc $creator, @Bcc );
+ @{ $self->{'To'} } = grep ( !/^$creator$/, @To );
+ @{ $self->{'Cc'} } = grep ( !/^$creator$/, @Cc );
+ @{ $self->{'Bcc'} } = grep ( !/^$creator$/, @Bcc );
}
@{ $self->{'PseudoTo'} } = @PseudoTo;
diff --git a/rt/lib/RT/Action/NotifyAsComment.pm b/rt/lib/RT/Action/NotifyAsComment.pm
index f7cc87543..475e3555f 100755
--- a/rt/lib/RT/Action/NotifyAsComment.pm
+++ b/rt/lib/RT/Action/NotifyAsComment.pm
@@ -1,8 +1,8 @@
-# BEGIN BPS TAGGED BLOCK {{{
+# {{{ BEGIN BPS TAGGED BLOCK
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -42,7 +42,7 @@
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
#
-# END BPS TAGGED BLOCK }}}
+# }}} END BPS TAGGED BLOCK
package RT::Action::NotifyAsComment;
require RT::Action::Notify;
diff --git a/rt/lib/RT/Action/RecordComment.pm b/rt/lib/RT/Action/RecordComment.pm
index d9740dcd1..b548a26eb 100644
--- a/rt/lib/RT/Action/RecordComment.pm
+++ b/rt/lib/RT/Action/RecordComment.pm
@@ -1,8 +1,8 @@
-# BEGIN BPS TAGGED BLOCK {{{
+# {{{ BEGIN BPS TAGGED BLOCK
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -42,7 +42,31 @@
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
#
-# END BPS TAGGED BLOCK }}}
+# }}} END BPS TAGGED BLOCK
+# BEGIN LICENSE BLOCK
+#
+# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
+#
+# (Except where explictly superceded by other copyright notices)
+#
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+#
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# Unless otherwise specified, all modifications, corrections or
+# extensions to this work which alter its source code become the
+# property of Best Practical Solutions, LLC when submitted for
+# inclusion in the work.
+#
+#
+# END LICENSE BLOCK
+#
package RT::Action::RecordComment;
require RT::Action::Generic;
use strict;
diff --git a/rt/lib/RT/Action/RecordCorrespondence.pm b/rt/lib/RT/Action/RecordCorrespondence.pm
index 62255ec53..c6770c574 100644
--- a/rt/lib/RT/Action/RecordCorrespondence.pm
+++ b/rt/lib/RT/Action/RecordCorrespondence.pm
@@ -1,8 +1,8 @@
-# BEGIN BPS TAGGED BLOCK {{{
+# {{{ BEGIN BPS TAGGED BLOCK
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -42,7 +42,31 @@
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
#
-# END BPS TAGGED BLOCK }}}
+# }}} END BPS TAGGED BLOCK
+# BEGIN LICENSE BLOCK
+#
+# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
+#
+# (Except where explictly superceded by other copyright notices)
+#
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+#
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# Unless otherwise specified, all modifications, corrections or
+# extensions to this work which alter its source code become the
+# property of Best Practical Solutions, LLC when submitted for
+# inclusion in the work.
+#
+#
+# END LICENSE BLOCK
+#
package RT::Action::RecordCorrespondence;
require RT::Action::Generic;
use strict;
diff --git a/rt/lib/RT/Action/ResolveMembers.pm b/rt/lib/RT/Action/ResolveMembers.pm
index 00813181c..4d751eb6d 100644
--- a/rt/lib/RT/Action/ResolveMembers.pm
+++ b/rt/lib/RT/Action/ResolveMembers.pm
@@ -1,8 +1,8 @@
-# BEGIN BPS TAGGED BLOCK {{{
+# {{{ BEGIN BPS TAGGED BLOCK
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -42,7 +42,7 @@
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
#
-# END BPS TAGGED BLOCK }}}
+# }}} END BPS TAGGED BLOCK
# This Action will resolve all members of a resolved group ticket
package RT::Action::ResolveMembers;
diff --git a/rt/lib/RT/Action/SendEmail.pm b/rt/lib/RT/Action/SendEmail.pm
index 3c70dc401..a85c169b8 100755
--- a/rt/lib/RT/Action/SendEmail.pm
+++ b/rt/lib/RT/Action/SendEmail.pm
@@ -1,8 +1,8 @@
-# BEGIN BPS TAGGED BLOCK {{{
+# {{{ BEGIN BPS TAGGED BLOCK
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -42,7 +42,7 @@
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
#
-# END BPS TAGGED BLOCK }}}
+# }}} END BPS TAGGED BLOCK
# Portions Copyright 2000 Tobias Brox <tobix@cpan.org>
package RT::Action::SendEmail;
@@ -150,10 +150,6 @@ sub Prepare {
# try to convert message body from utf-8 to $RT::EmailOutputEncoding
$self->SetHeader( 'Content-Type', 'text/plain; charset="utf-8"' );
- # fsck.com #5959: Since RT sends 8bit mail, we should say so.
- $self->SetHeader( 'Content-Transfer-Encoding','8bit');
-
-
RT::I18N::SetMIMEEntityToEncoding( $MIMEObj, $RT::EmailOutputEncoding,
'mime_words_ok' );
$self->SetHeader( 'Content-Type', 'text/plain; charset="' . $RT::EmailOutputEncoding . '"' );
@@ -229,11 +225,9 @@ sub SendMessage {
my $self = shift;
my $MIMEObj = shift;
- my $msgid = $MIMEObj->head->get('Message-ID');
+ my $msgid = $MIMEObj->head->get('Message-Id');
chomp $msgid;
- $self->ScripActionObj->{_Message_ID}++;
-
$RT::Logger->info( $msgid . " #"
. $self->TicketObj->id . "/"
. $self->TransactionObj->id
@@ -400,13 +394,12 @@ sub RecordOutgoingMailTransaction {
$type = 'EmailRecord';
}
- my $msgid = $MIMEObj->head->get('Message-ID');
- chomp $msgid;
+
my ( $id, $msg ) = $transaction->Create(
Ticket => $self->TicketObj->Id,
Type => $type,
- Data => $msgid,
+ Data => $MIMEObj->head->get('Message-Id'),
MIMEObj => $MIMEObj,
ActivateScrips => 0
);
@@ -434,38 +427,28 @@ sub SetRTSpecialHeaders {
$self->SetHeaderAsEncoding( 'Subject', $RT::EmailOutputEncoding )
if ($RT::EmailOutputEncoding);
$self->SetReturnAddress();
- $self->SetReferencesHeaders();
-
- unless ($self->TemplateObj->MIMEObj->head->get('Message-ID')) {
- # Get Message-ID for this txn
- my $msgid = "";
- $msgid = $self->TransactionObj->Message->First->GetHeader("RT-Message-ID")
- || $self->TransactionObj->Message->First->GetHeader("Message-ID")
- if $self->TransactionObj->Message && $self->TransactionObj->Message->First;
-
- # If there is one, and we can parse it, then base our Message-ID on it
- if ($msgid
- and $msgid =~ s/<(rt-.*?-\d+-\d+)\.(\d+-0-0)\@$RT::Organization>$/
- "<$1." . $self->TicketObj->id
- . "-" . $self->ScripObj->id
- . "-" . $self->ScripActionObj->{_Message_ID}
- . "@" . $RT::Organization . ">"/eg
- and $2 == $self->TicketObj->id) {
- $self->SetHeader( "Message-ID" => $msgid );
- } else {
- $self->SetHeader( 'Message-ID',
- "<rt-"
- . $RT::VERSION . "-"
- . $$ . "-"
- . CORE::time() . "-"
- . int(rand(2000)) . '.'
- . $self->TicketObj->id . "-"
- . $self->ScripObj->id . "-" # Scrip
- . $self->ScripActionObj->{_Message_ID} . "@" # Email sent
- . $RT::Organization
- . ">" );
- }
- }
+
+ # TODO: this one is broken. What is this email really a reply to?
+ # If it's a reply to an incoming message, we'll need to use the
+ # actual message-id from the appropriate Attachment object. For
+ # incoming mails, we would like to preserve the In-Reply-To and/or
+ # References.
+
+ $self->SetHeader( 'In-Reply-To',
+ "<rt-" . $self->TicketObj->id() . "\@" . $RT::rtname . ">" );
+
+ # TODO We should always add References headers for all message-ids
+ # of previous messages related to this ticket.
+
+ $self->SetHeader( 'Message-ID',
+ "<rt-"
+ . $RT::VERSION . "-"
+ . $self->TicketObj->id() . "-"
+ . $self->TransactionObj->id() . "-"
+ . $self->ScripObj->Id . "."
+ . rand(20) . "\@"
+ . $RT::Organization . ">" )
+ unless $self->TemplateObj->MIMEObj->head->get('Message-ID');
$self->SetHeader( 'Precedence', "bulk" )
unless ( $self->TemplateObj->MIMEObj->head->get("Precedence") );
@@ -499,67 +482,28 @@ sub RemoveInappropriateRecipients {
my @blacklist;
- my @types = qw/To Cc Bcc/;
-
# Weed out any RT addresses. We really don't want to talk to ourselves!
- foreach my $type (@types) {
- @{ $self->{$type} } =
- RT::EmailParser::CullRTAddresses( "", @{ $self->{$type} } );
- }
+ @{ $self->{'To'} } =
+ RT::EmailParser::CullRTAddresses( "", @{ $self->{'To'} } );
+ @{ $self->{'Cc'} } =
+ RT::EmailParser::CullRTAddresses( "", @{ $self->{'Cc'} } );
+ @{ $self->{'Bcc'} } =
+ RT::EmailParser::CullRTAddresses( "", @{ $self->{'Bcc'} } );
# 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')
- )
- {
-
- # What do we want to do with this? It's probably (?) a bounce
- # caused by one of the watcher addresses being broken.
- # Default ("true") is to redistribute, for historical reasons.
-
- if ( !$RT::RedistributeAutoGeneratedMessages ) {
-
- # Don't send to any watchers.
- @{ $self->{'To'} } = ();
- @{ $self->{'Cc'} } = ();
- @{ $self->{'Bcc'} } = ();
-
- }
- elsif ( $RT::RedistributeAutoGeneratedMessages eq 'privileged' ) {
-
- # Only send to "privileged" watchers.
- #
-
- foreach my $type (@types) {
-
- foreach my $addr ( @{ $self->{$type} } ) {
- my $user = RT::User->new($RT::SystemUser);
- $user->LoadByEmail($addr);
- @{ $self->{$type} } =
- grep ( !/^\Q$addr\E$/, @{ $self->{$type} } )
- if ( !$user->Privileged );
-
- }
- }
-
- }
-
- }
-
+ if ( defined $self->TransactionObj->Attachments->First() ) {
my $squelch =
$self->TransactionObj->Attachments->First->GetHeader(
'RT-Squelch-Replies-To');
if ($squelch) {
- @blacklist = split( /,/, $squelch );
+ @blacklist = split ( /,/, $squelch );
}
}
- # Let's grab the SquelchMailTo attribue and push those entries into the @blacklist
+# Let's grab the SquelchMailTo attribue and push those entries into the @blacklist
my @non_recipients = $self->TicketObj->SquelchMailTo;
foreach my $attribute (@non_recipients) {
push @blacklist, $attribute->Content;
@@ -570,10 +514,10 @@ sub RemoveInappropriateRecipients {
foreach my $person_to_yank (@blacklist) {
$person_to_yank =~ s/\s//g;
- foreach my $type (@types) {
- @{ $self->{$type} } =
- grep ( !/^\Q$person_to_yank\E$/, @{ $self->{$type} } );
- }
+ @{ $self->{'To'} } = grep ( !/^$person_to_yank$/, @{ $self->{'To'} } );
+ @{ $self->{'Cc'} } = grep ( !/^$person_to_yank$/, @{ $self->{'Cc'} } );
+ @{ $self->{'Bcc'} } =
+ grep ( !/^$person_to_yank$/, @{ $self->{'Bcc'} } );
}
}
@@ -727,93 +671,8 @@ sub SetSubjectToken {
# }}}
-=head2 SetReferencesHeaders
-
-Set References and In-Reply-To headers for this message.
-
-=cut
-
-sub SetReferencesHeaders {
-
- my $self = shift;
- my ( @in_reply_to, @references, @msgid );
-
- my $attachments = $self->TransactionObj->Message;
-
- if ( my $top = $attachments->First() ) {
- @in_reply_to = split(/\s+/m, $top->GetHeader('In-Reply-To') || '');
- @references = split(/\s+/m, $top->GetHeader('References') || '' );
- @msgid = split(/\s+/m, $top->GetHeader('Message-ID') || '');
- }
- else {
- return (undef);
- }
-
- # There are two main cases -- this transaction was created with
- # the RT Web UI, and hence we want to *not* append its Message-ID
- # to the References and In-Reply-To. OR it came from an outside
- # source, and we should treat it as per the RFC
- if ( "@msgid" =~ /<(rt-.*?-\d+-\d+)\.(\d+-0-0)\@$RT::Organization>/) {
-
- # Make all references which are internal be to version which we
- # have sent out
- for (@references, @in_reply_to) {
- s/<(rt-.*?-\d+-\d+)\.(\d+-0-0)\@$RT::Organization>$/
- "<$1." . $self->TicketObj->id .
- "-" . $self->ScripObj->id .
- "-" . $self->ScripActionObj->{_Message_ID} .
- "@" . $RT::Organization . ">"/eg
- }
-
- # In reply to whatever the internal message was in reply to
- $self->SetHeader( 'In-Reply-To', join( " ", ( @in_reply_to )));
-
- # Default the references to whatever we're in reply to
- @references = @in_reply_to unless @references;
-
- # References are unchanged from internal
- } else {
- # In reply to that message
- $self->SetHeader( 'In-Reply-To', join( " ", ( @msgid )));
-
- # Default the references to whatever we're in reply to
- @references = @in_reply_to unless @references;
-
- # Push that message onto the end of the references
- push @references, @msgid;
- }
-
- # Push pseudo-ref to the front
- my $pseudo_ref = $self->PseudoReference;
- @references = ($pseudo_ref, grep { $_ ne $pseudo_ref } @references);
-
- # If there are more than 10 references headers, remove all but the
- # first four and the last six (Gotta keep this from growing
- # forever)
- splice(@references, 4, -6) if ($#references >= 10);
-
- # Add on the references
- $self->SetHeader( 'References', join( " ", @references) );
- $self->TemplateObj->MIMEObj->head->fold_length( 'References', 80 );
-
-}
-
# }}}
-=head2 PseudoReference
-
-Returns a fake Message-ID: header for the ticket to allow a base level of threading
-
-=cut
-
-sub PseudoReference {
-
- my $self = shift;
- my $pseudo_ref = '<RT-Ticket-'.$self->TicketObj->id .'@'.$RT::Organization .'>';
- return $pseudo_ref;
-}
-
-
# {{{ SetHeadingAsEncoding
=head2 SetHeaderAsEncoding($field_name, $charset_encoding)
diff --git a/rt/lib/RT/Action/SetPriority.pm b/rt/lib/RT/Action/SetPriority.pm
index c129bf0a2..d3272a024 100644
--- a/rt/lib/RT/Action/SetPriority.pm
+++ b/rt/lib/RT/Action/SetPriority.pm
@@ -1,8 +1,8 @@
-# BEGIN BPS TAGGED BLOCK {{{
+# {{{ BEGIN BPS TAGGED BLOCK
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -42,7 +42,7 @@
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
#
-# END BPS TAGGED BLOCK }}}
+# }}} END BPS TAGGED BLOCK
package RT::Action::SetPriority;
require RT::Action::Generic;
diff --git a/rt/lib/RT/Action/UserDefined.pm b/rt/lib/RT/Action/UserDefined.pm
index 90653f68a..c298a7c7f 100644
--- a/rt/lib/RT/Action/UserDefined.pm
+++ b/rt/lib/RT/Action/UserDefined.pm
@@ -1,8 +1,8 @@
-# BEGIN BPS TAGGED BLOCK {{{
+# {{{ BEGIN BPS TAGGED BLOCK
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -42,7 +42,7 @@
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
#
-# END BPS TAGGED BLOCK }}}
+# }}} END BPS TAGGED BLOCK
package RT::Action::UserDefined;