[imapfilter-devel] iterate on defined filters
Joel CARNAT
joel at carnat.net
Tue Aug 17 13:14:14 EEST 2004
Hi,
I want to "tidy" mails like INBOX.year.month.kind where kind will be things like virus_alert, spam_alert, ...
I found how to grab the date from the message and build the correct INBOX.
What I would like now is do something like : for F in SomeOfMyDefinedFilter; do match(F)&mov; done
What I have is :
***************************************************
spam = { 'subject "SPAM FROM"', }
virus = { 'subject "VIRUS" "FROM"', }
for ALERTS in {spam, virus} do
print("ALERTS is " .. ALERTS)
results = match(admin_vc, 'INBOX', ALERTS)
headers = fetchheaders(admin_vc, 'INBOX', { 'date ' }, results)
if headers ~= nil then
for ID, HDR in pairs(headers) do
_, _, month, year = string.find(HDR, "Date: %a+, %d+ (%a+) (%d+)")
move(admin_vc, 'INBOX', admin_vc, year .. '.' .. month .. '.' .. ALERTS, results)
end
end
end
***************************************************
here, imapfilter says : table expected, got number
if I use 'for ALERTS in {"spam", "virus"} do', I got : table expected, got number
How can I refer to the name of some defined filter (if possible) ?
TIA,
Jo
PS: any good link to learn LUA (else than google_lua_tutorial :) ?
More information about the Imapfilter-devel
mailing list