diff --git a/.release b/.release index 0493593..7307651 160000 --- a/.release +++ b/.release @@ -1 +1 @@ -Subproject commit 0493593b975a438b3214ad30c49062af5bd57f55 +Subproject commit 73076513e83c2057a32515831b638771c15b1d83 diff --git a/CHANGELOG.md b/CHANGELOG.md index 77802d2..560943f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/). ### Unreleased +### [1.0.3] - 2025-02-06 + +- results: tidying up duplicate data +- results.hits: deleted, alias for score +- results.status: deleted, alias for flag +- results.flag: change from Yes/No to boolean + ### [1.0.2] - 2025-01-26 - prettier: move config into package.json @@ -16,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/). - repackaged from haraka/Haraka -[1.0.1]: https://github.com/haraka/haraka-plugin-spamassassin/releases/tag/v1.0.1 +[1.0.1]: https://github.com/haraka/haraka-plugin-spamassassin/releases/tag/1.0.1 [1.0.2]: https://github.com/haraka/haraka-plugin-spamassassin/releases/tag/v1.0.2 [1.0.0]: https://github.com/haraka/haraka-plugin-spamassassin/releases/tag/1.0.0 +[1.0.3]: https://github.com/haraka/haraka-plugin-spamassassin/releases/tag/v1.0.3 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index fe3f644..ac94d0e 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -2,7 +2,7 @@ This handcrafted artisinal software is brought to you by: -|
msimerson (3) | +|
msimerson (4) | | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | this file is generated by [.release](https://github.com/msimerson/.release). diff --git a/README.md b/README.md index 2fcf78b..08b3a33 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,6 @@ Other headers options you might find interesting or useful are: add_header all DCC _DCCB_: _DCCR_ add_header all Tests _TESTS_ -## USAGE diff --git a/index.js b/index.js index a624fb2..b96bd08 100644 --- a/index.js +++ b/index.js @@ -82,11 +82,9 @@ exports.hook_data_post = function (next, connection) { /Spam: (True|False) ; (-?\d+\.\d) \/ (-?\d+\.\d)/, ) if (matches) { - spamd_response.flag = matches[1] + spamd_response.flag = matches[1] === 'True' spamd_response.score = matches[2] - spamd_response.hits = matches[2] // backwards compat spamd_response.reqd = matches[3] - spamd_response.flag = spamd_response.flag === 'True' ? 'Yes' : 'No' } } else { state = 'headers' @@ -131,7 +129,6 @@ exports.hook_data_post = function (next, connection) { txn.notes.spamassassin = spamd_response connection.results.add(this, { time: (Date.now() - start) / 1000, - hits: spamd_response.hits, flag: spamd_response.flag, }) @@ -197,7 +194,7 @@ exports.munge_subject = function (conn, score) { } exports.do_header_updates = function (conn, spamd_response) { - if (spamd_response.flag === 'Yes') { + if (spamd_response.flag) { // X-Spam-Flag is added by SpamAssassin conn.transaction.remove_header('precedence') conn.transaction.add_header('Precedence', 'junk') @@ -342,7 +339,7 @@ exports.log_results = function (conn, spamd_response) { : cfg.reject_threshold const human_text = - `status=${spamd_response.flag}` + + `status=${spamd_response.flag ? 'Yes' : 'No'}` + `, score=${spamd_response.score}` + `, required=${spamd_response.reqd}` + `, reject=${reject_threshold}` + @@ -350,7 +347,6 @@ exports.log_results = function (conn, spamd_response) { conn.transaction.results.add(this, { human: human_text, - status: spamd_response.flag, score: parseFloat(spamd_response.score), required: parseFloat(spamd_response.reqd), reject: reject_threshold, diff --git a/package.json b/package.json index 8719645..fe14f41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "haraka-plugin-spamassassin", - "version": "1.0.2", + "version": "1.0.3", "description": "Haraka plugin that scans messages with SpamAssassin", "main": "index.js", "files": [ @@ -33,13 +33,13 @@ }, "homepage": "https://github.com/haraka/haraka-plugin-spamassassin#readme", "dependencies": { - "haraka-net-utils": "^1.7.1", - "haraka-utils": "^1.1.3" + "haraka-net-utils": "^1.7.2", + "haraka-utils": "^1.1.4" }, "devDependencies": { "@haraka/eslint-config": "^2.0.2", - "address-rfc2821": "^2.1.2", - "haraka-test-fixtures": "1.3.8" + "address-rfc2821": "^2.1.3", + "haraka-test-fixtures": "1.3.9" }, "prettier": { "singleQuote": true,