[imapfilter-devel] Question about config file syntax in 2.0

Bernd Kuemmerlen bkuemmer at gmx.net
Tue Sep 25 22:25:50 EEST 2007


Hello there,

I have been using imapfilter 1.3 for some time now, and I wanted to
upgrade to 2.0.

I have some questions regarding the 2.0 config-file syntax:

1. Is the old (1.3) syntax still supported? It looks as if this is the
case, I just wanted to be sure.
2. I am using flags for some special vacation handling, and I would like
to know how this is done in 2.0:

account1 = {
    server = 'mailserver',
    username = 'name at domain',
    password = 'XXXXX',
}

-- Vacation filter, insert start and end date of vacation
-- for 'since' and 'before'
vacation = {
  'not keyword "vacation"',
  'since 20-Jul-2007',
  'before 05-Aug-2007',
}

-- Get messages which have not yet been auto-replied to
results = match(account1, 'INBOX', vacation)
messages = fetchmessage(account1, 'INBOX', results)

if messages then
  for msgid, msgtxt in pairs(messages) do
      pipe_to('/usr/local/share/vacation/vacation.pl username', msgtxt)
  end
  -- set keyword to distinguish handled mails
  flag(account1, 'INBOX', 'add', { keywords = true, 'vacation' }, results)
end


I have not found a quick way to check for the flag or "keyword" in 2.0. I
guess I could fetch all the flags with fetch_flags(messages), but I don't
know lua well enough to know how to then check the flags.

3. In 1.3, I liked the way you could define the filters in one section
(like  the "vacation" filter in the example above) and use it later in the
actions. Is it possible to do this in the 2.0 syntax as well, i.e. define
the rules at one place and use them at another?

Thanks for any help
Bernd






More information about the Imapfilter-devel mailing list