19 Oct
2010
19 Oct
'10
7:28 p.m.
On Sat, 2010-09-25 at 13:34 +0100, Timo Sirainen wrote:
But .. I suppose it could be possible to use a combination of attachment-id + mailbox GUID + message UID number. I'll have to think about it..
Implemented. Although saving messages now requires an extra rename(). It should be possible to get rid of this at some point, but for now it works like:
- Attachment saving is first started to a temp file.
- Attachment is written to temp file.
- Attachment writing is finished and file is renamed to <hash>-<guid>
- <possibly more attachments and messages are saved>
- Index is locked, so new messages can be assigned IMAP UIDs
- Attachments are renamed from <hash>-<guid> to <hash>-<guid>-<mailbox_guid>-<imap_uid>
- Index is unlocked
(Getting rid of step 3 would require some FS API changes.)
Copying works basically the same:
- Source file's attachments are linked to a temp file in destination.
- <possibly more attachments and messages are copied>
- Index is locked, so new messages can be assigned IMAP UIDs
- Attachments are renamed from temp files to <hash>-<guid>-<mailbox_guid>-<imap_uid>
- Index is unlocked
The attachment paths in dbox metadata contain only the <hash>-<guid> part, so when accessing any attachments the <mailbox_guid>-<imap_uid> must be manually appended to the path.