--- lib/RT/Interface/Email.pm 2005-08-03 04:18:54.000000000 +0400
+++ lib/RT/Interface/Email.pm 2006-05-17 07:39:13.000000000 +0400
@@ -540,10 +540,9 @@
$args{'ticket'} ||= ParseTicketId($Subject);
- my $SystemTicket;
+ my $SystemTicket = RT::Ticket->new($RT::SystemUser);
my $Right = 'CreateTicket';
if ( $args{'ticket'} ) {
- $SystemTicket = RT::Ticket->new($RT::SystemUser);
$SystemTicket->Load( $args{'ticket'} );
# if there's an existing ticket, this must be a reply
$Right = 'ReplyToTicket';
@@ -566,6 +565,10 @@
push @RT::MailPlugins, "Auth::MailFrom" unless @RT::MailPlugins;
+ # 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) {
@@ -602,12 +605,13 @@
# If a module returns a "-1" then we discard the ticket, so.
- $AuthStat = -1 if $NewAuthStat == -1;
+ $AuthStat = $NewAuthStat if $NewAuthStat == -1 or $NewAuthStat == -2;
# You get the highest level of authentication you were assigned.
$AuthStat = $NewAuthStat if $NewAuthStat > $AuthStat;
last if $AuthStat == -1;
+ $skip_action{ $args{'action'} }++ if $AuthStat == -2;
}
last if $AuthStat == -1;
@@ -729,6 +733,12 @@
# }}}
+ # strip skipped actions
+ @actions = grep !$skip_action{$_}, @actions;
+
+ # if plugin changed system ticket then we should update ticket
+ $args{'ticket'} = $SystemTicket->Id if $SystemTicket && $SystemTicket->Id;
+
my $Ticket = RT::Ticket->new($CurrentUser);
# {{{ If we don't have a ticket Id, we're creating a new ticket