[imapfilter-devel] move/copy problem
Michael M. Tung
michael.m.tung at gmail.com
Fri Jul 16 20:30:14 EEST 2010
Hi Lefteris:
Thank you for all your suggestions.
I guess the problem was that some text messages were empty, which gave an
'required argument left out' error. Both systems I mentioned have identical
software, but one is 32bit and the other 64bit. Maybe the byte size made a
difference in the tables and produced the different occurrence of this error?
For other people interested, I am attaching the definition of a bogofilter
function which now works fine.
Best,
Mike
--------------------
-- Bogofilter --
--------------------
function bogo(myserver)
print(string.format("Running bogofilter on %s...", myserver._imap.server))
all = myserver.INBOX:select_all()
spam = Set {}
unsure = Set {}
for _, mesg in ipairs(all) do
mbox, uid = unpack(mesg)
text = mbox[uid]:fetch_message()
if(text ~= nil ) then
flag = pipe_to('bogofilter', text)
if (flag == 0) then
table.insert(spam, mesg)
elseif (flag == 2) then
table.insert(unsure, mesg)
end
end
end
myserver.INBOX:move_messages(myserver.Junk, spam)
myserver.INBOX:move_messages(myserver.Unsure, unsure)
end
Lefteris Chatzimparmpas [lefcha at hellug.gr] wrote:
> On 07/01/2010 09:55 PM, Michael M. Tung wrote:
> >Hi all,
> >
> >I found a work around to my previous problem, which nevertheless I still don't
> >understand since the copy_messages command in the old script erroneously reports
> >that files are copied.
>
> See my other mail; we might find out something from that. See also below my
> further comments...
>
> >
> >Now I am using the following code
> >
> >------------------------------------------------------------------------
> >
> >all = myserver.INBOX:select_all()
> >spam = Set {}
> >unsure = Set {}
> > for _, mesg in ipairs(all) do
> > mbox, uid = unpack(mesg)
> > text = mbox[uid]:fetch_message()
> > flag = pipe_to('bogofilter', text)
> > if (flag == 0) then
> > table.insert(spam, mesg)
> > elseif (flag == 2) then
> > table.insert(unsure, mesg)
> > end
> > end
> >
> >myserver['INBOX']:move_messages(myserver['Junk'], spam)
> >myserver['INBOX']:copy_messages(myserver['Junk/Unsure'], unsure)
>
> These two lines should/could be:
>
> spam:move_messages(myserver['Junk'])
> unsure:copy_messages(myserver['Junk/Unsure'])
>
> >
> >------------------------------------------------------------------------
> >
> >However, I am running exactly this same config on two different machines
> >(with identical versions IMAPFilter 2.2.2, bogofilter v1.2.1 and
> >Oracle Berkeley db 4.7.25). On one machine it works as expected and the
> >other machine gives the error:
> >
> >imapfilter: bogotest5.lua:26: required argument left out
>
> Hm, this is strange...
>
> >
> >Line 26 is the line containing "flag = pipe_to('bogofilter', text)".
> >What is going wrong here???
>
> Maybe you can print the print(text) variable before passing it to bogofilter...
>
> >
> >Any hint to solve this mystery is appreciated.
> >Best,
> > Mike
> _______________________________________________
> Imapfilter-devel mailing list
> Imapfilter-devel at lists.hellug.gr
> http://lists.hellug.gr/mailman/listinfo/imapfilter-devel
--
-------------------------------------------------------------------------
Dr. Michael M. Tung Email: mtung at mat.upv.es
Departamento de Matemática Aplicada michael.m.tung at gmail.com
Universidad Politécnica de Valencia Phone: +34 96 38-79557 (IMM)
Inst. de Matemática Multidisciplinar +34 96 38-79777 (Teleco)
Edificio 8-G, 2º piso IM: ICQ96423950
Camino de Vera, s/n https://talos.tlc.upv.es
46022 Valencia (Spain)
-------------------------------------------------------------------------
PGP PubKey http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x9920E3BA
-------------------------------------------------------------------------
More information about the Imapfilter-devel
mailing list