From 92220a36f82edccc72b49e0fb3896b7e1be74098 Mon Sep 17 00:00:00 2001 From: Jean-Louis Dupond Date: Fri, 14 Jul 2017 14:24:04 +0200 Subject: [PATCH] [Fix] Detection of maillist optimized and fixed Some maillists were not detected correctly. Because by default all mails were checked for 'List-Unsubscribe' and 'List-Post' headers. But those headers do not exist on all maillists. For example majordomo detection was broken because of this. --- src/plugins/lua/maillist.lua | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/plugins/lua/maillist.lua b/src/plugins/lua/maillist.lua index 093e3164b..62ecc0341 100644 --- a/src/plugins/lua/maillist.lua +++ b/src/plugins/lua/maillist.lua @@ -28,6 +28,7 @@ local symbol = 'MAILLIST' -- List-Help: --- List-Id: -- List-Unsubscribe: .* -- List-Archive: -- X-Mailman-Version: \d +-- RFC 2919 headers exist local function check_ml_mailman(task) -- Mailing-List local header = task:get_header('x-mailman-version') @@ -78,7 +79,7 @@ local function check_ml_mailman(task) end -- Precedence header = task:get_header('precedence') - if not header or (not string.match(header, '^bulk$') and not string.match(header, '^list$')) then + if not header or (header ~= 'bulk' and header ~= 'list') then return false end -- For reminders we have other headers than for normal messages @@ -96,10 +97,6 @@ local function check_ml_mailman(task) end -- Other headers - header = task:get_header('list-id') - if not header then - return false - end header = task:get_header('list-post') if not header or not string.find(header, '^') then - return false - end - header = task:get_header('List-Post') - if not header or not string.find(header, '<.+>') then - return false - end - - return true -end - -- RFC 2919 headers local function check_rfc2919(task) local header = task:get_header('List-Id') @@ -190,7 +173,7 @@ local function check_rfc2919(task) return false end - return check_rfc2369(task) + return true end -- Google groups detector @@ -214,11 +197,12 @@ end -- Majordomo detector -- Check Sender for owner- or -owner -- Check Precedence for 'Bulk' or 'List' +-- RFC 2919 headers exist -- -- And nothing more can be extracted :( local function check_ml_majordomo(task) local header = task:get_header('Sender') - if not header or (not string.find(header, '^owner-.*$') and not string.find(header, '^.*-owner$')) then + if not header or (not string.find(header, '^owner-.*$') and not string.find(header, '^.*-owner@.*$')) then return false end @@ -246,13 +230,14 @@ end local function check_ml_generic(task) local header = task:get_header('Precedence') - if not header or (header ~= 'list' and header ~= 'bulk') then + if not header then return false end return check_rfc2919(task) end +-- RFC 2919 headers exist local function check_maillist(task) if check_ml_generic(task) then if check_ml_ezmlm(task) then -- 2.39.5