[Rt-commit] rt branch, 4.0/outlook-quote-folding, created. rt-4.0.2-180-g178433c

Thomas Sibley trs at bestpractical.com
Tue Oct 4 15:15:58 EDT 2011


The branch, 4.0/outlook-quote-folding has been created
        at  178433c674c8f02c5c7f6f2db6002de4dc8a1897 (commit)

- Log -----------------------------------------------------------------
commit f35c8968372fa58f028ed5c5b1ee2cf33244547a
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Oct 4 14:29:50 2011 -0400

    Detect more variations on the Outlook "Original Message" quoting style
    
    All of these versions, and more, are supported now:
    
    -----Original Message-----
    ----Originalnachright ----
    ____________
    
    Outlook seems to change which style of "quoting" it uses from version to
    version and language to language.

diff --git a/share/html/Ticket/Elements/ShowMessageStanza b/share/html/Ticket/Elements/ShowMessageStanza
index 221ab86..6b2e41f 100755
--- a/share/html/Ticket/Elements/ShowMessageStanza
+++ b/share/html/Ticket/Elements/ShowMessageStanza
@@ -94,8 +94,21 @@ if ( ref $Message ) {
 AGAIN: foreach ( ; $i < @$Message; $i++ ) {
         my $stanza = $Message->[$i];
         if ( ref $stanza eq "HASH" ) {
-            if (    $stanza->{raw}
-                 && $stanza->{raw} =~ /----- Original Message -----/ )
+            # Fix message stanza nesting for Outlook's quoting styles
+            if (     $stanza->{raw}
+                 and $stanza->{raw} =~ /^               # start of an internal line
+                                        \s*             # optional whitespace
+                                        (?:
+                                            -{3,}       # at least three hyphens
+                                            \s*         # whitespace varies between Outlook versions
+                                            [\w\s]+?    # words, loose to get different languages
+                                            \s*         # whitespace varies between Outlook versions
+                                            -{3,}       # at least three hyphens again
+                                          |
+                                            _{6,}       # OR: six or more underscores
+                                        )
+                                        \s*$            # optional whitespace until the end of the line
+                                       /xm )
             {
                 $Message->[ $i + 1 ] = [ splice @$Message, $i + 1 ]
                     if $Message->[ $i + 1 ];

commit 178433c674c8f02c5c7f6f2db6002de4dc8a1897
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Oct 4 14:32:25 2011 -0400

    Include the Outlook header stanza in the nested quoted parts
    
    This is a nice improvement that reduces clutter significantly.  Outlook
    "Original Message" header blocks like the following are now included and
    folded with the text they precede.
    
        -----Original Message-----
        From: Thomas Sibley
        Sent: Tuesday, October 04, 2011 10:21 AM
        To: RT
        Subject: Re: [example.com #1] My hovercraft is full of eels!

diff --git a/share/html/Ticket/Elements/ShowMessageStanza b/share/html/Ticket/Elements/ShowMessageStanza
index 6b2e41f..be68ede 100755
--- a/share/html/Ticket/Elements/ShowMessageStanza
+++ b/share/html/Ticket/Elements/ShowMessageStanza
@@ -96,6 +96,7 @@ AGAIN: foreach ( ; $i < @$Message; $i++ ) {
         if ( ref $stanza eq "HASH" ) {
             # Fix message stanza nesting for Outlook's quoting styles
             if (     $stanza->{raw}
+                 and not $stanza->{_outlooked}
                  and $stanza->{raw} =~ /^               # start of an internal line
                                         \s*             # optional whitespace
                                         (?:
@@ -110,10 +111,13 @@ AGAIN: foreach ( ; $i < @$Message; $i++ ) {
                                         \s*$            # optional whitespace until the end of the line
                                        /xm )
             {
-                $Message->[ $i + 1 ] = [ splice @$Message, $i + 1 ]
-                    if $Message->[ $i + 1 ];
+                $stanza->{_outlooked}++;
+                # Nest the current stanza and everything that follows
+                $stanza = $Message->[ $i ] = [ splice @$Message, $i ];
+            }
+            else {
+                $para .= ( defined $stanza->{raw} ? $stanza->{raw} : '' )."\n";
             }
-            $para .= ( defined $stanza->{raw} ? $stanza->{raw} : '' )."\n";
         }
         next unless ref $stanza eq "ARRAY";
 

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


More information about the Rt-commit mailing list