[Rt-commit] r5241 - RT-Extension-CommandByEmail/patch
ruz at bestpractical.com
ruz at bestpractical.com
Wed May 17 00:56:42 EDT 2006
Author: ruz
Date: Wed May 17 00:56:41 2006
New Revision: 5241
Added:
RT-Extension-CommandByEmail/patch/command_by_email-0.1-RT-3.4.2.patch
RT-Extension-CommandByEmail/patch/command_by_email-0.1-RT-3.4.3.patch
RT-Extension-CommandByEmail/patch/command_by_email-0.1-RT-3.4.4.patch
Modified:
RT-Extension-CommandByEmail/patch/command_by_email-0.1-RT-3.4.5.patch
Log:
* more patches, down to RT-3.4.2
Added: RT-Extension-CommandByEmail/patch/command_by_email-0.1-RT-3.4.2.patch
==============================================================================
--- (empty file)
+++ RT-Extension-CommandByEmail/patch/command_by_email-0.1-RT-3.4.2.patch Wed May 17 00:56:41 2006
@@ -0,0 +1,71 @@
+--- lib/RT/Interface/Email.pm 2006-05-17 06:05:17.000000000 +0400
++++ lib/RT/Interface/Email.pm 2006-05-17 06:29:42.000000000 +0400
+@@ -544,10 +544,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';
+@@ -570,6 +569,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) {
+@@ -604,11 +607,12 @@
+
+
+ # 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;
+ }
+
+ # {{{ If authentication fails and no new user was created, get out.
+@@ -730,7 +734,7 @@
+ my $Ticket = RT::Ticket->new($CurrentUser);
+
+ # {{{ If we don't have a ticket Id, we're creating a new ticket
+- if ( !$SystemTicket || !$SystemTicket->Id) {
++ if ( (!$SystemTicket || !$SystemTicket->Id) && !$skip_action{ $args{'action'} } ) {
+
+ # {{{ Create a new ticket
+
+@@ -769,10 +773,10 @@
+ # }}}
+
+ # If the action is comment, add a comment.
+- elsif ( $args{'action'} =~ /^(comment|correspond)$/i ) {
+- $Ticket->Load( $args{'ticket'} );
++ elsif ( $args{'action'} =~ /^(comment|correspond)$/i && !$skip_action{ $args{'action'} } ) {
++ $Ticket->Load( $SystemTicket->Id );
+ unless ( $Ticket->Id ) {
+- my $message = "Could not find a ticket with id " . $args{'ticket'};
++ my $message = "Could not find a ticket with id " . $SystemTicket->Id || $args{'ticket'};
+ MailError(
+ To => $ErrorsTo,
+ Subject => "Message not recorded",
+@@ -803,7 +807,7 @@
+ }
+ }
+
+- else {
++ elsif ( !$skip_action{ $args{'action'} } ) {
+
+ #Return mail to the sender with an error
+ MailError(
Added: RT-Extension-CommandByEmail/patch/command_by_email-0.1-RT-3.4.3.patch
==============================================================================
--- (empty file)
+++ RT-Extension-CommandByEmail/patch/command_by_email-0.1-RT-3.4.3.patch Wed May 17 00:56:41 2006
@@ -0,0 +1,53 @@
+--- 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
Added: RT-Extension-CommandByEmail/patch/command_by_email-0.1-RT-3.4.4.patch
==============================================================================
--- (empty file)
+++ RT-Extension-CommandByEmail/patch/command_by_email-0.1-RT-3.4.4.patch Wed May 17 00:56:41 2006
@@ -0,0 +1,53 @@
+--- 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
Modified: RT-Extension-CommandByEmail/patch/command_by_email-0.1-RT-3.4.5.patch
==============================================================================
--- RT-Extension-CommandByEmail/patch/command_by_email-0.1-RT-3.4.5.patch (original)
+++ RT-Extension-CommandByEmail/patch/command_by_email-0.1-RT-3.4.5.patch Wed May 17 00:56:41 2006
@@ -512,7 +512,7 @@
}
last if $AuthStat == -1;
-@@ -624,132 +646,60 @@
+@@ -624,132 +646,64 @@
last if $AuthStat == -1;
}
@@ -658,23 +658,26 @@
}
- # }}}
--
- my $Ticket = RT::Ticket->new($CurrentUser);
++ # strip actions we should skip
++ @actions = grep !$skip_action{$_}, @actions;
+
+- my $Ticket = RT::Ticket->new($CurrentUser);
++ # if plugin's updated SystemTicket then update arguments
++ $args{'ticket'} = $SystemTicket->Id if $SystemTicket && $SystemTicket->Id;
- # {{{ If we don't have a ticket Id, we're creating a new ticket
- if ( (!$SystemTicket || !$SystemTicket->Id) &&
- grep /^(comment|correspond)$/, @actions ) {
--
++ my $Ticket = RT::Ticket->new($CurrentUser);
+
- # {{{ Create a new ticket
+ if (( !$SystemTicket || !$SystemTicket->Id )
-+ && grep /^(comment|correspond)$/ && !$skip_action{$_},
-+ @actions
-+ )
++ && grep /^(comment|correspond)$/, @actions )
+ {
my @Cc;
my @Requestors = ( $CurrentUser->id );
-@@ -776,38 +726,40 @@
+@@ -776,38 +730,39 @@
Explanation => $ErrStr,
MIMEObj => $Message
);
@@ -692,11 +695,10 @@
- }
+ } else {
-- $Ticket->Load( $args{'ticket'} );
-+ $Ticket->Load( $SystemTicket->id );
+ $Ticket->Load( $args{'ticket'} );
unless ( $Ticket->Id ) {
- my $message = "Could not find a ticket with id " . $args{'ticket'};
-+ my $error = "Could not find a ticket with id " . $SystemTicket->id || $args{'ticket'};
++ my $error = "Could not find a ticket with id " . $args{'ticket'};
MailError(
To => $ErrorsTo,
Subject => "Message not recorded",
@@ -713,7 +715,6 @@
# }}}
- foreach my $action( @actions ) {
+ foreach my $action (@actions) {
-+ next if $skip_action{ $action };
+
# If the action is comment, add a comment.
- if ( $action =~ /^(comment|correspond)$/i ) {
@@ -729,7 +730,7 @@
( $status, $msg ) = $Ticket->Comment( MIMEObj => $Message );
}
unless ($status) {
-@@ -821,77 +773,196 @@
+@@ -821,77 +776,196 @@
);
return ( 0, "Message not recorded", $Ticket );
}
More information about the Rt-commit
mailing list