Having UID expunge support would still be awesome though.
Thanks very much for your contribution and apologies for taking so long to get back to you.
I'd love to see support for MOVE.
It's ugly but it works. Future versions of IMAPClient probably won't depend on imaplib. When that happens the nasty patching can go.
I can achieve the semantics I want with:
COPY m other_folder
UID EXPUNGE m
(UID EXPUNGE is desirable to avoid expunging every deleted message in a folder).
So I put together this change to allow for UID EXPUNGE, based on the 1.x branch:
The idea is to overload arguments to expunge(): if messages are specified, do a 'UID EXPUNGE <messages>', else it is a folder-wide expunge(). The former won't work if use_uid=False. I don't have insight how many IMAPClient users turn off uid's.
I don't think many people use `use_uid=False`. What you've done looks sensible to me.
This also implements item on the list for https://github.com/mjs/imapclient/issues/36
That change also adds a livetest, which asserts that only the specified message is expunged, and other Deleted messages remain.
Thank you very much for taking the time to do the live test too.
If that change is within the ethos of the project, I'll submit a PR (to 1.x? master?). Otherwise, I'd like to figure out a way to achieve MOVE without a global expunge.
Your approach looks good. Please submit a PR. Against 1.x is fine - I can take care of forward porting it if you like.
If you have the time to do a PR for MOVE as well, that would be amazing. It's worth having both MOVE and UID EXPUNGE support.
PS - I'm unsure what should be the return type from UID expunge. It's currently None, but should probably be whatever is the response payload, but I haven't sorted out the helper methods needed to achieve that. If the change is on the right track, I'll try to figure that out.
_command_and_check() should be giving you the response string so I'm not sure why you're not seeing anything. Perhaps set `debug=True` and see what the server is returning?
inbox@... :: http://menno.io/