-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated to support Stalwart Mail server #22
Open
dehoej
wants to merge
4
commits into
GermanCoding:master
Choose a base branch
from
dehoej:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -5,6 +5,7 @@ class tls_icon extends rcube_plugin | |||||
const POSTFIX_TLS_REGEX = "/\(using (TLS.*)\) \(/im"; | ||||||
const POSTFIX_LOCAL_REGEX = "/\([a-zA-Z]*, from userid [0-9]*\)/im"; | ||||||
const SENDMAIL_TLS_REGEX = "/\(version=(TLS.*)\)(\s+for|;)/im"; | ||||||
const STALWART_TLS_REGEX = "/\(using (TLSv1\.[23] with cipher .+)\) by .+ \(Stalwart SMTP\)/im"; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For reference the name seems to be hard coded: https://github.com/stalwartlabs/mail-server/blob/24df9a0352a948f67ad58ab0d7d7423002863d43/crates/smtp/src/inbound/data.rs#L947 But I do not see the point of keeping it in the regex
Suggested change
|
||||||
|
||||||
private $message_headers_done = false; | ||||||
private $icon_img; | ||||||
|
@@ -60,7 +61,8 @@ public function message_headers($p) | |||||
} | ||||||
|
||||||
if (preg_match_all(tls_icon::POSTFIX_TLS_REGEX, $Received, $items, PREG_PATTERN_ORDER) || | ||||||
preg_match_all(tls_icon::SENDMAIL_TLS_REGEX, $Received, $items, PREG_PATTERN_ORDER)) { | ||||||
preg_match_all(tls_icon::SENDMAIL_TLS_REGEX, $Received, $items, PREG_PATTERN_ORDER) || | ||||||
preg_match_all(tls_icon::STALWART_TLS_REGEX, $Received, $items, PREG_PATTERN_ORDER)) { | ||||||
$data = $items[1][0]; | ||||||
$this->icon_img .= '<img class="lock_icon" src="plugins/tls_icon/lock.svg" title="' . htmlentities($data) . '" />'; | ||||||
} elseif (preg_match_all(tls_icon::POSTFIX_LOCAL_REGEX, $Received, $items, PREG_PATTERN_ORDER)) { | ||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This regex appears similar to the Postfix regex. Is there a specific reason why the existing Postfix regex doesn't work for Stalwart?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I don't like having overly specific regexes. Currently, TLSv1.2 and TLSv1.3 are the only protocol versions commonly used, but to anticipate a future TLSv1.4 or TLSv2.0 I don't think the regex needs to match only
TLSv1\.[23]
.