Skip to content

Commit 434532f

Browse files
author
adminadmin
committed
update POSTFIX_TLS_REGEX to also handle stalwart
1 parent 4b1fb86 commit 434532f

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

test/TlsIconTest.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ final class TlsIconTest extends TestCase
3030
/** @var string */
3131
private $strSendmailCryptedTlsv12WithCipherVerify = '<img class="lock_icon" src="plugins/tls_icon/lock.svg" title="TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK" />';
3232

33+
/** @var string */
34+
private $strStalwartCryptedTlsv13WithCipher = '<img class="lock_icon" src="plugins/tls_icon/lock.svg" title="TLSv1.3 with cipher TLS13_AES_256_GCM_SHA384" />';
3335

3436
public function testInstance()
3537
{
@@ -379,4 +381,40 @@ public function testSendmailTLS13MultipleRecipients()
379381
]
380382
], $headersProcessed);
381383
}
384+
385+
public function testStalwartTls()
386+
{
387+
$o = new tls_icon();
388+
$headersProcessed = $o->message_headers([
389+
'output' => [
390+
'subject' => [
391+
'value' => 'Sent to you',
392+
],
393+
],
394+
'headers' => (object) [
395+
'others' => [
396+
'received' => 'from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174] (AS15169 Google LLC, US))
397+
(using TLSv1.3 with cipher TLS13_AES_256_GCM_SHA384)
398+
by mail.example.org (Stalwart SMTP) with ESMTPS id 36DAF29F3A02098;
399+
Mon, 16 Jun 2025 13:33:03 +0000',
400+
]
401+
]
402+
]);
403+
$this->assertEquals([
404+
'output' => [
405+
'subject' => [
406+
'value' => 'Sent to you' . $this->strStalwartCryptedTlsv13WithCipher,
407+
'html' => 1,
408+
],
409+
],
410+
'headers' => (object) [
411+
'others' => [
412+
'received' => 'from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174] (AS15169 Google LLC, US))
413+
(using TLSv1.3 with cipher TLS13_AES_256_GCM_SHA384)
414+
by mail.example.org (Stalwart SMTP) with ESMTPS id 36DAF29F3A02098;
415+
Mon, 16 Jun 2025 13:33:03 +0000',
416+
]
417+
]
418+
], $headersProcessed);
419+
}
382420
}

tls_icon.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class tls_icon extends rcube_plugin
44
{
5-
const POSTFIX_TLS_REGEX = "/\(using (TLS.*)\) \(/im";
5+
const POSTFIX_TLS_REGEX = "/\(using (TLS[^()]+(?:\([^)]+\))?)/im";
66
const POSTFIX_LOCAL_REGEX = "/\([a-zA-Z]*, from userid [0-9]*\)/im";
77
const SENDMAIL_TLS_REGEX = "/\(version=(TLS.*)\)(\s+for|;)/im";
88

0 commit comments

Comments
 (0)