Hello,

 I'd like to implement an "undelete" functionality in my client when "trash
folder" model is used. IOW if the user accidentally deletes a message which
means that it's copied to the trash and then deleted and expunged from the
current mailbox, I'd like to allow undeleting it, i.e. copy it back from
the trash (probably also deleting it from there but this is not crucial) to
the current folder.

 Unfortunately I don't see any efficient way to do it because, AFAICS, if I
use mail_copy() I can't get the UID of the new message(s) in the trash and
so I don't know how to find them there when I need to copy them back. I do
know their MSGNO (they're the last messages in the trash) but it seems
unwise to rely on this as the trash could be modified between delete and
the undelete operations making them invalid (granted, the same could happen
with UIDs too if the UID validity changes but this should be so rare that I
feel safe ignoring this problem).

 So far I see 3 solutions neither of which I really like:

1. Get the message text and store it locally. Then when I need to undelete
   it, use mail_append() to recreate it instead of copying it back from
   trash. The problem here is, of course, that I need to download a
   possibly huge message from the server every time I delete anything even
   though I'll very rarely need this text later (as undeleting is rare).

2. Open trash folder and find the UIDs of the new messages when they're
   appended to it. The problem is that opening the trash takes time too
   especially as it usually has a lot of messages in it (mine is ~200000).
   Appending to it is fast enough so it's not a problem but opening it
   every time certainly would be. So I guess I'd just need to keep it
   opened all the time but I'm not sure if it's a good idea.

3. Don't delete the messages on IMAP server at all when they're deleted but
   just remember this internally and filter the message listing in the
   client itself to hide them from user. Then finally delete and expunge
   them when the mailbox is closed. This seems the most efficient way to do
   it but also very complex and so likely error-prone and it just seems a
   bit stupid to not user server support for this.

 Am I missing some other, better, way? Right now I plan to go with (1)
because normally you don't delete messages without reading them so
hopefully the text had already been downloaded (there is another command
for marking messages as spam so this wouldn't be done for spam). But I'd
like to avoid this if possible.

 Thanks in advance for any ideas,
VZ

Attachment: pgpeA3pDkqLbf.pgp
Description: PGP signature

_______________________________________________
Imap-uw mailing list
Imap-uw@u.washington.edu
http://mailman2.u.washington.edu/mailman/listinfo/imap-uw

Reply via email to