-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
duplicate handling #106
Comments
OK, so I started doing my own de-dup'ing in lua. I have no lua experience, but with a little googling, it looks like the following should be close to right:
At this stage, I don't know how to delete a message when I have it outside the context of a result-set? |
First I am interested to know more about the copy operation failing, such as a debug file output. You can get a debug file with Then regarding deleting duplicates; your example looks very nice, and you can see examples of how to construct a messages set in order to use it to delete the duplicate message in the https://github.com/lefcha/imapfilter/blob/master/samples/extend.lua file. Specifically the 2nd example there is what you want to do. But I'll just summarize here that you need to do more or less something like: results = Set {}
for _, message in ipairs(messages) do
mailbox, uid = table.unpack(message)
messageId = mailbox[uid]:fetch_header('Message-Id')
if seen[messageId] then
table.insert(results, uid)
else
seen[messageId] = true
end
end
results:delete_messages() |
There's a sanitised debug log here, starting after the bit full of message content data, and with user/domain/folder names removed: https://gist.github.com/mc0e/d70dae9f639637c0f8c7 It'd be nice if the standard copy operation abstracted out behaviour behind the scenes where it's broken into batches of some maximum number of messages. It'd be nice if those were flagged for deletion at each step's completion. I'm just about to have another go at the lua for removing the duplicates, so nothing to add there yet. |
Regarding the problem with the options.limit = 50 |
I wound up implementing my own batch processing as follows:
|
Well that is already implemented inside imapfilter in As a workaround for servers that can't cope with that, there is the options.limit = 50 That's why I suggested you use that, in order to overcome the problems with the |
I've just been trying out I don't see options.limit in the documentation. Seems like it probably should be there. Also seems to me that it you set a timeout by default, then that implies that the limit should also be set. The size of a task that can be sent to the server might not be limited, but the size of a task that can complete in finite time is. |
What do you mean that it not working for Also, the Regarding not seeing the Also, the For example, let's say imapfilter is sending a request to the IMAP server, then it waits up to |
The above example, that handles duplicate messages, seems to require minor changes with recent version of imapfilter. I use:
|
I've been doing some filtering operations on largish mailboxes, and hit a situation where my copy operation was timing out. imapfilter repeatedly re-attached and failed to complete the copy. I had to kill imapfilter, which left me with a large number of messages that had been copied, but not yet deleted from source.
So what I now want to do is to be able to sort out duplicates, based on the Message-Id header. I imagine it might be possible to do this with some processing in lua, but I don't see explicit support in imapfilter.
What I'd like would be functions like:
It would be possible to calculate
messages:no_duplicates()
usingmessages:select_all() - messages:duplicates()
, but this might be less efficient, and it would be less user-friendly.The text was updated successfully, but these errors were encountered: