[imapfilter-devel] archiving function not working
Joel CARNAT
joel at carnat.net
Fri Jun 3 22:28:50 EEST 2005
Hi,
I already done a sorting function that takes mail from INBOX and store
them is "subdirectory" according to the date. Now I would like to do the
same with mail already stored in various folders but it doesn't work :(
Here's what I have :
INBOX
|-ML
|-family
|- ...
When I decide mails don't have to stay in INBOX, I manually move them in
the various folders. Now I would like imapfilter to take the mails (from
ML, familly, ...) into time-stamped folders.
Here's what I want :
INBOX
|-ML
|-family
|- ...
|-2005
| |-June
| | |-ML
| | |-family
| | |- ...
My initial function is :
function horoMove(account, mbox, filter, destination)
results = match(account, mbox, filter)
if results ~= nil then
headers = fetchheaders(account, mbox,{ 'date ' }, results)
if headers ~= nil then
for ID, HDR in pairs(headers) do
_, _, _, _, _, month, year = string.find(HDR, "Date: (%a+),(%s+)(%d+) (%a+) (%d+)")
if month ~= nil then
move(account, mbox, account, year .. '.' .. month .. '.' .. destination, results)
end
end
end
end
end
Then, I call it this way :
for key,value in { "ML", "family" } do
-- print("$MDIR=" .. value)
horoMove(joel, value, all, value)
end
BTW, filter 'all' is :
all = { }
What it does is :
1. locate all mails in 'value'
2. pretend to COPY (I can still see the correcty generated folders)
3. delete mails from 'value'
Here's a log example :
C (3): 1106 SELECT "INBOX.ML"
S (3): 1106 OK [READ-WRITE] Ok
C (3): 1107 UID COPY 1:14 "INBOX.2005.Mar.ML"
S (3): 1107 OK COPY completed.
C (3): 1108 CLOSE
S (3): 1108 OK mailbox closed.
C (3): 1109 SELECT "INBOX.ML"
S (3): 1109 OK [READ-WRITE] Ok
C (3): 110A UID STORE 1:14 +FLAGS.SILENT (\Deleted)
S (3): 110A OK STORE completed.
C (3): 110B EXPUNGE
S (3): 110B OK EXPUNGE completed
C (3): 110C CLOSE
S (3): 110C OK mailbox closed.
14 messages moved from joel at carnat.net@mail.tumfatig.net/ML to
joel at carnat.net@mail.tumfatig.net/2005.Mar.ML.
Anyone can see why my function don't work the right way ?
The function is OK when called the following way :
horoMove(joel, 'INBOX', spam, "spam")
TIA,
Jo
--
,- This mail runs ------.
`--------- NetBSD/i386 -'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
URL: <http://lists.hellug.gr/pipermail/imapfilter-devel/attachments/20050603/4d70254d/attachment.pgp>
More information about the Imapfilter-devel
mailing list