[Rt-commit] r5256 - rt/branches/3.4-RELEASE/lib/RT/Interface
ruz at bestpractical.com
ruz at bestpractical.com
Thu May 18 21:45:59 EDT 2006
Author: ruz
Date: Thu May 18 21:45:58 2006
New Revision: 5256
Modified:
rt/branches/3.4-RELEASE/lib/RT/Interface/Email.pm
Log:
* allow to complete actions in mail plugins
Modified: rt/branches/3.4-RELEASE/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/Interface/Email.pm (original)
+++ rt/branches/3.4-RELEASE/lib/RT/Interface/Email.pm Thu May 18 21:45:58 2006
@@ -602,8 +602,11 @@
push @RT::MailPlugins, "Auth::MailFrom" unless @RT::MailPlugins;
- # Since this needs loading, no matter what
+ # if plugin returns AuthStat -2 we skip action
+ # NOTE: this is experimental API and it would be changed
+ my %skip_action = ();
+ # Since this needs loading, no matter what
foreach (@RT::MailPlugins) {
my ($Code, $Class, $NewAuthStat);
if ( ref($_) eq "CODE" ) {
@@ -611,7 +614,8 @@
} else {
$Class = "RT::Interface::Email::" . $_
unless $_ =~ /^RT::Interface::Email::/;
- $Class->require;
+ $Class->require or
+ do { $RT::Logger->error("Couldn't load $Class: $@"); next };
}
no strict 'refs';
if ( !defined( $Code = *{ $Class . "::GetCurrentUser" }{CODE} ) ) {
@@ -634,9 +638,10 @@
# You get the highest level of authentication you were assigned, unless you get the magic -1
# If a module returns a "-1" then we discard the ticket, so.
$AuthStat = $NewAuthStat
- if ( $NewAuthStat > $AuthStat or $NewAuthStat == -1 );
+ if ( $NewAuthStat > $AuthStat or $NewAuthStat == -1 or $NewAuthStat == -2 );
last if $AuthStat == -1;
+ $skip_action{$action}++ if $AuthStat == -2;
}
last if $AuthStat == -1;
@@ -687,13 +692,17 @@
unless ($continue) {
return ( 0, $result, undef );
}
+
+ # strip actions we should skip
+ @actions = grep !$skip_action{$_}, @actions;
+
+ # if plugin's updated SystemTicket then update arguments
+ $args{'ticket'} = $SystemTicket->Id if $SystemTicket && $SystemTicket->Id;
my $Ticket = RT::Ticket->new($CurrentUser);
if (( !$SystemTicket || !$SystemTicket->Id )
- && grep /^(comment|correspond)$/,
- @actions
- )
+ && grep /^(comment|correspond)$/, @actions )
{
my @Cc;
More information about the Rt-commit
mailing list