From 9c02d2e02b732bf4cb2845b389d353e5570e213d Mon Sep 17 00:00:00 2001 From: Billy Zhou Date: Tue, 25 Sep 2018 11:43:52 +0200 Subject: [PATCH] Added signatureIdentifyByHtml to detect signatures and blockquotes through HTML nodes. --- .../article_action/email_reply.coffee | 1 + .../ticket_zoom/article_view.coffee | 4 +- .../javascripts/app/lib/app_post/utils.coffee | 62 +++- lib/html_sanitizer.rb | 5 +- public/assets/tests/html_utils.js | 309 +++++++++++++++--- 5 files changed, 337 insertions(+), 44 deletions(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_action/email_reply.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_action/email_reply.coffee index 70835c021..3b3cb1052 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_action/email_reply.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_action/email_reply.coffee @@ -296,6 +296,7 @@ class EmailReply extends App.Controller App.Utils.htmlStrip(signature) if signaturePosition is 'top' body.prepend(signature) + body.prepend('
') else body.append(signature) ui.$('[data-name=body]').replaceWith(body) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee index e28119972..7c1f39ca3 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee @@ -148,13 +148,13 @@ class ArticleViewItem extends App.ObserverController body.splice(article.preferences.signature_detection, 0, signatureDetected) body = body.join('
') else - body = App.Utils.signatureIdentify(body) + body = App.Utils.signatureIdentifyByHtml(body) article['html'] = body else # client signature detection bodyHtml = App.Utils.text2html(article.body) - article['html'] = App.Utils.signatureIdentify(bodyHtml) + article['html'] = App.Utils.signatureIdentifyByPlaintext(bodyHtml) # if no signature detected or within frist 25 lines, check if signature got detected in backend if article['html'] is bodyHtml || (article.preferences && article.preferences.signature_detection < 25) diff --git a/app/assets/javascripts/app/lib/app_post/utils.coffee b/app/assets/javascripts/app/lib/app_post/utils.coffee index c1f8dcbdc..d199a0577 100644 --- a/app/assets/javascripts/app/lib/app_post/utils.coffee +++ b/app/assets/javascripts/app/lib/app_post/utils.coffee @@ -425,8 +425,8 @@ class App.Utils else true - # messageWithMarker = App.Utils.signatureIdentify(message, false) - @signatureIdentify: (message, test = false, internal = false) -> + # messageWithMarker = App.Utils.signatureIdentifyByPlaintext(message, false) + @signatureIdentifyByPlaintext: (message, test = false, internal = false) -> textToSearch = @html2text(message) # if we do have less then 10 lines and less then 300 chars ignore this @@ -645,6 +645,64 @@ class App.Utils regex = new RegExp("\>(\s{0,10}#{quote(App.Utils.htmlEscape(markers[0].line))})") message.replace(regex, ">#{markerTemplate}\$1") + @isMicrosoftOffice: (message) -> + regex = new RegExp('-----(Ursprüngliche Nachricht|Original Message|Mensaje original|Message d\'origine|Messaggio originale|邮件原件|原始郵件)-----') + message.match(regex) + + # messageWithMarker = App.Utils.signatureIdentifyByHtml(message) + @signatureIdentifyByHtml: (message) -> + # use the plaintext fallback method if message is composed by Microsoft Office + if @isMicrosoftOffice message + return @signatureIdentifyByPlaintext message + + message_element = $($.parseHTML(message)) + if message_element.length == 1 && $(message_element[0])?.children()?.length + message_element[0].innerHTML = @signatureIdentifyByHtmlHelper(message_element[0].innerHTML) + return message_element[0].outerHTML + + @signatureIdentifyByHtmlHelper(message) + + @signatureIdentifyByHtmlHelper: (message, internal = false) -> + # blockquotes and signature blocks are considered "dismiss nodes" and their indice will be stored + dismissNodes = [] + contentNodes = [] + res = [] + + isQuoteOrSignature = (el) -> + el = $(el) + tag = el.prop("tagName") + return true if tag is 'BLOCKQUOTE' + # detect Zammad's own
marker + return true if tag is 'DIV' && (el.data('signature') || el.prop('class') is 'yahoo_quoted') + _.some el.children(), (el) -> isQuoteOrSignature el + + $('
').html(message).contents().each (index, node) -> + text = $(node).text() + if node.nodeType == Node.TEXT_NODE + res.push text + if text.trim().length + contentNodes.push index + else if node.nodeType == Node.ELEMENT_NODE + res.push node.outerHTML + if isQuoteOrSignature node + dismissNodes.push index + else if text.trim().length + contentNodes.push index + + # filter out all dismiss nodes smaller than the largest content node + max_content = _.max contentNodes || 0 + dismissNodes = _.filter dismissNodes, (x) -> x >= max_content + + # return the message unchanged if there are no nodes to dismiss + return message if !dismissNodes.length + + # insert marker template at the earliest valid location + markerIndex = _.min dismissNodes + markerTemplate = '' + + res.splice(markerIndex, 0, markerTemplate) + res.join('') + # textReplaced = App.Utils.replaceTags( template, { user: { firstname: 'Bob', lastname: 'Smith' } } ) @replaceTags: (template, objects) -> template = template.replace( /#\{\s{0,2}(.+?)\s{0,2}\}/g, (index, key) -> diff --git a/lib/html_sanitizer.rb b/lib/html_sanitizer.rb index 569b6a674..e72173785 100644 --- a/lib/html_sanitizer.rb +++ b/lib/html_sanitizer.rb @@ -18,7 +18,10 @@ satinize html string based on whiltelist attributes_whitelist = Rails.configuration.html_sanitizer_attributes_whitelist css_properties_whitelist = Rails.configuration.html_sanitizer_css_properties_whitelist css_values_blacklist = Rails.application.config.html_sanitizer_css_values_backlist - classes_whitelist = ['js-signatureMarker'] + + # We whitelist yahoo_quoted because Yahoo Mail marks quoted email content using + #
and we rely on this class to identify quoted messages + classes_whitelist = ['js-signatureMarker', 'yahoo_quoted'] attributes_2_css = %w[width height] # remove html comments diff --git a/public/assets/tests/html_utils.js b/public/assets/tests/html_utils.js index decf0918f..62204a44f 100644 --- a/public/assets/tests/html_utils.js +++ b/public/assets/tests/html_utils.js @@ -800,220 +800,451 @@ test("check signature", function() { }); // identify signature -test("identify signature", function() { +test("identify signature by plaintext", function() { var message = "
test 123
" var should = '
test 123
' - var result = App.Utils.signatureIdentify(message) + var result = App.Utils.signatureIdentifyByPlaintext(message) equal(result, should) message = "
test 123
--
Bob Smith
" should = '
test 123
--
Bob Smith
' - result = App.Utils.signatureIdentify(message) + result = App.Utils.signatureIdentifyByPlaintext(message) equal(result, should) message = "
test 123
1
2
3
4
5
6
7
8
9

--
Bob Smith
" should = '
test 123
1
2
3
4
5
6
7
8
9

--
Bob Smith
' - result = App.Utils.signatureIdentify(message) + result = App.Utils.signatureIdentifyByPlaintext(message) equal(result, should) message = "
test 123

--no not match--
--
Bob Smith
" should = '
test 123

--no not match--
--
Bob Smith
' - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "
test 123

--no not match--
--
Bob Smith
" should = '
test 123

--no not match--
--
Bob Smith
' - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "
test 123

--
Bob Smith




--
Bob Smith
" should = '
test 123

--
Bob Smith




--
Bob Smith
' //should = '
test 123










--
Bob Smith




--
Bob Smith
' - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "
test 123
test 123
--
Bob Smith
" should = "
test 123
test 123
--
Bob Smith
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "

test 123

test 123

--

Bob Smith

" should = "

test 123

test 123

--

Bob Smith

" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "Test reply to zammad

Am 24.10.2016 18:55 schrieb "Android Support" <android-support@example.com>:

>
> Sehr geehrte Damen" should = "Test reply to zammad

Am 24.10.2016 18:55 schrieb "Android Support" <android-support@example.com>:

>
> Sehr geehrte Damen" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "
< On 20 Oct 2016, at 12:23, Martin Edenhofer via Zammad Helpdesk wrote:
" should = "
< On 20 Oct 2016, at 12:23, Martin Edenhofer via Zammad Helpdesk wrote:
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) // apple // en message = "
test 123

--no not match--

Bob Smith
On 01/04/15 10:55, Bob Smith wrote:
lalala

--

some test
" should = '
test 123

--no not match--

Bob Smith
On 01/04/15 10:55, Bob Smith wrote:
lalala

--

some test
' - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) // de message = "
test 123

--no not match--

Bob Smith
Am 03.04.2015 um 20:58 schrieb Bob Smith <bob@example.com>:
lalala
" should = '
test 123

--no not match--

Bob Smith
Am 03.04.2015 um 20:58 schrieb Bob Smith <bob@example.com>:
lalala
' - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) // ms // en message = "
test 123

--no not match--

Bob Smith
From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Sent: Donnerstag, 2. April 2015 10:00
lalala
" should = '
test 123

--no not match--

Bob Smith
From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Sent: Donnerstag, 2. April 2015 10:00
lalala
' - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "
test 123

--no not match--

Bob Smith
From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Sent: Donnerstag, 2. April 2015 10:00
Subject: lalala
" should = '
test 123

--no not match--

Bob Smith
From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Sent: Donnerstag, 2. April 2015 10:00
Subject: lalala
' - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "
test 123

--no not match--

Bob Smith
From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Sent: Donnerstag, 2. April 2015 10:00
1
2
3
4
4
Subject: lalala
" should = '
test 123

--no not match--

Bob Smith
From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Sent: Donnerstag, 2. April 2015 10:00
1
2
3
4
4
Subject: lalala
' - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) // de message = "
test 123

--no not match--

Bob Smith
Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Gesendet: Donnerstag, 2. April 2015 10:00
Betreff: lalala
" should = '
test 123

--no not match--

Bob Smith
Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Gesendet: Donnerstag, 2. April 2015 10:00
Betreff: lalala
' - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "
1

Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
\n
Gesendet: Donnerstag, 2. April 2015 11:32
" should = "
1

Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
\n
Gesendet: Donnerstag, 2. April 2015 11:32
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "
1

Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
\n
Gesendet: Donnerstag, 2. April 2015 11:32
Betreff: lalala
" should = "
1

Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
\n
Gesendet: Donnerstag, 2. April 2015 11:32
Betreff: lalala
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "
1

Von: Martin Edenhofer via Znuny Support <mailto:support@znuny.inc>
\n
An: somebody
Datum: Donnerstag, 2. April 2015 11:32
Betreff: lalala
" should = "
1

Von: Martin Edenhofer via Znuny Support <mailto:support@znuny.inc>
\n
An: somebody
Datum: Donnerstag, 2. April 2015 11:32
Betreff: lalala
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "
Von: "Johannes Nickel via Znuny Projects" <projects@znuny.inc>
An: \"Lisa Smith\" <lisa.smith@example.com>
Gesendet: Donnerstag, 2. April 2015 10:11:12
Betreff: Angebot Redundanz / Paket mit Silver Subscription [Ticket#424242]

Hallo Frau Smith,
" should = "
Von: "Johannes Nickel via Znuny Projects" <projects@znuny.inc>
An: \"Lisa Smith\" <lisa.smith@example.com>
Gesendet: Donnerstag, 2. April 2015 10:11:12
Betreff: Angebot Redundanz / Paket mit Silver Subscription [Ticket#424242]

Hallo Frau Smith,
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "
Hi Johannes,

das Angebot für den halben Tag bitte an uns.
Der Termin hat sich jetzt auf 10-12 Uhr verschoben, hab ich dir weitergeleitet.

Viele Grüße
Max

> On 07 Oct 2015, at 11:55, Johannes Smith <smith@example.com <mailto:smith@example.com>> wrote:
>
> Hi,
>
> OK. Wer kriegt das Angebot? Ist das wirklich nur ein halber Tag?
" should = "
Hi Johannes,

das Angebot für den halben Tag bitte an uns.
Der Termin hat sich jetzt auf 10-12 Uhr verschoben, hab ich dir weitergeleitet.

Viele Grüße
Max

> On 07 Oct 2015, at 11:55, Johannes Smith <smith@example.com <mailto:smith@example.com>> wrote:
>
> Hi,
>
> OK. Wer kriegt das Angebot? Ist das wirklich nur ein halber Tag?
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "Dear Mr. Smith,

it seems to be, dass Sie den AutoIncrement Nummerngenerator für Ihre ITSMChangeManagement Installation verwenden. Seit ABC 3.2 wird führend vor der sich in der Datei <ABC_CONFIG_Home>/war/log/ITSMChangeCounter.log  befindenden Zahl die SystemID (SysConfig) geschrieben. Dies ist ein Standardverhalten, dass auch bei der Ticketnummer verwendet wird.

Please ask me if you have questions.

Viele Grüße,
  Thorsten Smith\n
\n
--\n
Enterprise Services for ABC\n
\n
Znuny GmbH // Marienstraße 11 // 10117 Berlin // Germany\n
\n
P: +49 (0) 30 111 111 111-0\n
F: +49 (0) 30 111 111 111-8\n
W: http://znuny.com \n
\n
Location: Berlin - HRB 12345678 B Amtsgericht Berlin-Charlottenburg\n
Managing Director: Martin Edenhofer\n
" should = "Dear Mr. Smith,

it seems to be, dass Sie den AutoIncrement Nummerngenerator für Ihre ITSMChangeManagement Installation verwenden. Seit ABC 3.2 wird führend vor der sich in der Datei <ABC_CONFIG_Home>/war/log/ITSMChangeCounter.log  befindenden Zahl die SystemID (SysConfig) geschrieben. Dies ist ein Standardverhalten, dass auch bei der Ticketnummer verwendet wird.

Please ask me if you have questions.

Viele Grüße,
  Thorsten Smith\n
\n
--\n
Enterprise Services for ABC\n
\n
Znuny GmbH // Marienstraße 11 // 10117 Berlin // Germany\n
\n
P: +49 (0) 30 111 111 111-0\n
F: +49 (0) 30 111 111 111-8\n
W: http://znuny.com \n
\n
Location: Berlin - HRB 12345678 B Amtsgericht Berlin-Charlottenburg\n
Managing Director: Martin Edenhofer\n
" - result = App.Utils.signatureIdentify(message, true, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true, true) equal(result, should) message = "Dear Mr. Smith, nice to read you,
  Thorsten Smith\n
\n
--\n
" should = "Dear Mr. Smith, nice to read you,
  Thorsten Smith\n
\n
--\n
" - result = App.Utils.signatureIdentify(message, true, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true, true) equal(result, should) message = "Dear Mr. Smith, nice to read you,
  Thorsten Smith\n
\n
--\n
" should = "Dear Mr. Smith, nice to read you,
  Thorsten Smith\n
\n
--\n
" - result = App.Utils.signatureIdentify(message, false, true) + result = App.Utils.signatureIdentifyByPlaintext(message, false, true) equal(result, should) // fr message = "
test 123

--no not match--

Bob Smith
De : Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Envoyé : mercredi 29 avril 2015 17:31
Objet : lalala
" should = '
test 123

--no not match--

Bob Smith
De : Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
Envoyé : mercredi 29 avril 2015 17:31
Objet : lalala
' - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) // thunderbird // de message = "

Viele Grüße,
Christian

Am 04.03.2015 um 12:47 schrieb Martin Edenhofer via Znuny Sales:
> Hallo Christian,
" should = "

Viele Grüße,
Christian

Am 04.03.2015 um 12:47 schrieb Martin Edenhofer via Znuny Sales:
> Hallo Christian,
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) // en - Thunderbird default - http://kb.mozillazine.org/Reply_header_settings message = "

Viele Grüße,
Christian

On 01-01-2007 11:00 AM, Alf Aardvark wrote:
> Hallo Christian,
" should = "

Viele Grüße,
Christian

On 01-01-2007 11:00 AM, Alf Aardvark wrote:
> Hallo Christian,
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) // en - http://kb.mozillazine.org/Reply_header_settings message = "

Viele Grüße,
Christian

Alf Aardvark wrote, on 01-01-2007 11:00 AM:
> Hallo Christian,
" should = "

Viele Grüße,
Christian

Alf Aardvark wrote, on 01-01-2007 11:00 AM:
> Hallo Christian,
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) // otrs // en message = "
test 123

--no not match--

Bob Smith
01/04/15 10:55 - Bob Smith wrote:
lalala
" should = '
test 123

--no not match--

Bob Smith
01/04/15 10:55 - Bob Smith wrote:
lalala
' - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) // de message = "
test 123

--no not match--

Bob Smith
01/04/15 10:55 - Bob Smith schrieb:
lalala
" should = '
test 123

--no not match--

Bob Smith
01/04/15 10:55 - Bob Smith schrieb:
lalala
' - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "
test 123

24.02.2015 14:20 - Roy Kaldung via Znuny Sales schrieb:  
" should = "
test 123

24.02.2015 14:20 - Roy Kaldung via Znuny Sales schrieb:  
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) // zammad message = "
test 123

--no not match--

Bob Smith
lalala
" should = "
test 123

--no not match--

Bob Smith
lalala
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "
test 123

--no not match--

Bob Smith
lalala
" should = "
test 123

--no not match--

Bob Smith
lalala
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) // gmail message = "
test 123

--no not match--

Bob Smith
lalala
" should = "
test 123

--no not match--

Bob Smith
lalala
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "
test 123

--no not match--

Bob Smith
lalala
" should = "
test 123

--no not match--

Bob Smith
lalala
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) message = "
test 123

--no not match--

Bob Smith
Am 24. Dezember 2015 um 07:45 schrieb kathrine <kathrine@example.com>:
lalala
" should = "
test 123

--no not match--

Bob Smith
Am 24. Dezember 2015 um 07:45 schrieb kathrine <kathrine@example.com>:
lalala
" - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) // word 14 // en message = "
test 123

--no not match--

Bob Smith
Bob Smith wrote:
lalala
" should = '
test 123

--no not match--

Bob Smith
Bob Smith wrote:
lalala
' - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) // de message = "
test 123

--no not match--

Bob Smith
Bob Smith schrieb:
lalala
" should = '
test 123

--no not match--

Bob Smith
Bob Smith schrieb:
lalala
' - result = App.Utils.signatureIdentify(message, true) + result = App.Utils.signatureIdentifyByPlaintext(message, true) equal(result, should) }); + +test("identify signature by HTML", function() { + + var message = "
test 123
" + var should = message + var result = App.Utils.signatureIdentifyByHtml(message) + equal(result, should) + + // simple case 1 + message = '
actual content
quoted content
' + should = '
actual content
quoted content
' + result = App.Utils.signatureIdentifyByHtml(message) + equal(result, should) + + // simple case 2 + message = '
actual content
quoted content



' + should = '
actual content
quoted content



' + result = App.Utils.signatureIdentifyByHtml(message) + equal(result, should) + + // simple case 3 + message = '
actual content
quoted content

actual content 2
' + should = message + result = App.Utils.signatureIdentifyByHtml(message) + equal(result, should) + + // simple case 4 + message = ' content 0
content 1
content 2
quoted content



' + should = ' content 0
content 1
content 2
quoted content



' + result = App.Utils.signatureIdentifyByHtml(message) + equal(result, should) + + // Gmail via Safari on MacOS 10.12 + message = '
Reply with gmail via Safari on MacOS 10.12

\ +
\ +
Am Mi., 5. Sep. 2018 um 09:22 Uhr schrieb Billy Zhou <bz@zammad.com>:
\ +
\ +
test email content
\ +
\ +
\ +
' + should = '
Reply with gmail via Safari on MacOS 10.12

\ +
\ +
Am Mi., 5. Sep. 2018 um 09:22 Uhr schrieb Billy Zhou <bz@zammad.com>:
\ +
\ +
test email content
\ +
\ +
\ +
' + result = App.Utils.signatureIdentifyByHtml(message) + equal(result, should) + + // Yahoo Mail via Safari on MacOS 10.12 + message = '
Reply with Yahoo Mail via Safari on MacOS 10.12


Billy Zhou <bz@zammad.com> schrieb am 9:08 Mittwoch, 5.September 2018:


test email content



' + should = '
Reply with Yahoo Mail via Safari on MacOS 10.12


Billy Zhou <bz@zammad.com> schrieb am 9:08 Mittwoch, 5.September 2018:


test email content



' + result = App.Utils.signatureIdentifyByHtml(message) + equal(result, should) + + // Thunderbird 52 on MacOS 10.12 + message = 'Reply with Thunderbird 52 on MacOS 10.12
\ +
\ +
Am 04.09.18 um 15:32 schrieb Billy\ + Zhou:
\ +
\ +
test\ + email content\ +
\ +
\ +
\ +
' + should = 'Reply with Thunderbird 52 on MacOS 10.12
\ +
\ +
Am 04.09.18 um 15:32 schrieb Billy\ + Zhou:
\ +
\ +
test\ + email content\ +
\ +
\ +
\ +
' + result = App.Utils.signatureIdentifyByHtml(message) + equal(result, should) + + // Apple Mail on MacOS 10 + message = '
Reply by Apple Mail on MacOS 10.


On 4. Sep 2018, at 15:32, Billy Zhou <bz@zammad.com> wrote:

test email content


' + should = '
Reply by Apple Mail on MacOS 10.


On 4. Sep 2018, at 15:32, Billy Zhou <bz@zammad.com> wrote:

test email content


' + result = App.Utils.signatureIdentifyByHtml(message) + equal(result, should) + + // Office 365 (10325.20118) on Windows 10 Build 1803 + // With German marker: -----Ursprüngliche Nachricht----- + // Using fallback to signatureIdentifyByPlaintext + message = '
\ +

Reply with Office 365 (10325.20118) on Windows 10 Build 1803

\ +

\ +

fett

\ +

\ +

--

\ +

Zammad GmbH // Marienstraße 11 // 10117 Berlin // Germany

\ +

\ +

P: +49 (0) 30 55 57 160-0

\ +

F: +49 (0) 30 55 57 160-99

\ +

W: https://zammad.com

\ +

\ +

Location: Berlin - HRB 163946 B Amtsgericht Berlin-Charlottenburg

\ +

Managing Director: Martin Edenhofer

\ +

\ +

-----Ursprüngliche Nachricht-----
Von: Billy Zhou <bz@zammad.com>
Gesendet: Dienstag, 4. September 2018 15:33
An: me@zammad.com
Betreff: test email title

\ +

\ +

test email content

\ +

\ +
' + should = '
\ +

Reply with Office 365 (10325.20118) on Windows 10 Build 1803

\ +

\ +

fett

\ +

\ +

--

\ +

Zammad GmbH // Marienstraße 11 // 10117 Berlin // Germany

\ +

\ +

P: +49 (0) 30 55 57 160-0

\ +

F: +49 (0) 30 55 57 160-99

\ +

W: https://zammad.com

\ +

\ +

Location: Berlin - HRB 163946 B Amtsgericht Berlin-Charlottenburg

\ +

Managing Director: Martin Edenhofer

\ +

\ +

-----Ursprüngliche Nachricht-----
Von: Billy Zhou <bz@zammad.com>
Gesendet: Dienstag, 4. September 2018 15:33
An: me@zammad.com
Betreff: test email title

\ +

\ +

test email content

\ +

\ +
' + result = App.Utils.signatureIdentifyByHtml(message) + equal(result, should) + + // Office 365 (10325.20118) on Windows 10 Build 1803 + // With English marker: -----Original Message----- + // Using fallback to signatureIdentifyByPlaintext + message = '
\ +

Reply with Office 365 (10325.20118) on Windows 10 Build 1803

\ +

\ +

fett

\ +

\ +

--

\ +

Zammad GmbH // Marienstraße 11 // 10117 Berlin // Germany

\ +

\ +

P: +49 (0) 30 55 57 160-0

\ +

F: +49 (0) 30 55 57 160-99

\ +

W: https://zammad.com

\ +

\ +

Location: Berlin - HRB 163946 B Amtsgericht Berlin-Charlottenburg

\ +

Managing Director: Martin Edenhofer

\ +

\ +

-----Original Message-----
Von: Billy Zhou <bz@zammad.com>
Gesendet: Dienstag, 4. September 2018 15:33
An: me@zammad.com
Betreff: test email title

\ +

\ +

test email content

\ +

\ +
' + should = '
\ +

Reply with Office 365 (10325.20118) on Windows 10 Build 1803

\ +

\ +

fett

\ +

\ +

--

\ +

Zammad GmbH // Marienstraße 11 // 10117 Berlin // Germany

\ +

\ +

P: +49 (0) 30 55 57 160-0

\ +

F: +49 (0) 30 55 57 160-99

\ +

W: https://zammad.com

\ +

\ +

Location: Berlin - HRB 163946 B Amtsgericht Berlin-Charlottenburg

\ +

Managing Director: Martin Edenhofer

\ +

\ +

-----Original Message-----
Von: Billy Zhou <bz@zammad.com>
Gesendet: Dienstag, 4. September 2018 15:33
An: me@zammad.com
Betreff: test email title

\ +

\ +

test email content

\ +

\ +
' + result = App.Utils.signatureIdentifyByHtml(message) + equal(result, should) + + // Office 365 (10325.20118) on Windows 10 Build 1803 + // With German marker: -----Ursprüngliche Nachricht----- + // Without any existing + // Using fallback to signatureIdentifyByPlaintext + message = '
\ +

Reply with Office 365 (10325.20118) on Windows 10 Build 1803

\ +

\ +

fett

\ +

\ +

--

\ +

Zammad GmbH // Marienstraße 11 // 10117 Berlin // Germany

\ +

\ +

P: +49 (0) 30 55 57 160-0

\ +

F: +49 (0) 30 55 57 160-99

\ +

W: https://zammad.com

\ +

\ +

Location: Berlin - HRB 163946 B Amtsgericht Berlin-Charlottenburg

\ +

Managing Director: Martin Edenhofer

\ +

\ +

-----Ursprüngliche Nachricht-----
Von: Billy Zhou <bz@zammad.com>
Gesendet: Dienstag, 4. September 2018 15:33
An: me@zammad.com
Betreff: test email title

\ +

\ +

test email content

\ +

\ +
' + should = '
\ +

Reply with Office 365 (10325.20118) on Windows 10 Build 1803

\ +

\ +

fett

\ +

\ +

--

\ +

Zammad GmbH // Marienstraße 11 // 10117 Berlin // Germany

\ +

\ +

P: +49 (0) 30 55 57 160-0

\ +

F: +49 (0) 30 55 57 160-99

\ +

W: https://zammad.com

\ +

\ +

Location: Berlin - HRB 163946 B Amtsgericht Berlin-Charlottenburg

\ +

Managing Director: Martin Edenhofer

\ +

\ +

-----Ursprüngliche Nachricht-----
Von: Billy Zhou <bz@zammad.com>
Gesendet: Dienstag, 4. September 2018 15:33
An: me@zammad.com
Betreff: test email title

\ +

\ +

test email content

\ +

\ +
' + result = App.Utils.signatureIdentifyByHtml(message) + equal(result, should) +}); + // check attachment references test("check replace tags", function() { var message = 'some not existing'