Browse Source

Added fr support for App.Utils.signatureIdentify().

Martin Edenhofer 10 years ago
parent
commit
b47ffdd925

+ 7 - 2
app/assets/javascripts/app/lib/app_post/utils.js.coffee

@@ -305,6 +305,11 @@ class App.Utils
     # To/Cc/Bcc: xxx
     # Date: 01.04.2015 12:41
     # Subject: xxx
+    # - or -
+    # De : xxx
+    # À/?/?: xxx
+    # Envoyé : mercredi 29 avril 2015 17:31
+    # Objet : xxx
     searchForMs = (textToSearchInLines, markers) ->
       lineCount          = 0
       fromFound          = undefined
@@ -315,7 +320,7 @@ class App.Utils
 
         # find Sent
         if fromFound
-          if line && line.match( /^(Subject|Betreff):\s.+?/)
+          if line && line.match( /^(Subject|Betreff|Objet)(\s|):\s.+?/) # en/de/fr | sometimes ms adds a space to "xx : value"
             marker =
               line:      fromFound
               lineCount: lineCount
@@ -327,7 +332,7 @@ class App.Utils
 
         # find From
         else
-          if line && line.match( /^(From|Von):\s.+?/ )
+          if line && line.match( /^(From|Von|De)(\s|):\s.+?/ ) # en/de/fr | sometimes ms adds a space to "xx : value"
             fromFound    = line.replace(/\s{0,5}(\[|<).+?(\]|>)/g, '')
             foundInLines = lineCount
     searchForMs(textToSearchInLines, markers)

+ 7 - 0
public/assets/tests/html-utils.js

@@ -599,6 +599,13 @@ test( "identify signature", function() {
   result  = App.Utils.signatureIdentify( message, true )
   equal( result, should )
 
+  // fr
+  message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>De : Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]<br/>Envoyé : mercredi 29 avril 2015 17:31<br/>Objet : lalala</div>"
+  should  = '<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class="js-signatureMarker"></span>De : Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]<br/>Envoyé : mercredi 29 avril 2015 17:31<br/>Objet : lalala</div>'
+  result  = App.Utils.signatureIdentify( message, true )
+  equal( result, should )
+
+
   // thunderbird
   // de
   message = "<div><br></div><div>Viele Grüße,</div><div>Christian</div><div><br></div><div>Am 04.03.2015 um 12:47 schrieb Martin Edenhofer via Znuny Sales:</div><div>&gt; Hallo Christian,</div>"