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

This commit is contained in:
Martin Edenhofer 2015-04-30 09:23:01 +02:00
parent 049b760440
commit b47ffdd925
2 changed files with 14 additions and 2 deletions

View file

@ -305,6 +305,11 @@ class App.Utils
# To/Cc/Bcc: xxx # To/Cc/Bcc: xxx
# Date: 01.04.2015 12:41 # Date: 01.04.2015 12:41
# Subject: xxx # Subject: xxx
# - or -
# De : xxx
# À/?/?: xxx
# Envoyé : mercredi 29 avril 2015 17:31
# Objet : xxx
searchForMs = (textToSearchInLines, markers) -> searchForMs = (textToSearchInLines, markers) ->
lineCount = 0 lineCount = 0
fromFound = undefined fromFound = undefined
@ -315,7 +320,7 @@ class App.Utils
# find Sent # find Sent
if fromFound 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 = marker =
line: fromFound line: fromFound
lineCount: lineCount lineCount: lineCount
@ -327,7 +332,7 @@ class App.Utils
# find From # find From
else 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, '') fromFound = line.replace(/\s{0,5}(\[|<).+?(\]|>)/g, '')
foundInLines = lineCount foundInLines = lineCount
searchForMs(textToSearchInLines, markers) searchForMs(textToSearchInLines, markers)

View file

@ -599,6 +599,13 @@ test( "identify signature", function() {
result = App.Utils.signatureIdentify( message, true ) result = App.Utils.signatureIdentify( message, true )
equal( result, should ) 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 // thunderbird
// de // 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>" 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>"