Discussion:
[imapfilter-devel] List in field def
Philippe LeCavalier
2011-01-17 15:00:14 UTC
Permalink
Hi.

How can I list multiple fields in the same argument?

results = acc2['Sent']:contain_field('to,from,cc', 'email_address')
results:copy_messages(acc1['Customers/acc2/help/Sent'])

The 'to,from,cc' doesn't work for grabbing the relevant mail. If I state
a rule for each field it works fine. I take it my angle for shortening
this rule isn't appropriate but there must be a way.

Thanks,
Phil
Lefteris Chatzimparmpas
2011-01-18 19:03:48 UTC
Permalink
Hello,

This isn't possible with imapfilter's current simplified configuration
format.

You have to combine 3 contain_field() calls with the '+' operator as
stated in the manual page. You could use a Lua for loop to avoid
repetition, but just for 3 calls it's probably not worth it.
Post by Philippe LeCavalier
Hi.
How can I list multiple fields in the same argument?
results = acc2['Sent']:contain_field('to,from,cc', 'email_address')
results:copy_messages(acc1['Customers/acc2/help/Sent'])
The 'to,from,cc' doesn't work for grabbing the relevant mail. If I state
a rule for each field it works fine. I take it my angle for shortening
this rule isn't appropriate but there must be a way.
Thanks,
Phil
_______________________________________________
Imapfilter-devel mailing list
Imapfilter-devel at lists.hellug.gr
http://lists.hellug.gr/mailman/listinfo/imapfilter-devel
Philippe LeCavalier
2011-01-18 19:15:18 UTC
Permalink
Thanks Lefteris.
Post by Lefteris Chatzimparmpas
Hello,
This isn't possible with imapfilter's current simplified configuration
format.
By 'current' are you implying it will eventually ;)
Post by Lefteris Chatzimparmpas
You have to combine 3 contain_field() calls with the '+' operator as
stated in the manual page. You could use a Lua for loop to avoid
repetition, but just for 3 calls it's probably not worth it.
Actually I didn't elude to this in my example but it's 6 since it's 2
accounts three times. But I can live with that.

So if I continue down this path I should prob. learn at least some basic
lua ?

Thanks,
Phil
Post by Lefteris Chatzimparmpas
Post by Philippe LeCavalier
How can I list multiple fields in the same argument?
results = acc2['Sent']:contain_field('to,from,cc', 'email_address')
results:copy_messages(acc1['Customers/acc2/help/Sent'])
The 'to,from,cc' doesn't work for grabbing the relevant mail. If I state
a rule for each field it works fine. I take it my angle for shortening
this rule isn't appropriate but there must be a way.
Thanks,
Phil
_______________________________________________
Imapfilter-devel mailing list
Imapfilter-devel at lists.hellug.gr
http://lists.hellug.gr/mailman/listinfo/imapfilter-devel
Lefteris Chatzimparmpas
2011-01-18 21:13:45 UTC
Permalink
Post by Philippe LeCavalier
Actually I didn't elude to this in my example but it's 6 since it's 2
accounts three times. But I can live with that.
I think it's not worth it to do if you're only searching through 3
fields in 2 accounts... If you do that for more fields or more accounts
you could use for loops and define your own functions.
Post by Philippe LeCavalier
So if I continue down this path I should prob. learn at least some basic
lua ?
It depends on the complexity of the things you want to accomplish. If
you want to do simple things (as in the sample.config.lua or manual
page) you shouldn't need much if any Lua at all. It should be only
necessary if you want somehow to extend imapfilter's functionality,
using other Lua modules from inside imapfilter, and so on.

Continue reading on narkive:
Loading...