Marty Oehme
bf80c9ecf3
Changed rollup filter to read the files to be rolled up from 'rollup.txt' file in the imapfilter configuration directory. (by default in XDG basedir-compliant directory such as '~/.config/imapfilter/rollup.txt') The file consists of sender addresses with a single address on each line.
28 lines
634 B
Lua
28 lines
634 B
Lua
function sendToFolder(folderFrom, folderTo, senders)
|
|
for _, sender in pairs(senders) do
|
|
messages = folderFrom:contain_from(sender)
|
|
messages:mark_seen()
|
|
messages:move_messages(folderTo)
|
|
end
|
|
end
|
|
|
|
function getSenderList(file)
|
|
local rollupSenders={}
|
|
|
|
local file = io.open(file)
|
|
if file then
|
|
for line in file:lines() do
|
|
table.insert(rollupSenders, line)
|
|
end
|
|
else
|
|
print("ERROR: rollup did not find rollup.txt file containing mail addresses.")
|
|
end
|
|
return rollupSenders
|
|
end
|
|
|
|
sendToFolder (
|
|
accounts.gmail["Inbox"],
|
|
accounts.gmail["Dump"],
|
|
getSenderList(getConfigDir() .. "/rollup.txt")
|
|
)
|