[Rt-commit] r8641 - in rt/branches/3.7-EXPERIMENTAL: . docs etc html/Elements html/Elements/CollectionAsTable html/Ticket html/Ticket/Elements lib/RT lib/RT/Crypt lib/RT/Interface lib/RT/Interface/Email/Auth lib/t/data/crypt-gnupg-realmail lib/t/data/mail t/mail

ruz at bestpractical.com ruz at bestpractical.com
Mon Aug 20 10:32:27 EDT 2007


Author: ruz
Date: Mon Aug 20 10:32:18 2007
New Revision: 8641

Added:
   rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/
   rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/pubring.gpg   (contents, props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/random_seed   (contents, props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/rt-recipient-pubkey
   rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/rt-recipient-seckey
   rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/rt-test-pubkey
   rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/rt-test-seckey
   rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/secring.gpg   (contents, props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/trustdb.gpg   (contents, props changed)
Removed:
   rt/branches/3.7-EXPERIMENTAL/docs/locking
   rt/branches/3.7-EXPERIMENTAL/html/Elements/ShowLock
   rt/branches/3.7-EXPERIMENTAL/lib/RT/TicketLocking.pm
   rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-realmail/
Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/etc/RT_Config.pm.in
   rt/branches/3.7-EXPERIMENTAL/html/Elements/CollectionAsTable/Row
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/Display.html
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/Tabs
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/Forward.html
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/History.html
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/Modify.html
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyAll.html
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyDates.html
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyLinks.html
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyPeople.html
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/Reminders.html
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/Update.html
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Date.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/EmailParser.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email/Auth/GnuPG.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Record.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm
   rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm
   rt/branches/3.7-EXPERIMENTAL/lib/t/data/mail/16-signed-encrypted-inline-plain.txt
   rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-incoming.t
   rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t

Log:
* merge TUNIS branch back into 3.7-EXPERIMENTAL, we're ging to
  close the former

 r8523 at cubic-pc (orig r8522):  ruz | 2007-08-14 04:35:43 +0400
 * set_rights without arguments should clear all things
 r8524 at cubic-pc (orig r8523):  ruz | 2007-08-14 04:36:39 +0400
 * pass through arguments
 r8525 at cubic-pc (orig r8524):  ruz | 2007-08-14 04:40:13 +0400
 * on systems where we must call tzset we must call it twice,
   first time when we set TZ using local and second time when
   it's restored
 r8527 at cubic-pc (orig r8526):  ruz | 2007-08-14 05:39:42 +0400
 * add {store,restore}_rights to RT::Test
 r8539 at cubic-pc (orig r8538):  sartak | 2007-08-14 20:05:25 +0400
  r37384 at gorgoroth:  sartak | 2007-08-14 12:05:13 -0400
  Use passphrase from GnuPGOptions if necessary
 
 r8547 at cubic-pc (orig r8546):  sartak | 2007-08-14 21:27:18 +0400
  r37404 at gorgoroth:  sartak | 2007-08-14 13:25:54 -0400
  Get rid of a message envelope
 
 r8548 at cubic-pc (orig r8547):  sartak | 2007-08-14 21:27:39 +0400
  r37405 at gorgoroth:  sartak | 2007-08-14 13:26:58 -0400
  Fill in the right expected md5 of the binary file
 
 r8561 at cubic-pc (orig r8560):  thayes | 2007-08-16 02:51:10 +0400
  r8737 at toth:  toth | 2007-08-13 15:05:07 -0400
  * Switched to 3.7-EXPERIMENTAL from TUNIS
  
 
 r8563 at cubic-pc (orig r8562):  thayes | 2007-08-16 02:54:47 +0400
  r8738 at toth:  toth | 2007-08-15 18:44:23 -0400
  * Moved ticket locking methods to new RT-Extension-TicketLocking (coming soon to a repo near you)
 
 r8568 at cubic-pc (orig r8567):  ruz | 2007-08-16 05:17:19 +0400
 * Class_accessible should work as class method too
 r8569 at cubic-pc (orig r8568):  ruz | 2007-08-16 05:18:14 +0400
 * update queue's main properties when we load_or_create_queue.
 r8570 at cubic-pc (orig r8569):  ruz | 2007-08-16 06:02:19 +0400
 * comment out things left from locking to make it possible to hack on
   other things
 r8571 at cubic-pc (orig r8570):  sartak | 2007-08-16 06:15:06 +0400
  r37479 at gorgoroth:  sartak | 2007-08-15 22:14:55 -0400
  svk was ignoring my changes to the keys, so moving the gpg directory
 
 r8577 at cubic-pc (orig r8576):  thayes | 2007-08-16 21:04:16 +0400
  r8737 at toth:  toth | 2007-08-13 15:05:07 -0400
  * Switched to 3.7-EXPERIMENTAL from TUNIS
  
 
 r8578 at cubic-pc (orig r8577):  thayes | 2007-08-16 21:07:53 +0400
  r8738 at toth:  toth | 2007-08-15 18:44:23 -0400
  * Moved ticket locking methods to new RT-Extension-TicketLocking (coming soon to a repo near you)
 
 r8579 at cubic-pc (orig r8578):  thayes | 2007-08-16 21:08:11 +0400
  r8739 at toth:  toth | 2007-08-15 18:45:09 -0400
  * Modified various files to use callbacks for the TicketLocking extension
  
 
 r8580 at cubic-pc (orig r8579):  thayes | 2007-08-16 21:08:26 +0400
  r8740 at toth:  toth | 2007-08-15 18:46:39 -0400
  * Removed ShowLock element, as it is now part of RT-Extension-TicketLocking
  
 
 r8581 at cubic-pc (orig r8580):  sartak | 2007-08-16 21:37:50 +0400
  r30359 at caladan:  sartak | 2007-08-16 13:36:37 -0400
  Add 'exact' argument to RT::EmailParser to trigger MIME::Parser->decode_bodies(0)
  Use it in RT::Interface::Email::Auth::GnuPG
  We're almost there, RT::Crypt::GnuPG is emitting correctly-formatted data, must be some little issue remaining that's causing things to fail. One hopes :)
 
 r8582 at cubic-pc (orig r8581):  sartak | 2007-08-16 23:00:57 +0400
  r30365 at caladan:  sartak | 2007-08-16 15:00:28 -0400
  Set headers on the right message
 
 r8583 at cubic-pc (orig r8582):  thayes | 2007-08-16 23:03:32 +0400
  r8801 at toth:  toth | 2007-08-16 11:01:46 -0400
  * Shifted to TUNIS branch
  
 
 r8584 at cubic-pc (orig r8583):  thayes | 2007-08-16 23:03:48 +0400
  r8809 at toth:  toth | 2007-08-16 15:02:32 -0400
  * Modified callback names to be more general (not involve "Lock" specifically
  
 
 r8586 at cubic-pc (orig r8585):  sartak | 2007-08-16 23:07:41 +0400
  r30367 at caladan:  sartak | 2007-08-16 15:07:04 -0400
  Include email IDs on test names for easier tracking
 
 r8591 at cubic-pc (orig r8590):  sartak | 2007-08-17 00:58:10 +0400
  r30372 at caladan:  sartak | 2007-08-16 16:42:06 -0400
  Add an OutEntity that decrypted text will be saved in
 
 r8592 at cubic-pc (orig r8591):  sartak | 2007-08-17 00:58:24 +0400
  r30373 at caladan:  sartak | 2007-08-16 16:57:25 -0400
  Use DataIn as a field instead of Data
  This way I can add DataOut
 
 r8593 at cubic-pc (orig r8592):  sartak | 2007-08-17 01:27:02 +0400
  r30380 at caladan:  sartak | 2007-08-16 17:26:35 -0400
  Getting closer! down to 15 failures with still obvious places to fix
 
 r8594 at cubic-pc (orig r8593):  sartak | 2007-08-17 01:46:27 +0400
  r30382 at caladan:  sartak | 2007-08-16 17:46:01 -0400
  Closer still!
 
 r8595 at cubic-pc (orig r8594):  thayes | 2007-08-17 02:04:32 +0400
  r8737 at toth:  toth | 2007-08-13 15:05:07 -0400
  * Switched to 3.7-EXPERIMENTAL from TUNIS
  
 
 r8596 at cubic-pc (orig r8595):  thayes | 2007-08-17 02:04:48 +0400
  r8738 at toth:  toth | 2007-08-15 18:44:23 -0400
  * Moved ticket locking methods to new RT-Extension-TicketLocking (coming soon to a repo near you)
 
 r8597 at cubic-pc (orig r8596):  thayes | 2007-08-17 02:05:59 +0400
  r8739 at toth:  toth | 2007-08-15 18:45:09 -0400
  * Modified various files to use callbacks for the TicketLocking extension
  
 
 r8600 at cubic-pc (orig r8599):  ruz | 2007-08-17 02:28:49 +0400
 * delete accidently commited copies of whole project
 r8601 at cubic-pc (orig r8600):  ruz | 2007-08-17 02:43:40 +0400
 * get rid of gpg homedir permissions warnings
 * we don't have GnuPGNG plugin for a long time, it's been renamed
 r8603 at cubic-pc (orig r8602):  ruz | 2007-08-17 05:28:58 +0400
 * get rid of 'get_latest_ticket_ok'
 r8604 at cubic-pc (orig r8603):  ruz | 2007-08-17 05:30:21 +0400
 * instead of popping an attachment object, let's find object with a filename,
 
 r8611 at cubic-pc (orig r8610):  thayes | 2007-08-18 00:40:09 +0400
  r8740 at toth:  toth | 2007-08-15 18:46:39 -0400
  * Removed ShowLock element, as it is now part of RT-Extension-TicketLocking
  
 
 r8612 at cubic-pc (orig r8611):  thayes | 2007-08-18 00:54:30 +0400
  r8801 at toth:  toth | 2007-08-16 11:01:46 -0400
  * Shifted to TUNIS branch
  
 
 r8613 at cubic-pc (orig r8612):  thayes | 2007-08-18 00:56:29 +0400
  r8809 at toth:  toth | 2007-08-16 15:02:32 -0400
  * Modified callback names to be more general (not involve "Lock" specifically
  
 
 r8614 at cubic-pc (orig r8613):  thayes | 2007-08-18 00:57:38 +0400
  r8824 at toth:  toth | 2007-08-16 18:03:05 -0400
  * Modified to pass more useful information to the BeforeActionsList callback
  
 
 r8615 at cubic-pc (orig r8614):  thayes | 2007-08-18 01:00:05 +0400
  r8851 at toth:  toth | 2007-08-17 16:33:28 -0400
  * Hopefully this will get rid of the aggravating recursive checkins? Maybe?
  
 
 r8616 at cubic-pc (orig r8615):  thayes | 2007-08-18 01:03:38 +0400
  r8853 at toth:  toth | 2007-08-17 16:42:31 -0400
  * Removed Locking section of RT Config (now covered in the README for RT-Extension-TicketLocking)
  * Very minor formatting changes to Collection-As-Row tables (to make the source a bit easier to read)
  * Moved ProcessArguments callback as it was getting an undefined ticket object where it was
  
 
 r8617 at cubic-pc (orig r8616):  thayes | 2007-08-18 01:06:05 +0400
  r8854 at toth:  toth | 2007-08-17 16:51:53 -0400
  * Moved to RT-Extension-TicketLocking
  
 
 r8625 at cubic-pc (orig r8624):  ruz | 2007-08-18 04:31:33 +0400
 * get rid of {{{, }}} wrappers
 r8626 at cubic-pc (orig r8625):  ruz | 2007-08-18 07:15:14 +0400
 * update docs
 r8627 at cubic-pc (orig r8626):  ruz | 2007-08-18 08:14:07 +0400
 * fix number of tests
 r8628 at cubic-pc (orig r8627):  sartak | 2007-08-18 08:15:54 +0400
  r37593 at gorgoroth:  sartak | 2007-08-18 00:14:26 -0400
  Revert my split message parsing changes, ruz has his better fix ready
 
 r8629 at cubic-pc (orig r8628):  ruz | 2007-08-18 09:42:40 +0400
 * add 'Exact' argument to email parser, that is equivalent of
   decode_bodies(0) of MIME::Parser
 
 r8630 at cubic-pc (orig r8629):  ruz | 2007-08-18 09:44:32 +0400
 * add _DecodeBody and _DecodeBodies methods to RT::EmailParser
 
 r8631 at cubic-pc (orig r8630):  ruz | 2007-08-18 09:56:28 +0400
 ::Interface::Email::Gateway()
 * run 'ApplyBeforeDecode' plugins before decoding bodies and before playing
   with charsets, after that decode bodies, convert charsets and apply other
   plugins
 
 r8632 at cubic-pc (orig r8631):  ruz | 2007-08-18 10:18:20 +0400
 * on decrypting we need decoded bodies
 r8633 at cubic-pc (orig r8632):  ruz | 2007-08-18 11:20:32 +0400
 * log error only if there is an error
 r8634 at cubic-pc (orig r8633):  ruz | 2007-08-18 11:21:36 +0400
 * drop debug statement
 r8635 at cubic-pc (orig r8634):  ruz | 2007-08-18 11:52:54 +0400
 * add a little bit of debug info
 r8636 at cubic-pc (orig r8635):  ruz | 2007-08-18 12:00:40 +0400
 * use more correct parsing API instead of hacks
 r8640 at cubic-pc (orig r8639):  ruz | 2007-08-20 14:12:43 +0400
 * remove parts of locking that are left in the code
 r8641 at cubic-pc (orig r8640):  ruz | 2007-08-20 14:21:12 +0400
 * delete things related to locking from core


Modified: rt/branches/3.7-EXPERIMENTAL/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/etc/RT_Config.pm.in	(original)
+++ rt/branches/3.7-EXPERIMENTAL/etc/RT_Config.pm.in	Mon Aug 20 10:32:18 2007
@@ -694,19 +694,6 @@
 
 
 
-# {{{ Ticket Locking
-#
-# RT can be configured to use advisory locks on tickets, so that a user
-# can be notified if another user is making changes to a particular ticket.
-#
-# Locks have a maximum duration, which can be defined here (in seconds).
-
-Set($LockExpiry, 300);
-
-#}}}
-
-
-
 # {{{ Development Mode
 #
 # RT comes with a "Development mode" setting. 

Modified: rt/branches/3.7-EXPERIMENTAL/html/Elements/CollectionAsTable/Row
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Elements/CollectionAsTable/Row	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Elements/CollectionAsTable/Row	Mon Aug 20 10:32:18 2007
@@ -56,7 +56,7 @@
 $Class     => 'RT__Ticket'
 </%ARGS>
 <%init>
-$m->out('<tr class="' . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' ) . '" >' );
+$m->out('<tr class="' . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' ) . '" >' . "\n" );
 my $item;
 foreach my $column ( @Format ) {
     if ( defined $column->{title} && $column->{title} eq 'NEWLINE' ) {
@@ -65,10 +65,10 @@
             $item++;
         }
         $item = 0;
-        $m->out('</tr>');
+        $m->out('</tr>' . "\n");
         $m->out('<tr class="'
               . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' )
-              . '" >' );
+              . '" >' . "\n" );
         next;
     }
 
@@ -115,7 +115,7 @@
         s/\n/<br \/>/gs for @out;
         $m->out( @out ) if @out;
     }
-    $m->out('</td>');
+    $m->out('</td>' . "\n");
 }
 $m->out('</tr>');
 </%init>

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/Display.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/Display.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/Display.html	Mon Aug 20 10:32:18 2007
@@ -52,8 +52,7 @@
     current_tab => 'Ticket/Display.html?id='.$TicketObj->id,
     Title => loc("#[_1]: [_2]", $TicketObj->Id, $TicketObj->Subject) &>
 
-% $Duration ||= $ARGS{'Duration'};
-<& /Elements/ShowLock, Ticket => $TicketObj, Duration => $Duration &>
+% $m->callback(CallbackName => 'BeforeActionList', %ARGS, Actions => \@Actions, ARGSref => \%ARGS, Ticket => $TicketObj);
 
 <& /Elements/ListActions, actions => \@Actions &>
 <& Elements/ShowUpdateStatus, Ticket => $TicketObj &>
@@ -91,8 +90,7 @@
 $m->callback( TicketObj => $TicketObj, ARGSRef => \%ARGS, CallbackName => 'Initial' );
 
 my (@Actions, $Tickets);  
-my $Duration;
-my $time;
+
 
 unless ($id || $TicketObj) {
     Abort('No ticket specified');
@@ -132,24 +130,12 @@
             push(@Actions, $msg);
         }
     }
-    
-    if ( defined $ARGS{'Lock'} ) {
-        if ( $ARGS{'Lock'} eq 'add' ) {
-            if ( $TicketObj->Lock('Hard') ) {
-                push @Actions, loc('You now have a lock on this ticket');
-            } else {
-                push @Actions, loc('Your attempt to lock this ticket failed');
-            }
-        } elsif ( $ARGS{'Lock'} eq 'remove' ) {
-            my $msg;
-            ($Duration, $msg) = $TicketObj->Unlock('Hard');
-            push @Actions, loc($msg);
-        } elsif ( $ARGS{'Lock'} eq 'break' ) {
-            $TicketObj->BreakLock();
-            push @Actions, loc('You have broken the lock on this ticket');
-        }
-    }
 
+    $m->callback(CallbackName => 'ProcessArguments', 
+            Ticket => $TicketObj, 
+            ARGSref => \%ARGS, 
+            Actions => \@Actions);
+    
     $ARGS{'UpdateContent'} =~ s/\r\n/\n/g if defined $ARGS{'UpdateContent'};
     if ( $ARGS{'UpdateTimeWorked'} || (
         defined $ARGS{'UpdateContent'}

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/Tabs
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/Tabs	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/Tabs	Mon Aug 20 10:32:18 2007
@@ -60,7 +60,7 @@
 my $actions;
 
 if ( $Ticket) {
-	
+    
 my $id   = $Ticket->id();
 
 if ( defined $session{'tickets'} ) {
@@ -72,7 +72,7 @@
 
         if ($updatesession) {
                 $session{'i'}++;
-		$session{'tickets'}->PrepForSerialization();
+        $session{'tickets'}->PrepForSerialization();
         }
 
         # Don't display prev links if we're on the first ticket
@@ -235,30 +235,6 @@
     ($searchtab =~ /^_/) ? $tabs->{"s".$searchtab} = $searchtabs->{$searchtab} : $tabs->{"z_".$searchtab} = $searchtabs->{$searchtab};
   }
 }
-if ($Ticket) {
-	if (my $Lock = $Ticket->Locked()) {
-		if ($Lock->Content->{'User'} == $session{'CurrentUser'}->id) {
-		$actions->{'Lock'} = { 
-						path  => "Ticket/Display.html?Lock=remove&id=" . $Ticket->Id,
-						title => loc('Unlock') 
-						};
-		} else {
-		$actions->{'Lock'} = { 
-						path  => "Ticket/Display.html?Lock=break&id=" . $Ticket->Id,
-						title => loc('Break lock') 
-						};
-
-		}
-	} else {
-		$actions->{'Lock'} = { 
-						path  => "Ticket/Display.html?Lock=add&id=" . $Ticket->Id,
-						title => loc('Lock') 
-						};
-
-
-	}
-}
-
 </%INIT>
 
   

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/Forward.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/Forward.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/Forward.html	Mon Aug 20 10:32:18 2007
@@ -51,7 +51,7 @@
     Title  => $Title,
 &>
 
-<& /Elements/ShowLock, Ticket => $TicketObj, Unlock => 0 &>
+% $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSref => \%ARGS, Ticket => $TicketObj);
 <& /Elements/ListActions, actions => \@results &>
 
 <form action="Forward.html" name="ForwardMessage" method="post">

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/History.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/History.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/History.html	Mon Aug 20 10:32:18 2007
@@ -50,7 +50,8 @@
     Ticket => $Ticket, current_tab => 'Ticket/History.html?id='.$Ticket->id, 
     Title => loc("Ticket History # [_1] [_2]", $Ticket->Id, $Ticket->Subject) &>
 
-<& /Elements/ShowLock, Ticket => $Ticket, Unlock => 0 &>
+% $m->callback(CallbackName => 'BeforeActionList', ARGSref => \%ARGS, Ticket => $Ticket);
+
 
 <br />
       
@@ -74,7 +75,7 @@
 my $Ticket = LoadTicket ($id);
 
 unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
-	Abort("No permission to view ticket");
+    Abort("No permission to view ticket");
 }
 
 my $attachments = $m->comp('Elements/FindAttachments', Ticket => $Ticket);

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/Modify.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/Modify.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/Modify.html	Mon Aug 20 10:32:18 2007
@@ -50,7 +50,8 @@
     Ticket => $TicketObj, current_subtab => "Ticket/Modify.html?id=".$TicketObj->Id, 
     Title => loc('Modify ticket #[_1]', $TicketObj->Id) &>
 
-<& /Elements/ShowLock, Ticket => $TicketObj, Unlock => 0 &>
+% $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSref => \%ARGS, Ticket => $TicketObj);
+
 <& /Elements/ListActions, actions => \@results &>
 <form method="post" action="Modify.html" enctype="multipart/form-data">
 % $m->callback( CallbackName => 'FormStart', ARGSRef => \%ARGS );

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyAll.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyAll.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyAll.html	Mon Aug 20 10:32:18 2007
@@ -51,7 +51,7 @@
     current_tab => "Ticket/ModifyAll.html?id=".$Ticket->Id, 
     Title => loc("Ticket #[_1] Jumbo update: [_2]", $Ticket->Id, $Ticket->Subject) &>
 
-<& /Elements/ShowLock, Ticket => $Ticket, Unlock => 0 &>
+% $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSref => \%ARGS, Ticket => $Ticket);
 <& /Elements/ListActions, actions => \@results &>
 
 <form method="post" action="ModifyAll.html" enctype="multipart/form-data">

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyDates.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyDates.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyDates.html	Mon Aug 20 10:32:18 2007
@@ -51,7 +51,7 @@
     current_tab => "Ticket/ModifyDates.html?id=".$TicketObj->Id, 
     Title => loc('Modify dates for #[_1]', $TicketObj->Id) &> 
 
-<& /Elements/ShowLock, Ticket => $TicketObj, Unlock => 0 &>
+% $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSref => \%ARGS, Ticket => $TicketObj);
 <& /Elements/ListActions, actions => \@results &>
 
 <form method="post" action="ModifyDates.html">

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyLinks.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyLinks.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyLinks.html	Mon Aug 20 10:32:18 2007
@@ -51,7 +51,7 @@
     current_tab => "Ticket/ModifyLinks.html?id=".$Ticket->Id, 
     Title => loc("Link ticket #[_1]", $Ticket->Id) &>
 
-<& /Elements/ShowLock, Ticket => $Ticket, Unlock => 0 &>
+% $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSref => \%ARGS, Ticket => $Ticket);
 <& /Elements/ListActions, actions => \@results &>
 
 <form action="ModifyLinks.html" method="post">

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyPeople.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyPeople.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/ModifyPeople.html	Mon Aug 20 10:32:18 2007
@@ -51,7 +51,7 @@
     current_tab => "Ticket/ModifyPeople.html?id=".$Ticket->Id, 
     Title => loc('Modify people related to ticket #[_1]', $Ticket->id) &>
 
-<& /Elements/ShowLock, Ticket => $Ticket, Unlock => 0 &>
+% $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSref => \%ARGS, Ticket => $Ticket);
 <& /Elements/ListActions, actions => \@results &>
 
 <form method="post" action="ModifyPeople.html">

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/Reminders.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/Reminders.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/Reminders.html	Mon Aug 20 10:32:18 2007
@@ -51,7 +51,7 @@
     current_tab => "Ticket/Reminders.html?id=".$Ticket->Id, 
     Title => loc("Reminders for ticket #[_1]", $Ticket->Id) &>
     
-<& /Elements/ShowLock, Ticket => $Ticket, Unlock => 0 &>
+% $m->callback(CallbackName => 'BeforeActionList', ARGSref => \%ARGS, Ticket => $Ticket);
     
 <form action="<%RT->Config->Get('WebPath')%>/Ticket/Reminders.html" method="post">
 <&|/Widgets/TitleBox, title => loc("Reminders"),

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/Update.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/Update.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/Update.html	Mon Aug 20 10:32:18 2007
@@ -50,7 +50,7 @@
     Ticket => $TicketObj, 
     Title=> $title &>
     
-<& /Elements/ShowLock, Ticket => $TicketObj, Unlock => 0 &>
+% $m->callback(CallbackName => 'BeforeActionList', ARGSref => \%ARGS, Ticket => $TicketObj);
 
 <form action="Update.html" name="TicketUpdate"
     method="post" enctype="multipart/form-data">
@@ -150,7 +150,7 @@
 
 my $TicketObj = LoadTicket($id);
 
-$TicketObj->Lock();
+#$TicketObj->Lock();
 
 unless($DefaultStatus){
     $DefaultStatus=($ARGS{'Status'} ||$TicketObj->Status());
@@ -200,14 +200,14 @@
 # {{{ deal with deleting uploaded attachments
 foreach my $key (keys %ARGS) {
     if ($key =~ m/^DeleteAttach-(.+)$/) {
-	delete $session{'Attachments'}{$1};
+    delete $session{'Attachments'}{$1};
     }
     $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
 }
 # }}}
 
 # {{{ store the uploaded attachment in session
-if ($ARGS{'Attach'}) {			# attachment?
+if ($ARGS{'Attach'}) {            # attachment?
     $session{'Attachments'} = {} unless defined $session{'Attachments'};
 
     my $subject = "$ARGS{'Attach'}";
@@ -223,7 +223,7 @@
     );
 
     $session{'Attachments'} = { %{$session{'Attachments'} || {}},
-				$ARGS{'Attach'} => $attachment };
+                $ARGS{'Attach'} => $attachment };
 }
 # }}}
 
@@ -234,10 +234,7 @@
 # }}}
 
 if ( exists $ARGS{SubmitTicket} ) {
-	my $lock = $TicketObj->Locked();
-	my $Duration = time() - $lock->Content->{'Timestamp'} if $lock;
-	$TicketObj->Unlock();
-    $m->comp('Display.html', TicketObj => $TicketObj, Duration => $Duration, %ARGS);
+    $m->comp('Display.html', TicketObj => $TicketObj, %ARGS);
     return;
 }
 

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm	Mon Aug 20 10:32:18 2007
@@ -244,7 +244,16 @@
 In this template C<@Messages> array is available and contains list
 of error messages.
 
-=head1 FUNCTIONS
+=head1 FOR DEVELOPERS
+
+=head2 Documentation and references
+
+* RFC1847 - Security Multiparts for MIME: Multipart/Signed and Multipart/Encrypted.
+Describes generic MIME security framework, "mulitpart/signed" and "multipart/encrypted"
+MIME types.
+
+* RFC3156 - MIME Security with Pretty Good Privacy (PGP),
+updates RFC2015.
 
 =cut
 
@@ -380,12 +389,6 @@
         @_
     );
 
-    my $entity = $args{'Entity'};
-
-    if ( $args{'Sign'} && !defined $args{'Passphrase'} ) {
-        $args{'Passphrase'} = GetPassphrase( Address => $args{'Signer'} );
-    }
-
     my $gnupg = new GnuPG::Interface;
     my %opt = RT->Config->Get('GnuPGOptions');
     $opt{'digest-algo'} ||= 'SHA1';
@@ -397,6 +400,15 @@
         meta_interactive => 0,
     );
 
+    my $entity = $args{'Entity'};
+
+    # handling passphrase in GnupGOptions
+    $args{'Passphrase'} ||= delete $opt{'passphrase'};
+
+    if ( $args{'Sign'} && !defined $args{'Passphrase'} ) {
+        $args{'Passphrase'} = GetPassphrase( Address => $args{'Signer'} );
+    }
+
     my %res;
     if ( $args{'Sign'} && !$args{'Encrypt'} ) {
         # required by RFC3156(Ch. 5) and RFC1847(Ch. 2.1)
@@ -554,10 +566,6 @@
     );
     return unless $args{'Sign'} || $args{'Encrypt'};
 
-    if ( $args{'Sign'} && !defined $args{'Passphrase'} ) {
-        $args{'Passphrase'} = GetPassphrase( Address => $args{'Signer'} );
-    }
-
     my $gnupg = new GnuPG::Interface;
     my %opt = RT->Config->Get('GnuPGOptions');
     $opt{'digest-algo'} ||= 'SHA1';
@@ -569,6 +577,13 @@
         meta_interactive => 0,
     );
 
+    # handling passphrase in GnupGOptions
+    $args{'Passphrase'} ||= delete $opt{'passphrase'};
+
+    if ( $args{'Sign'} && !defined $args{'Passphrase'} ) {
+        $args{'Passphrase'} = GetPassphrase( Address => $args{'Signer'} );
+    }
+
     if ( $args{'Encrypt'} ) {
         $gnupg->options->push_recipients( $_ )
             foreach @{ $args{'Recipients'} || [] };
@@ -638,10 +653,6 @@
     );
     return unless $args{'Sign'} || $args{'Encrypt'};
 
-    if ( $args{'Sign'} && !defined $args{'Passphrase'} ) {
-        $args{'Passphrase'} = GetPassphrase( Address => $args{'Signer'} );
-    }
-
     my $gnupg = new GnuPG::Interface;
     my %opt = RT->Config->Get('GnuPGOptions');
     $opt{'digest-algo'} ||= 'SHA1';
@@ -653,6 +664,13 @@
         meta_interactive => 0,
     );
 
+    # handling passphrase in GnupGOptions
+    $args{'Passphrase'} ||= delete $opt{'passphrase'};
+
+    if ( $args{'Sign'} && !defined $args{'Passphrase'} ) {
+        $args{'Passphrase'} = GetPassphrase( Address => $args{'Signer'} );
+    }
+
     my $entity = $args{'Entity'};
     if ( $args{'Encrypt'} ) {
         $gnupg->options->push_recipients( $_ )
@@ -739,9 +757,9 @@
             my $type = $1? 'signed': 'encrypted';
             $RT::Logger->debug("Found $type inline part");
             return {
-                Type   => $type,
-                Format => 'Inline',
-                Data   => $entity,
+                Type    => $type,
+                Format  => 'Inline',
+                Data  => $entity,
             };
         }
         $io->close;
@@ -768,11 +786,11 @@
             }
             $RT::Logger->debug("Found encrypted according to RFC3156 part");
             return {
-                Type   => 'encrypted',
-                Format => 'RFC3156',
-                Top    => $entity,
-                Data   => $entity->parts(1),
-                Info   => $entity->parts(0),
+                Type    => 'encrypted',
+                Format  => 'RFC3156',
+                Top   => $entity,
+                Data  => $entity->parts(1),
+                Info    => $entity->parts(0),
             };
         } else {
             unless ( $protocol eq 'application/pgp-signature' ) {
@@ -783,58 +801,61 @@
             return {
                 Type      => 'signed',
                 Format    => 'RFC3156',
-                Top       => $entity,
-                Data      => $entity->parts(0),
+                Top     => $entity,
+                Data    => $entity->parts(0),
                 Signature => $entity->parts(1),
             };
         }
     }
 
     # attachments signed with signature in another part
-    my @file_signatures =
-        grep $_->head->recommended_filename,
-        grep $_->effective_type eq 'application/pgp-signature',
-        $entity->parts;
+    my @file_indices =
+        grep {$entity->parts($_)->head->recommended_filename}
+        grep {$entity->parts($_)->effective_type eq 'application/pgp-signature'}
+            0 .. $entity->parts - 1;
 
     my (@res, %skip);
-    foreach my $sig_part ( @file_signatures ) {
+    foreach my $i ( @file_indices ) {
+        my $sig_part = $entity->parts($i);
         $skip{"$sig_part"}++;
         my $sig_name = $sig_part->head->recommended_filename;
         my ($file_name) = $sig_name =~ /^(.*?)(?:.sig)?$/;
-        my ($data_part) =
-            grep $file_name eq ($_->head->recommended_filename||''),
-            grep $_ ne $sig_part,
-            $entity->parts;
-        unless ( $data_part ) {
+
+        my ($data_part_idx) =
+            grep $file_name eq ($entity->parts($_)->head->recommended_filename||''),
+            grep $sig_part  ne  $entity->parts($_),
+                0 .. $entity->parts - 1;
+        unless ( defined $data_part_idx ) {
             $RT::Logger->error("Found $sig_name attachment, but didn't find $file_name");
             next;
         }
+        my $data_part_in = $entity->parts($data_part_idx);
 
-        $skip{"$data_part"}++;
+        $skip{"$data_part_in"}++;
         $RT::Logger->debug("Found signature in attachment '$sig_name' of attachment '$file_name'");
         push @res, {
             Type      => 'signed',
             Format    => 'Attachment',
-            Top       => $entity,
-            Data      => $data_part,
+            Top     => $entity,
+            Data    => $data_part_in,
             Signature => $sig_part,
         };
     }
 
     # attachments with inline encryption
-    my @encrypted_files =
-        grep $_->head->recommended_filename
-            && $_->head->recommended_filename =~ /\.pgp$/,
-        $entity->parts;
+    my @encrypted_indices =
+        grep {($entity->parts($_)->head->recommended_filename || '') =~ /\.pgp$/}
+            0 .. $entity->parts - 1;
 
-    foreach my $part ( @encrypted_files ) {
+    foreach my $i ( @encrypted_indices ) {
+        my $part = $entity->parts($i);
         $skip{"$part"}++;
         $RT::Logger->debug("Found encrypted attachment '". $part->head->recommended_filename ."'");
         push @res, {
             Type      => 'encrypted',
             Format    => 'Attachment',
-            Top       => $entity,
-            Data      => $part,
+            Top     => $entity,
+            Data    => $part,
         };
     }
 
@@ -1006,6 +1027,14 @@
         meta_interactive => 0,
     );
 
+    if ( $args{'Data'}->bodyhandle->is_encoded ) {
+        require RT::EmailParser;
+        RT::EmailParser->_DecodeBody($args{'Data'});
+    }
+
+    # handling passphrase in GnupGOptions
+    $args{'Passphrase'} ||= delete $opt{'passphrase'};
+
     $args{'Passphrase'} = GetPassphrase()
         unless defined $args{'Passphrase'};
 
@@ -1047,11 +1076,9 @@
     }
 
     seek $tmp_fh, 0, 0;
-    my $parser = new MIME::Parser;
-    my $rt_parser = new RT::EmailParser;
-    $rt_parser->_SetupMIMEParser( $parser );
-    my $decrypted = $parser->parse( $tmp_fh );
-    $decrypted->{'__store_link_to_object_to_avoid_early_cleanup'} = $rt_parser;
+    my $parser = new RT::EmailParser;
+    my $decrypted = $parser->ParseMIMEEntityFromFileHandle( $tmp_fh, 0 );
+    $decrypted->{'__store_link_to_object_to_avoid_early_cleanup'} = $parser;
     $args{'Top'}->parts( [] );
     $args{'Top'}->add_part( $decrypted );
     $args{'Top'}->make_singlepart;
@@ -1073,6 +1100,14 @@
         meta_interactive => 0,
     );
 
+    if ( $args{'Data'}->bodyhandle->is_encoded ) {
+        require RT::EmailParser;
+        RT::EmailParser->_DecodeBody($args{'Data'});
+    }
+
+    # handling passphrase in GnupGOptions
+    $args{'Passphrase'} ||= delete $opt{'passphrase'};
+
     $args{'Passphrase'} = GetPassphrase()
         unless defined $args{'Passphrase'};
 

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Date.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Date.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Date.pm	Mon Aug 20 10:32:18 2007
@@ -778,11 +778,14 @@
     if ($tz eq 'UTC') {
         @local = gmtime($unix);
     } else {
-        local $ENV{'TZ'} = $tz;
-	## Using POSIX::tzset fixes a bug where the TZ environment variable
-	## is cached.
-	POSIX::tzset();
-        @local = localtime($unix);
+        {
+            local $ENV{'TZ'} = $tz;
+            ## Using POSIX::tzset fixes a bug where the TZ environment variable
+            ## is cached.
+            POSIX::tzset();
+            @local = localtime($unix);
+        }
+        POSIX::tzset(); # return back previouse value
     }
     $local[5] += 1900; # change year to 4+ digits format
     my $offset = Time::Local::timegm_nocheck(@local) - $unix;
@@ -814,14 +817,19 @@
         return timegm(@_[0..5]) - $_[9];
     } else {
         $tz = $self->Timezone( $tz );
-        if ($tz eq 'UTC') {
+        if ( $tz eq 'UTC' ) {
             return Time::Local::timegm(@_[0..5]);
         } else {
-            local $ENV{'TZ'} = $tz;
-	    ## Using POSIX::tzset fixes a bug where the TZ environment variable
-	    ## is cached.
-	    POSIX::tzset();
-            return Time::Local::timelocal(@_[0..5]);
+            my $rv;
+            {
+                local $ENV{'TZ'} = $tz;
+                ## Using POSIX::tzset fixes a bug where the TZ environment variable
+                ## is cached.
+                POSIX::tzset();
+                $rv = Time::Local::timelocal(@_[0..5]);
+            };
+            POSIX::tzset(); # switch back to previouse value
+            return $rv;
         }
     }
 }

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/EmailParser.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/EmailParser.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/EmailParser.pm	Mon Aug 20 10:32:18 2007
@@ -89,21 +89,18 @@
 }
 
 
-# {{{ sub SmartParseMIMEEntityFromScalar
+=head2 SmartParseMIMEEntityFromScalar Message => SCALAR_REF [, Decode => BOOL, Exact => BOOL ] }
 
-=head2 SmartParseMIMEEntityFromScalar { Message => SCALAR_REF, Decode => BOOL }
-
-Parse a message stored in a scalar from scalar_ref
+Parse a message stored in a scalar from scalar_ref.
 
 =cut
 
 sub SmartParseMIMEEntityFromScalar {
     my $self = shift;
-    my %args = ( Message => undef, Decode => 1, @_ );
+    my %args = ( Message => undef, Decode => 1, Exact => 0, @_ );
 
-    my ( $fh, $temp_file );
     eval {
-
+        my ( $fh, $temp_file );
         for ( 1 .. 10 ) {
 
             # on NFS and NTFS, it is possible that tempfile() conflicts
@@ -125,8 +122,9 @@
 
                 # We have to trust the temp file's name -- untaint it
                 $temp_file =~ /(.*)/;
-                $self->ParseMIMEEntityFromFile( $1, $args{'Decode'} );
+                my $entity = $self->ParseMIMEEntityFromFile( $1, $args{'Decode'}, $args{'Exact'} );
                 unlink($1);
+                return $entity;
             }
         }
     };
@@ -134,14 +132,11 @@
     #If for some reason we weren't able to parse the message using a temp file
     # try it with a scalar
     if ( $@ || !$self->Entity ) {
-        $self->ParseMIMEEntityFromScalar( $args{'Message'}, $args{'Decode'} );
+        return $self->ParseMIMEEntityFromScalar( $args{'Message'}, $args{'Decode'}, $args{'Exact'} );
     }
 
 }
 
-# }}}
-
-# {{{ sub ParseMIMEEntityFromSTDIN
 
 =head2 ParseMIMEEntityFromSTDIN
 
@@ -151,14 +146,9 @@
 
 sub ParseMIMEEntityFromSTDIN {
     my $self = shift;
-    my $postprocess = (@_ ? shift : 1);
-    return $self->ParseMIMEEntityFromFileHandle(\*STDIN, $postprocess);
+    return $self->ParseMIMEEntityFromFileHandle(\*STDIN, @_);
 }
 
-# }}}
-
-# {{{ ParseMIMEEntityFromScalar
-
 =head2 ParseMIMEEntityFromScalar  $message
 
 Takes either a scalar or a reference to a scalar which contains a stringified MIME message.
@@ -171,15 +161,9 @@
 
 sub ParseMIMEEntityFromScalar {
     my $self = shift;
-    my $message = shift;
-    my $postprocess = (@_ ? shift : 1);
-    $self->_ParseMIMEEntity($message,'parse_data', $postprocess);
+    return $self->_ParseMIMEEntity( shift, 'parse_data', @_ );
 }
 
-# }}}
-
-# {{{ ParseMIMEEntityFromFilehandle *FH
-
 =head2 ParseMIMEEntityFromFilehandle *FH
 
 Parses a mime entity from a filehandle passed in as an argument
@@ -188,15 +172,9 @@
 
 sub ParseMIMEEntityFromFileHandle {
     my $self = shift;
-    my $filehandle = shift;
-    my $postprocess = (@_ ? shift : 1);
-    $self->_ParseMIMEEntity($filehandle,'parse', $postprocess);
+    return $self->_ParseMIMEEntity( shift, 'parse', @_ );
 }
 
-# }}}
-
-# {{{ ParseMIMEEntityFromFile
-
 =head2 ParseMIMEEntityFromFile 
 
 Parses a mime entity from a filename passed in as an argument
@@ -205,24 +183,21 @@
 
 sub ParseMIMEEntityFromFile {
     my $self = shift;
-    my $file = shift;
-    my $postprocess = (@_ ? shift : 1);
-    $self->_ParseMIMEEntity($file,'parse_open',$postprocess);
+    return $self->_ParseMIMEEntity( shift, 'parse_open', @_ );
 }
 
-# }}}
 
-# {{{ _ParseMIMEEntity
 sub _ParseMIMEEntity {
     my $self = shift;
     my $message = shift;
     my $method = shift;
-    my $postprocess = shift;
-    # Create a new parser object:
+    my $postprocess = (@_ ? shift : 1);
+    my $exact = shift;
 
+    # Create a new parser object:
     my $parser = MIME::Parser->new();
     $self->_SetupMIMEParser($parser);
-
+    $parser->decode_bodies(0) if $exact;
 
     # TODO: XXX 3.0 we really need to wrap this in an eval { }
     unless ( $self->{'entity'} = $parser->$method($message) ) {
@@ -234,15 +209,54 @@
             return ( undef);
         }
     }
-    if ($postprocess) {
-    $self->_PostProcessNewEntity() ;
-    }
 
+    $self->_PostProcessNewEntity if $postprocess;
+
+    return $self->{'entity'};
+}
+
+sub _DecodeBodies {
+    my $self = shift;
+    return unless $self->{'entity'};
+    
+    my @parts = $self->{'entity'}->parts_DFS;
+    $self->_DecodeBody($_) foreach @parts;
 }
 
-# }}}
+sub _DecodeBody {
+    my $self = shift;
+    my $entity = shift;
+
+    my $old = $entity->bodyhandle or return;
+    return unless $old->is_encoded;
 
-# {{{ _PostProcessNewEntity 
+    require MIME::Decoder;
+    my $encoding = $entity->head->mime_encoding;
+    my $decoder = new MIME::Decoder $encoding;
+    unless ( $decoder ) {
+        $RT::Logger->error("Couldn't find decoder for '$encoding', switching to binary");
+        $old->is_encoded(0);
+        return;
+    }
+
+    require MIME::Body;
+    # XXX: use InCore for now, but later must switch to files
+    my $new = new MIME::Body::InCore;
+    $new->binmode(1);
+    $new->is_encoded(0);
+
+    my $source = $old->open('r') or die "couldn't open body: $!";
+    my $destination = $new->open('w') or die "couldn't open body: $!";
+    { 
+        local $@;
+        eval { $decoder->decode($source, $destination) };
+        $RT::Logger->error($@) if $@;
+    }
+    $source->close or die "can't close: $!";
+    $destination->close or die "can't close: $!";
+
+    $entity->bodyhandle( $new );
+}
 
 =head2 _PostProcessNewEntity
 
@@ -258,22 +272,12 @@
     # Unfold headers that are have embedded newlines
     #  Better do this before conversion or it will break
     #  with multiline encoded Subject (RFC2047) (fsck.com #5594)
-    
     $self->Head->unfold;
 
-
     # try to convert text parts into utf-8 charset
     RT::I18N::SetMIMEEntityToEncoding($self->{'entity'}, 'utf-8');
-
-
-
-
 }
 
-# }}}
-
-# {{{ ParseCcAddressesFromHead 
-
 =head2 ParseCcAddressesFromHead HASHREF
 
 Takes a hashref object containing QueueObj, Head and CurrentUser objects.
@@ -312,9 +316,7 @@
     return (@Addresses);
 }
 
-# }}}
 
-# {{{ ParseSenderAdddressFromHead
 
 =head2 ParseSenderAddressFromHead
 
@@ -333,9 +335,7 @@
     return ( $self->ParseAddressFromHeader($From) );
 }
 
-# }}}
 
-# {{{ ParseErrorsToAdddressFromHead
 
 =head2 ParseErrorsToAddressFromHead
 
@@ -362,9 +362,7 @@
     }
 }
 
-# }}}
 
-# {{{ ParseAddressFromHeader
 
 =head2 ParseAddressFromHeader ADDRESS
 
@@ -394,9 +392,7 @@
     return ( $Address, $Name );
 }
 
-# }}}
 
-# {{{ IsRTAddress
 
 =head2 IsRTaddress ADDRESS
 
@@ -420,10 +416,8 @@
     return undef;
 }
 
-# }}}
 
 
-# {{{ CullRTAddresses
 
 =head2 CullRTAddresses ARRAY
 
@@ -447,10 +441,8 @@
     return (@addrlist);
 }
 
-# }}}
 
 
-# {{{ LookupExternalUserInfo
 
 
 # LookupExternalUserInfo is a site-definable method for synchronizing
@@ -512,10 +504,6 @@
   return ($FoundInExternalDatabase, %params);
 }
 
-# }}}
-
-# {{{ Accessor methods for parsed email messages
-
 =head2 Head
 
 Return the parsed head from this message
@@ -538,9 +526,7 @@
     return $self->{'entity'};
 }
 
-# }}}
 
-# {{{ _SetupMIMEParser 
 
 =head2 _SetupMIMEParser $parser
 
@@ -588,7 +574,6 @@
 
 }
 
-# }}}
 
 sub DESTROY {
     my $self = shift;

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm	Mon Aug 20 10:32:18 2007
@@ -1003,7 +1003,11 @@
     }
 
     my $parser = RT::EmailParser->new();
-    $parser->SmartParseMIMEEntityFromScalar( Message => $args{'message'}, Decode => 0 );
+    $parser->SmartParseMIMEEntityFromScalar(
+        Message => $args{'message'},
+        Decode => 0,
+        Exact => 1,
+    );
 
     my $Message = $parser->Entity();
     unless ($Message) {
@@ -1055,6 +1059,7 @@
         }
     }
     @mail_plugins = grep !$skip_plugin{"$_"}, @mail_plugins;
+    $parser->_DecodeBodies;
     $parser->_PostProcessNewEntity;
 
     my $head = $Message->head;

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email/Auth/GnuPG.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email/Auth/GnuPG.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email/Auth/GnuPG.pm	Mon Aug 20 10:32:18 2007
@@ -65,10 +65,12 @@
 sub ApplyBeforeDecode { return 1 }
 
 use RT::Crypt::GnuPG;
+use RT::EmailParser ();
 
 sub GetCurrentUser {
     my %args = (
         Message       => undef,
+        RawMessageRef => undef,
         @_
     );
 
@@ -77,6 +79,7 @@
                X-RT-Incoming-Signature X-RT-Privacy);
 
     my $msg = $args{'Message'}->dup;
+
     my ($status, @res) = VerifyDecrypt( Entity => $args{'Message'} );
     if ( $status && !@res ) {
         $args{'Message'}->head->add(

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm	Mon Aug 20 10:32:18 2007
@@ -1130,15 +1130,15 @@
         Principal => $self->CurrentUser,
         @_
     );
-    unless ( defined $args{'Principal'} ) {
-        $RT::Logger->debug("Principal undefined in Queue::HasRight");
-
+    my $principal = delete $args{'Principal'};
+    unless ( $principal ) {
+        $RT::Logger->error("Principal undefined in Queue::HasRight");
+        return undef;
     }
-    return (
-        $args{'Principal'}->HasRight(
-            Object => $self->Id ? $self : $RT::System,
-            Right    => $args{'Right'}
-          )
+
+    return $principal->HasRight(
+        %args,
+        Object => ($self->Id ? $self : $RT::System),
     );
 }
 

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Record.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Record.pm	Mon Aug 20 10:32:18 2007
@@ -713,7 +713,7 @@
 
 sub _ClassAccessible {
     my $self = shift;
-    return $_TABLE_ATTR->{ref($self)};
+    return $_TABLE_ATTR->{ref($self) || $self};
 }
 
 =head2 _Accessible COLUMN ATTRIBUTE

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm	Mon Aug 20 10:32:18 2007
@@ -214,14 +214,65 @@
     unless ( $obj->id ) {
         my ($val, $msg) = $obj->Create( %args );
         die "$msg" unless $val;
+    } else {
+        my @fields = qw(CorrespondAddress CommentAddress);
+        foreach my $field ( @fields ) {
+            next unless exists $args{ $field };
+            
+            no warnings 'uninitialized';
+            my $method = 'Set'. $field;
+            my ($val, $msg) = $obj->$method( $args{ $field } )
+                unless $args{ $field } eq $obj->$field;
+            die "$msg" unless $val;
+        }
     }
 
     return $obj;
 }
 
+sub store_rights {
+    my $self = shift;
+
+    require RT::ACE;
+    # fake construction
+    RT::ACE->new( $RT::SystemUser );
+    my @fields = keys %{ RT::ACE->_ClassAccessible };
+
+    require RT::ACL;
+    my $acl = RT::ACL->new( $RT::SystemUser );
+    $acl->Limit( FIELD => 'RightName', OPERATOR => '!=', VALUE => 'SuperUser' );
+
+    my @res;
+    while ( my $ace = $acl->Next ) {
+        my $obj = $ace->PrincipalObj->Object;
+        if ( $obj->isa('RT::Group') && $obj->Type eq 'UserEquiv' && $obj->Instance == $RT::Nobody->id ) {
+            next;
+        }
+
+        my %tmp = ();
+        foreach my $field( @fields ) {
+            $tmp{ $field } = $ace->__Value( $field );
+        }
+        push @res, \%tmp;
+    }
+    return @res;
+}
+
+sub restore_rights {
+    my $self = shift;
+    my @entries = @_;
+    foreach my $entry ( @entries ) {
+        my $ace = RT::ACE->new( $RT::SystemUser );
+        my ($status, $msg) = $ace->RT::Record::Create( %$entry );
+        unless ( $status ) {
+            diag "couldn't create a record: $msg";
+        }
+    }
+}
+
 sub set_rights {
     my $self = shift;
-    my @list = ref $_[0]? @_: { @_ };
+    my @list = ref $_[0]? @_: @_? { @_ }: ();
 
     require RT::ACL;
     my $acl = RT::ACL->new( $RT::SystemUser );

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm	Mon Aug 20 10:32:18 2007
@@ -81,7 +81,6 @@
 use RT::URI::fsck_com_rt;
 use RT::URI;
 use MIME::Entity;
-use RT::TicketLocking;
 
 
 # {{{ LINKTYPEMAP

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm	Mon Aug 20 10:32:18 2007
@@ -1621,40 +1621,6 @@
 }
 
 
-
-sub GetLocks {
-    my $self = shift;
-    
-    my $attribs = RT::Attributes->new($self);
-    $attribs->Limit(FIELD => 'Creator', OPERATOR=> '=', VALUE => $self->id(), ENTRYAGGREGATOR => 'AND');
-    
-    my $expiry = RT->Config->Get('LockExpiry');
-    return $attribs->Named('RT_Lock') unless $expiry;
-    my @locks;
-    
-    foreach my $lock ($attribs->Named('RT_Lock')) {
-        my $duration = time() - $lock->Content->{'Timestamp'};
-        if($duration < $expiry) {
-            push @locks, $lock;
-        }
-        else {
-            $lock->Delete();
-        }
-    }
-    return @locks;
-}
-
-sub RemoveLocks {
-    my $self = shift;
-    
-    my $attribs = RT::Attributes->new($self);
-    $attribs->Limit(FIELD => 'Creator', OPERATOR=> '=', VALUE => $self->id(), ENTRYAGGREGATOR => 'AND');
-    my @attributes = $attribs->Named('RT_Lock');
-    foreach my $lock (@attributes) {
-        $lock->Delete();
-    }
-}
-
 1;
 
 

Added: rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/pubring.gpg
==============================================================================
Binary file. No diff available.

Added: rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/random_seed
==============================================================================
Binary file. No diff available.

Added: rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/rt-recipient-pubkey
==============================================================================
--- (empty file)
+++ rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/rt-recipient-pubkey	Mon Aug 20 10:32:18 2007
@@ -0,0 +1,30 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+mQGiBEa8u6QRBADCqPh8w3cO51hPVb1Sttqq5UhCeB5t2dAL8aVEDkpPfV7LItDi
+pN4VqHo2zbGE8q2bCoqW06Ogn0R4xsxEeD9Jq9/k3dHReFL2gbA5F/el1PKXVxG8
+62BnjLkDub8yCdWsg0QDJ6ah7LC7vukTMlJj+3HhoXWEqBrTBKjtFkNIrwCg/LtU
+CEyj+z/cl6NQGZUw2A6+5DUD/2DfcLeSir7xrlcidqO4BxtxdWkEBDAnmARKrqaw
+zSATIK11+HO3Gteovfa08J1XXU2+IFqi2Ssyaqss1kteJE8DmOAcllSXqmCfOmPm
+xoW4gXOQfEv6tkTvF9JST1OZRj5w+ecyxn0282XrzKcxNeLjc+JcLfzPmmuhw4lA
+s/nJA/4tBqT0V7QiwaznBo8Bh7N3sz75x0vgSdZLUA0e2VzHKh9mAfK/FeVS1mcJ
+04iHWvxOGMqEfXnpxUrogME7f/TWNBVfT4M2JW0sHLvaiJhTtIhn+Q67awQ1f0qG
+mGQLIo9OAWZnIfBZ8e2tBwJ3ajiSZ2LIPWFv4Q1hKxOclODpf7QmUlQgVXNlciBC
+b2IgPHJ0LXJlY2lwaWVudEBleGFtcGxlLmNvbT6IYAQTEQIAIAUCRry7pAIbAwYL
+CQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEM4wxB7CJ0omPPUAoL3A7jiEZX6xSyXE
+duAtnmMplqHrAKDB8mrNols8/ni0VOv0QletwEwbVrkCDQRGvLuvEAgA/qDyDeDP
+FrDhh757tpgvJp2CmIx8fyv+i9nLEBVCZjtkLqgrcvtNh8l+xu3y8vjGB6+ToPvG
+ZE3FRxyLWNPGIlq1pQSREC9faEDWDrN7yA8miaikLIlfMnGwwzb5bEXWsmXzctTv
+DgxTCufDj8T66TKv+cCqc9T956XY6q49Z/p6yZDiY7LZ0N6GkHSoT8o6ZCOvl87n
+IjwKR8AXDWBxL5+SeenNkZ8e30pSVDJTOe4u6W/MKK3RBD0FKYr+DOMh5BQtE7yT
+QEhzmDTPfGe9m52FV8FbSLpimMnIFM2hGRf6jynoR10s0tk2DVADXDycwNYarRYG
+AxV6XafLCPDv4wADBQgAtpM7zhVch/NsL56aIG0QZmSaKCdk6UPsJua91eLEHJFo
+zOzethsAWED5KHD5ThsYBKPGq+mFz7QQtw8/DBmcajtBxMv2fvVOE7SrWfeHyMVl
+RgidJc3O6HlPPnA/v8lQhsYTxpUddYqB4lC0ktpncxCzX/VNr62YkmrpJx2Yvyd0
+L/lK5fiko65gQC1v/XQ/QI9kpGbOFXFnEgQXmFcDTX4kzTgpJ3cOBrM9GAO/hcwH
+82eC0j8fYw8mLYR8yQG0jsXJKCvHxTgkOh0nSkLaeLoq1maLp+NbJKCqgpsmeV4n
+QmEJE4Ye7I/L077BtJLv1tk0G0Jh3F2WeSzEvB7cS4hJBBgRAgAJBQJGvLuvAhsM
+AAoJEM4wxB7CJ0om/FcAn2tCGofP7IPmw6VxGBZNPHal4sIBAJ9UCgpOaGtX2fRl
++vvcvfcuIys27g==
+=mo7N
+-----END PGP PUBLIC KEY BLOCK-----

Added: rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/rt-recipient-seckey
==============================================================================
--- (empty file)
+++ rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/rt-recipient-seckey	Mon Aug 20 10:32:18 2007
@@ -0,0 +1,33 @@
+-----BEGIN PGP PRIVATE KEY BLOCK-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+lQHhBEa8u6QRBADCqPh8w3cO51hPVb1Sttqq5UhCeB5t2dAL8aVEDkpPfV7LItDi
+pN4VqHo2zbGE8q2bCoqW06Ogn0R4xsxEeD9Jq9/k3dHReFL2gbA5F/el1PKXVxG8
+62BnjLkDub8yCdWsg0QDJ6ah7LC7vukTMlJj+3HhoXWEqBrTBKjtFkNIrwCg/LtU
+CEyj+z/cl6NQGZUw2A6+5DUD/2DfcLeSir7xrlcidqO4BxtxdWkEBDAnmARKrqaw
+zSATIK11+HO3Gteovfa08J1XXU2+IFqi2Ssyaqss1kteJE8DmOAcllSXqmCfOmPm
+xoW4gXOQfEv6tkTvF9JST1OZRj5w+ecyxn0282XrzKcxNeLjc+JcLfzPmmuhw4lA
+s/nJA/4tBqT0V7QiwaznBo8Bh7N3sz75x0vgSdZLUA0e2VzHKh9mAfK/FeVS1mcJ
+04iHWvxOGMqEfXnpxUrogME7f/TWNBVfT4M2JW0sHLvaiJhTtIhn+Q67awQ1f0qG
+mGQLIo9OAWZnIfBZ8e2tBwJ3ajiSZ2LIPWFv4Q1hKxOclODpf/4DAwJ/4q65iEWy
+X2DlmaSnaPSxETwhVUmohSmvw0QgjAuO74pubcYoOJSlG40VAvEV5uDZ/1N+ETKF
+vGA7pbQmUlQgVXNlciBCb2IgPHJ0LXJlY2lwaWVudEBleGFtcGxlLmNvbT6IYAQT
+EQIAIAUCRry7pAIbAwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEM4wxB7CJ0om
+PPUAoL3A7jiEZX6xSyXEduAtnmMplqHrAKDB8mrNols8/ni0VOv0QletwEwbVp0C
+YwRGvLuvEAgA/qDyDeDPFrDhh757tpgvJp2CmIx8fyv+i9nLEBVCZjtkLqgrcvtN
+h8l+xu3y8vjGB6+ToPvGZE3FRxyLWNPGIlq1pQSREC9faEDWDrN7yA8miaikLIlf
+MnGwwzb5bEXWsmXzctTvDgxTCufDj8T66TKv+cCqc9T956XY6q49Z/p6yZDiY7LZ
+0N6GkHSoT8o6ZCOvl87nIjwKR8AXDWBxL5+SeenNkZ8e30pSVDJTOe4u6W/MKK3R
+BD0FKYr+DOMh5BQtE7yTQEhzmDTPfGe9m52FV8FbSLpimMnIFM2hGRf6jynoR10s
+0tk2DVADXDycwNYarRYGAxV6XafLCPDv4wADBQgAtpM7zhVch/NsL56aIG0QZmSa
+KCdk6UPsJua91eLEHJFozOzethsAWED5KHD5ThsYBKPGq+mFz7QQtw8/DBmcajtB
+xMv2fvVOE7SrWfeHyMVlRgidJc3O6HlPPnA/v8lQhsYTxpUddYqB4lC0ktpncxCz
+X/VNr62YkmrpJx2Yvyd0L/lK5fiko65gQC1v/XQ/QI9kpGbOFXFnEgQXmFcDTX4k
+zTgpJ3cOBrM9GAO/hcwH82eC0j8fYw8mLYR8yQG0jsXJKCvHxTgkOh0nSkLaeLoq
+1maLp+NbJKCqgpsmeV4nQmEJE4Ye7I/L077BtJLv1tk0G0Jh3F2WeSzEvB7cS/4D
+AwJ/4q65iEWyX2B15z6eV0Vw8MuO/oRc81B5Orke+eBvEizPAx8Jl8UdqE0hXuSI
+goDtq3s6ID+S4yW0a3ruFS7dsCPEmZllugKxqG3PXuZH4EvHiEkEGBECAAkFAka8
+u68CGwwACgkQzjDEHsInSib8VwCeLdgy5axSbYZ8Ez42Kcj8Ku2Q4ZUAnjJ92jFc
+fC7XWcM/6AX5IyU0jtEW
+=amxm
+-----END PGP PRIVATE KEY BLOCK-----

Added: rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/rt-test-pubkey
==============================================================================
--- (empty file)
+++ rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/rt-test-pubkey	Mon Aug 20 10:32:18 2007
@@ -0,0 +1,30 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+mQGiBEa4o04RBADc+2sFcnuTTaqcKRTmSBQKdXvumT4GoATk194UYMghwprrNb1/
+flXQRk9zLkc0YENFHLMoRUmXKEF+WFxzXrZgHJS096tGn+Ud2FXQbSL47Vl3EHng
+c+jSvvVaZRcEySaCyQrsDR7gWlQtCbxbe96Y2x9jX3Zbih9UYnRvWBeczwCg4tgz
+EOmScnWiwUdyZNQsvXDqvKUD/REf0WjWDaykQvXYZ0aTpc/WMBsDS16nl8GNz5eD
+lCB/JJHKh5QDu89p0557AbVDSi5LCOYAM+v4oi8k5zgiO/7HJptirDkZ27Ichyes
+kzhu3Xr9rPLawie/o4FCfncNLbOAEE4EjEGDGRlyowAaXlW7DWT+TLbxY0qL0uHy
+AQPGA/9AmYHBJQqHTfQ4/QXdCnp+UwYs+rhPh7YHymBLn8Saa14heE9SZcYfSerL
+FAE7KKeBx96+RplgsiaqfWrliUwrV3KnnJICMyqWmn2OyMYiV9iFWqAHFTCsitS2
+q1COv5/Lg1a+XkAwEfoIuLrAXT8buIxXs/BhLc1PD1t9My8srbQdUlQgVGVzdCA8
+cnQtdGVzdEBleGFtcGxlLmNvbT6IYAQTEQIAIAUCRrijTgIbAwYLCQgHAwIEFQII
+AwQWAgMBAh4BAheAAAoJENMoA12EiB8bMZoAoIxLNWQ9d9+W4ImPMpUmjLl9ttxW
+AJ9ELlhkfdhPukRe508p5fZqKUfl/rkCDQRGuKNhEAgAjSKFedFcU9RjLmSEGo7E
+4qMQWOtiNooW4NtRsKC2cbJXnGJUOT+GBzGCxjBZt89T6MVsOy7DoAzs+xWKA5Cf
+gFEX5xZWM1c6EA4f7LhC1hawtGQkMQIyHzEy9b7NPEcMlkdOebjjhZ4Ob8svGily
+Q9jN6zpR2c36i0sLaZ5gORIHJ9DOX1k5lUzEhkogEYoYof48VQwHt/5xUURli2kL
+Daqi+X2+6j/vNp96EQ3sbFifmNejWNaDyyrlyGUvx9g/Eh5wMRospmFA/oE1kSws
+tKiBxAPs11OJGBRre2Q6QVW2ULAhxZOFgkCq0DNb8TMnhJOY4jhOP57rrvpMyu9q
+4wADBQgAhRl4aiej9lX+YpZUcyhBkqIB/cDwYemmtIWzo6mVWuDuVcyLl//sJsBi
+pwJF6O5nr0ZC5CT+GRgjBmh9rQjv/UtWBldJ7og/HfuSMG6xIfljO2FxKjabDhGa
+iKzgTk75LnPqfx0FeRNbN78dPy4hV/iIvHPANuyUlmbBsx9hSGqMc78FIDwwfZtB
+im5XUJbpHsahu4/8agQLBu+PFK+5CIVWskrYVL1R66nPHCzsfYcOv+1CYCsuFldG
+tFNPCegGxE7T7CFs7m7aYeSdgycNaR9wuBZeV17JnOJ2z/mtsR+8p4vZZzSMcTkj
+f1j7UCgiKS/ioTD03pU/OZEy9+l1SYhJBBgRAgAJBQJGuKNhAhsMAAoJENMoA12E
+iB8bOvUAoMk0zxF0u3F+YCS8E/iw148OlM3aAJsFIzQgdNfF+muuRJ2jwT0Z7D+D
+eQ==
+=/oO5
+-----END PGP PUBLIC KEY BLOCK-----

Added: rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/rt-test-seckey
==============================================================================
--- (empty file)
+++ rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/rt-test-seckey	Mon Aug 20 10:32:18 2007
@@ -0,0 +1,33 @@
+-----BEGIN PGP PRIVATE KEY BLOCK-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+lQHhBEa4o04RBADc+2sFcnuTTaqcKRTmSBQKdXvumT4GoATk194UYMghwprrNb1/
+flXQRk9zLkc0YENFHLMoRUmXKEF+WFxzXrZgHJS096tGn+Ud2FXQbSL47Vl3EHng
+c+jSvvVaZRcEySaCyQrsDR7gWlQtCbxbe96Y2x9jX3Zbih9UYnRvWBeczwCg4tgz
+EOmScnWiwUdyZNQsvXDqvKUD/REf0WjWDaykQvXYZ0aTpc/WMBsDS16nl8GNz5eD
+lCB/JJHKh5QDu89p0557AbVDSi5LCOYAM+v4oi8k5zgiO/7HJptirDkZ27Ichyes
+kzhu3Xr9rPLawie/o4FCfncNLbOAEE4EjEGDGRlyowAaXlW7DWT+TLbxY0qL0uHy
+AQPGA/9AmYHBJQqHTfQ4/QXdCnp+UwYs+rhPh7YHymBLn8Saa14heE9SZcYfSerL
+FAE7KKeBx96+RplgsiaqfWrliUwrV3KnnJICMyqWmn2OyMYiV9iFWqAHFTCsitS2
+q1COv5/Lg1a+XkAwEfoIuLrAXT8buIxXs/BhLc1PD1t9My8srf4DAwJIR2mPIH/N
+xWBOMLt+5uTcnyrpjOz9iaruDr+sKyp5ZgGnAAexsQDJEhZaPNz6P9s5uunLFBnW
+VXdV0rQdUlQgVGVzdCA8cnQtdGVzdEBleGFtcGxlLmNvbT6IYAQTEQIAIAUCRrij
+TgIbAwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJENMoA12EiB8bMZoAoIxLNWQ9
+d9+W4ImPMpUmjLl9ttxWAJ9ELlhkfdhPukRe508p5fZqKUfl/p0CYwRGuKNhEAgA
+jSKFedFcU9RjLmSEGo7E4qMQWOtiNooW4NtRsKC2cbJXnGJUOT+GBzGCxjBZt89T
+6MVsOy7DoAzs+xWKA5CfgFEX5xZWM1c6EA4f7LhC1hawtGQkMQIyHzEy9b7NPEcM
+lkdOebjjhZ4Ob8svGilyQ9jN6zpR2c36i0sLaZ5gORIHJ9DOX1k5lUzEhkogEYoY
+of48VQwHt/5xUURli2kLDaqi+X2+6j/vNp96EQ3sbFifmNejWNaDyyrlyGUvx9g/
+Eh5wMRospmFA/oE1kSwstKiBxAPs11OJGBRre2Q6QVW2ULAhxZOFgkCq0DNb8TMn
+hJOY4jhOP57rrvpMyu9q4wADBQgAhRl4aiej9lX+YpZUcyhBkqIB/cDwYemmtIWz
+o6mVWuDuVcyLl//sJsBipwJF6O5nr0ZC5CT+GRgjBmh9rQjv/UtWBldJ7og/HfuS
+MG6xIfljO2FxKjabDhGaiKzgTk75LnPqfx0FeRNbN78dPy4hV/iIvHPANuyUlmbB
+sx9hSGqMc78FIDwwfZtBim5XUJbpHsahu4/8agQLBu+PFK+5CIVWskrYVL1R66nP
+HCzsfYcOv+1CYCsuFldGtFNPCegGxE7T7CFs7m7aYeSdgycNaR9wuBZeV17JnOJ2
+z/mtsR+8p4vZZzSMcTkjf1j7UCgiKS/ioTD03pU/OZEy9+l1Sf4DAwJIR2mPIH/N
+xWCn2mmj5zcBKW1T3vExBs/kd1VbXAE+UBJuMH9OehGPda8A/+BhUYi3Ws8E0Hsk
+XawE04ojXMbCXrUr/VwMef67s7wpmLl5wBNCiEkEGBECAAkFAka4o2ECGwwACgkQ
+0ygDXYSIHxs69QCgxvFIuPg6xpgRDUXE5+xc9GZI9VYAn3U+8U7AuSGybzySM8Ah
+zyjKaN3s
+=CIhz
+-----END PGP PRIVATE KEY BLOCK-----

Added: rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/secring.gpg
==============================================================================
Binary file. No diff available.

Added: rt/branches/3.7-EXPERIMENTAL/lib/t/data/crypt-gnupg-2/trustdb.gpg
==============================================================================
Binary file. No diff available.

Modified: rt/branches/3.7-EXPERIMENTAL/lib/t/data/mail/16-signed-encrypted-inline-plain.txt
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/t/data/mail/16-signed-encrypted-inline-plain.txt	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/t/data/mail/16-signed-encrypted-inline-plain.txt	Mon Aug 20 10:32:18 2007
@@ -1,13 +1,3 @@
-*** ENVELOPE RECORDS 98F6C37F69 ***
-message_size:            1571             219               1               0
-message_arrival_time: Fri Aug 10 16:17:42 2007
-create_time: Fri Aug 10 16:17:42 2007
-named_attribute: rewrite_context=local
-sender_fullname: Christian Ternus
-sender: ternus at mit.edu
-original_recipient: rt-recipient at example.com
-recipient: rt-recipient at example.com
-*** MESSAGE CONTENTS 98F6C37F69 ***
 Received: by anduril (Postfix, from userid 1000)
 	id 98F6C37F69; Fri, 10 Aug 2007 16:17:42 -0400 (EDT)
 Date: Fri, 10 Aug 2007 16:17:42 -0400
@@ -41,5 +31,3 @@
 aXWFWq9JVxX/JFOmWJV38fw+EhNgApncTw==
 =J8xa
 -----END PGP MESSAGE-----
-*** HEADER EXTRACTED 98F6C37F69 ***
-*** MESSAGE FILE END 98F6C37F69 ***

Modified: rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-incoming.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-incoming.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-incoming.t	Mon Aug 20 10:32:18 2007
@@ -15,7 +15,8 @@
                  OutgoingMessagesFormat => 'RFC' );
 
 RT->Config->Set( 'GnuPGOptions',
-                 homedir => $homedir );
+                 homedir => $homedir,
+                 'no-permission-warning' => undef);
 
 RT->Config->Set( 'MailPlugins' => 'Auth::MailFrom', 'Auth::GnuPG' );
 

Modified: rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t	Mon Aug 20 10:32:18 2007
@@ -1,15 +1,15 @@
 #!/usr/bin/perl
 use strict;
 use warnings;
-use Test::More tests => 158;
+use Test::More tests => 176;
 use File::Temp;
 use RT::Test;
 use Cwd 'getcwd';
 use String::ShellQuote 'shell_quote';
 use IPC::Run3 'run3';
-use Digest::MD5 qw(md5_base64);
+use Digest::MD5 qw(md5_hex);
 
-my $homedir = File::Spec->catdir( getcwd(), qw(lib t data crypt-gnupg-realmail) );
+my $homedir = File::Spec->catdir( getcwd(), qw(lib t data crypt-gnupg-2) );
 
 RT->Config->Set( LogToScreen => 'debug' );
 RT->Config->Set( 'GnuPG',
@@ -18,7 +18,8 @@
 
 RT->Config->Set( 'GnuPGOptions',
                  homedir => $homedir,
-                 passphrase => 'rt-test');
+                 passphrase => 'rt-test',
+                 'no-permission-warning' => undef);
 
 RT->Config->Set( 'MailPlugins' => 'Auth::MailFrom', 'Auth::GnuPG' );
 
@@ -43,7 +44,7 @@
     for my $format (qw/MIME inline/) {
         for my $attachment (qw/plain text-attachment binary-attachment/) {
             ++$eid;
-            diag "Email $eid: $usage, $attachment email with $format key" if $ENV{TEST_VERBOSE};
+            diag "Email $eid: $usage, $attachment email with $format format" if $ENV{TEST_VERBOSE};
             eval { email_ok($eid, $usage, $format, $attachment) };
         }
     }
@@ -67,17 +68,22 @@
 
 sub email_ok {
     my ($eid, $usage, $format, $attachment) = @_;
+    diag "email_ok $eid: $usage, $format, $attachment" if $ENV{'TEST_VERBOSE'};
 
     my $mail = get_contents($eid)
         or return 0;
 
     my ($status, $id) = RT::Test->send_via_mailgate($mail);
-    is ($status >> 8, 0, "The mail gateway exited normally");
+    is ($status >> 8, 0, "$eid: The mail gateway exited normally");
+    ok ($id, "$eid: got id of a newly created ticket - $id");
 
-    my $tick = get_latest_ticket_ok();
-    is( $tick->Subject,
+    my $tick = RT::Ticket->new( $RT::SystemUser );
+    $tick->Load( $id );
+    ok ($tick->id, "$eid: loaded ticket #$id");
+
+    is ($tick->Subject,
         "Test Email ID:$eid",
-        "Created the ticket"
+        "$eid: Created the ticket"
     );
 
     my $txn = $tick->Transactions->First;
@@ -86,40 +92,40 @@
     if ($usage =~ /encrypted/) {
         is( $msg->GetHeader('X-RT-Incoming-Encryption'),
             'Success',
-            'recorded incoming mail that is encrypted'
+            "$eid: recorded incoming mail that is encrypted"
         );
         is( $msg->GetHeader('X-RT-Privacy'),
             'PGP',
-            'recorded incoming mail that is encrypted'
+            "$eid: recorded incoming mail that is encrypted"
         );
 
         #XXX: maybe RT will have already decrypted this for us
         unlike( $msg->Content,
                 ($body{$eid} || qr/ID:$eid/),
-                'incoming mail did NOT have original body'
+                "$eid: incoming mail did NOT have original body"
         );
     }
     else {
         is( $msg->GetHeader('X-RT-Incoming-Encryption'),
             'Not encrypted',
-            'recorded incoming mail that is not encrypted'
+            "$eid: recorded incoming mail that is not encrypted"
         );
         like( $msg->Content || $attachments[0]->Content,
               ($body{$eid} || qr/ID:$eid/),
-              'got original content'
+              "$eid: got original content"
         );
     }
 
     if ($usage =~ /signed/) {
         is( $msg->GetHeader('X-RT-Incoming-Signature'),
             'RT Test <rt-test at example.com>',
-            'recorded incoming mail that is signed'
+            "$eid: recorded incoming mail that is signed"
         );
     }
     else {
         is( $msg->GetHeader('X-RT-Incoming-Signature'),
             undef,
-            'recorded incoming mail that is not signed'
+            "$eid: recorded incoming mail that is not signed"
         );
     }
 
@@ -127,21 +133,21 @@
         # signed messages should sign each attachment too
         if ($usage =~ /signed/) {
             my $sig = pop @attachments;
-            ok ($sig->Id, 'loaded attachment.sig object');
+            ok ($sig->Id, "$eid: loaded attachment.sig object");
             my $acontent = $sig->Content;
         }
 
-        my $a = pop @attachments;
-        my $file = '';
-        ok ($a->Id, 'loaded attachment object');
+        my ($a) = grep $_->Filename, @attachments;
+        ok ($a && $a->Id, "$eid: found attachment with filename");
+
         my $acontent = $a->Content;
         if ($attachment =~ /binary/)
         {
-            is(md5_base64($acontent), '', "The binary attachment's md5sum matches");
+            is(md5_hex($acontent), '1e35f1aa90c98ca2bab85c26ae3e1ba7', "$eid: The binary attachment's md5sum matches");
         }
         else
         {
-            like($acontent, qr/zanzibar/, 'The attachment isn\'t screwed up in the database.');
+            like($acontent, qr/zanzibar/, "$eid: The attachment isn't screwed up in the database.");
         }
 
     }
@@ -149,12 +155,3 @@
     return 0;
 }
 
-sub get_latest_ticket_ok {
-    my $tickets = RT::Tickets->new($RT::SystemUser);
-    $tickets->OrderBy( FIELD => 'id', ORDER => 'DESC' );
-    $tickets->Limit( FIELD => 'id', OPERATOR => '>', VALUE => '0' );
-    my $tick = $tickets->First();
-    ok( $tick->Id, "found ticket " . $tick->Id );
-    return $tick;
-}
-


More information about the Rt-commit mailing list