[imapfilter-devel] Re: More detailed control of output.
David DeSimone
fox at verio.net
Mon Nov 22 19:19:48 EET 2004
rnyman_imapfilter at afterburner.net <rnyman_imapfilter at afterburner.net> wrote:
>
> I keep pretty large archive folders where I store old messages for a
> period of time, but having the expiration be date based did not work
> for me (I want it to be first in first out, even if the message is 2
> months old when it goes in.
That makes sense, but you should realize that the method you've chosen
might have some problems associated with it.
> x,y,z=check(an,'00archive')
> if (x>9999) then
> first={1,2,3,4,5,6,7,8,9,10}
> delete(an,'00archive',first)
> end
This only works if options.uid is set to "false". If I remember
correctly, the default for the latest version of imapfilter is to have
the uid option set to "true," so you would have to specifically set it
to "false" in order to have this work.
> Alternatively, you can make the script loop by making it a while loop:
>
> x,y,z=check(an,'00archive')
> while (x>9999) do
> first={1,2,3,4,5,6,7,8,9,10}
> delete(an,'00archive',first)
> x,y,z=check(an,'00archive')
> end
It is also possible to write a version which always deletes as many
messages as it takes to keep the target number in the folder. Such as:
options.uid = false
TARGET = 10000
exists, recent, unseen = check(account, folder)
if (exists > TARGET)
then
local first = {}
for i = 1, (exists - TARGET)
do
table.insert(first, i)
end
delete(account, folder, first)
end
--
David DeSimone || Network Admin || fox at verio.net
"It took me fifteen years to discover that I had no
talent for writing, but I couldn't give it up because
by that time I was too famous. -- Robert Benchley
More information about the Imapfilter-devel
mailing list