[Rt-commit] rt branch, 4.0/outlook-quote-folding, updated. rt-4.0.2-181-g5771f77

Thomas Sibley trs at bestpractical.com
Thu Oct 13 18:13:50 EDT 2011


The branch, 4.0/outlook-quote-folding has been updated
       via  5771f7722b1a1287a4e6050f83cf0dedd7c42a7e (commit)
      from  178433c674c8f02c5c7f6f2db6002de4dc8a1897 (commit)

Summary of changes:
 share/html/Ticket/Elements/ShowMessageStanza |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 5771f7722b1a1287a4e6050f83cf0dedd7c42a7e
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Oct 13 17:49:21 2011 -0400

    Split apart stanzas with an Outlook "Original Message" boundary in the middle
    
    Mail like the real world sample below (from a Blackberry mail client)
    are now split into two stanzas at the original message boundary.
    
        Woo!  Thanks!
        ------Original Message------
        From: Alex Vandiver via RT
        ...
    
    Before this commit, any lines in the same stanza but preceding the
    boundary ("Woo!  Thanks!") were folded away, potentially hiding part of
    a new response.

diff --git a/share/html/Ticket/Elements/ShowMessageStanza b/share/html/Ticket/Elements/ShowMessageStanza
index be68ede..2188912 100755
--- a/share/html/Ticket/Elements/ShowMessageStanza
+++ b/share/html/Ticket/Elements/ShowMessageStanza
@@ -111,9 +111,28 @@ AGAIN: foreach ( ; $i < @$Message; $i++ ) {
                                         \s*$            # optional whitespace until the end of the line
                                        /xm )
             {
-                $stanza->{_outlooked}++;
-                # Nest the current stanza and everything that follows
-                $stanza = $Message->[ $i ] = [ splice @$Message, $i ];
+                # There's content before the quoted message, but in the
+                # same stanza.  Break it out!
+                if ( my $start = $-[0] ) {
+                    my %preceding = %$stanza;
+
+                    # We don't process $stanza->{text} because we don't use it
+                    # and it isn't given to us by HTML::Quoted.  If we ever
+                    # need to, we can process it the same way as 'raw'.
+                    $preceding{raw} = substr($stanza->{raw}, 0, $start, '');
+
+                    # Replace the current stanza with the two we just created
+                    splice @$Message, $i, 1, \%preceding, $stanza;
+
+                    # Try it again from the top now that we've rejiggered our
+                    # stanzas.  We'll process the Outlook stanza again, and hit
+                    # the else below this time.
+                    redo;
+                } else {
+                    # Nest the current stanza and everything that follows
+                    $stanza->{_outlooked}++;
+                    $stanza = $Message->[ $i ] = [ splice @$Message, $i ];
+                }
             }
             else {
                 $para .= ( defined $stanza->{raw} ? $stanza->{raw} : '' )."\n";

-----------------------------------------------------------------------


More information about the Rt-commit mailing list