chore: modify mailmover to stop breaking sent folder

This commit is contained in:
Luj 2025-04-26 13:41:48 +02:00
parent ce6e0f69af
commit b5fdf4a7c5
Signed by: luj
GPG key ID: 6FC74C847011FD83

View file

@ -32,6 +32,11 @@ local function is_parent_path(parent, child)
return child:match("^" .. parent .. "/") ~= nil
end
--- Check if a folder contains "Archive" in its name
local function contains_archive(folder)
return string.find(folder, "Archive") ~= nil
end
--- Generate rules based on folder structure
local function generate_rules(maildir_path)
local folders = get_maildir_folders(maildir_path)
@ -98,6 +103,11 @@ local function generate_rules(maildir_path)
end
end
-- Add "not tag:sent" for any folder containing "Archive"
if contains_archive(folder) then
table.insert(exclusion_parts, "not tag:sent")
end
-- Build the complete query
local query = table.concat(query_parts, " and ")
if #exclusion_parts > 0 then