[imapfilter-devel] Re: can't solve "table expected, got nil"

Joel CARNAT joel at carnat.net
Wed Aug 18 15:57:48 EEST 2004


C'est alors (le Tue, 17 Aug 2004 18:10:27 -0500) que David DeSimone <fox at verio.net> dit :

> Joel CARNAT <joel at carnat.net> wrote:
> 
> Well, that is exactly what it says... if the results are nil, don't do
> the ACTION.
> 

I meant without the whole 'if' process :)
Like, consecutives lines (without blank lines) are done only if the previous one exited with errorcode 0, or such :)

> However, I think you would be better served if you just wrote your own
> function, and it would also reduce the amount of repetition in your own
> script.  For example:
> 
> 
>     function delete_matching(account, mbox, query)
> 
> 	results = match(account, mbox, query)
> 
> 	if (results ~= nil)
> 	then
> 	    delete(account, mbox, results)
> 	end
> 
>     end
> 
> Then you can just call delete_matching() 20 times with your 20 queries.
> You know...  I think I will do this in my configuration, as I have a lot of
> these if-statements, too.  :)
> 

woaw... that's what I wrote and it simply r0cks :)
***********************************************************************
-- FUNCTION : try to move only when matched
function myMove(account, mbox, filter, destination)
        -- find mail in $mbox from $filter on $account
        -- any anything is found, move it to $destination
        results = match(account, mbox, filter)
        if results ~= nil then
                move(account, mbox, account, destination, results)
        end
end

-- Move machine status report
myMove(account, 'INBOX', tumfatig_net, 'tumfatig_net')

-- Move SPAM alerts
myMove(account, 'INBOX', spam, 'tumfatig_net.SPAM_and_Virus')

-- Move VIRUS alerts
myMove(account, 'INBOX', virus, 'tumfatig_net.SPAM_and_Virus')
***********************************************************************

why don't we learn LUA instead of JAVA at University... :p

> 
> I have had quite some trouble using "body" matches with my IMAP server. 
> I don't know if that's the trouble you are having.  But I find that if I
> specify a search clause like 'body "on firewall02,"' it will not match,
> whereas a clause like 'body "firewall02,"' will match.  And yet, the
> email that matches contains this line:
> 

I never tried body search :p yet... I only did from&subject.
They seem to work well... The only boring thing in the lack of easy regexp use.
Instead of "VIRUS.*FROM" I have to have "{ invert = true, 'from "postmaster"', 'subject "VIRUS"', 'subject "FROM"' },".
It's a bit strange (when used to using regexp ;) but it works.

The subject searches work ('subject "** PROBLEM alert -"') ; the space doesn't seem to trouble imapfilter...

I was only used to using procmail, but imapfilter is ver flexible.
I'm surprised there no more links (and ads) on the Web...
This is definitively better than sylpheed-claws or thunderbird filtering.
Nice jobs authors !

Now I hope imapfilter will soon be able to answer all my mails so I can take a nap :)))
Cheers,
	Jo




More information about the Imapfilter-devel mailing list