[imapfilter-devel] Improving Filter Writing Effeciency

Philippe LeCavalier support at plecavalier.com
Sat Jan 8 20:17:04 EET 2011


Hi again.

Sorry to bug you. I'm asking this on the list just in case other lua
illiterates may benefit from this...

If I want to encompass more subjects and move them to more mailboxes,
can I do

for _, account in ipairs({ account1, account2 }) do
account.INBOX:contain_subject('[OPEN]'):move_messages(account['help/Open']) +
account.INBOX:contain_subject('[CLOSED]'):move_messages(account['help/Closed'])
end

Is '+' the still the correct syntax to indicate to offlineimap the
operand 'OR'?

Thanks,
Phil

On Sat, 2011-01-08 at 10:34 -0600, Philippe LeCavalier wrote:

> Quoting Lefteris Chatzimparmpas <lefcha at hellug.gr>:
> 
> > Yes, that's correct, you got that right.  For each account it will move
> > messages from its INBOX to its "help/Open" folder.
> 
> Perfect!
> 
> Thanks,
> Phil
> >
> >
> > On 01/08/2011 04:45 PM, Philippe LeCavalier wrote:
> >> Thanks. That's much cleaner. I have one question though...
> >> Quoting Lefteris Chatzimparmpas <lefcha at hellug.gr>:
> >>
> >>> Hello,
> >>>
> >>> You can make use of Lua to accomplish this.  For example one way could
> >>> be:
> >>>
> >>>   for _, account in ipairs({ account1, account2 }) do
> >>>
> >>> account.INBOX:contain_subject('[OPEN]'):move_messages(account['help/Open'])
> >>>
> >>>   end
> >> Can I assume that I'm reading this correctly in that mail for/from
> >> account1 will stay in account1 ie it won't move a msg with subject OPEN
> >> from account1.INBOX to account2.INBOX.help.Open right?
> >>
> >> Pardon my ignorance, I really don't know any form of programming language.
> >>
> >> Thanks,
> >> Phil
> >>>
> >>> You can add more accounts or even write a nice Lua function, and so on.
> >>>
> >>>
> >>> On 01/07/2011 07:49 PM, Philippe LeCavalier wrote:
> >>>> I have 3 IMAP accounts. I'm wondering if I can merge identical filters?
> >>>> ie.
> >>>>
> >>>> --Move Open
> >>>> results = account1.INBOX:contain_subject('[OPEN]')
> >>>> results:move_messages(account1['help/Open'])
> >>>> results = account2.INBOX:contain_subject('[OPEN]')
> >>>> results:move_messages(account2['help/Open'])
> >>>>
> >>>> with something like:
> >>>>
> >>>> --Move Open
> >>>> results = account{1|2}.INBOX:contain_subject('[OPEN]')
> >>>> results:move_messages(account{1|2}1['help/Open'])
> >>>>
> >>>> I know the above syntax is incorrect; it's just for illustration
> >>>> purposes.
> >>>>
> >>>> Any thoughts?
> >>>>
> >>>> Phil
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> Imapfilter-devel mailing list
> >>>> Imapfilter-devel at lists.hellug.gr
> >>>> http://lists.hellug.gr/mailman/listinfo/imapfilter-devel
> >>>
> >>
> > _______________________________________________
> > Imapfilter-devel mailing list
> > Imapfilter-devel at lists.hellug.gr
> > http://lists.hellug.gr/mailman/listinfo/imapfilter-devel
> 
> 
> _______________________________________________
> Imapfilter-devel mailing list
> Imapfilter-devel at lists.hellug.gr
> http://lists.hellug.gr/mailman/listinfo/imapfilter-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hellug.gr/pipermail/imapfilter-devel/attachments/20110108/56b99c90/attachment-0001.html>


More information about the Imapfilter-devel mailing list