[panorama] Implement CopyHdrFromExistingHdr for PerFolderDatabase
Categories
(MailNews Core :: Database, task)
Tracking
(Not tracked)
People
(Reporter: babolivier, Unassigned)
References
(Blocks 1 open bug)
Details
Should be pretty straightforward (though a bit boilerplatey): build a new RawHdr from the input's value and chuck it to AddMsgHdr.
| Reporter | ||
Comment 1•28 days ago
•
|
||
Actually, it seems like consumers expect the return value to be a detached nsIMsgDBHdr, so this would be creating a DetachedMessage instead of adding it to the messages table.
Comment 2•27 days ago
|
||
Adding the cloned header to the database is an optional bool param: addHdrToDB.
It probably should also clear some of the header fields - The storeToken and the server-side message ID (UID for IMAP/news, ItemId for exchange/graph).
CopyHdrFromExistingHdr() also accepts an nsMsgKey param to use for the new header, which Panorama won't support.
Most callers use nsMsgKey_None (which means "let the DB assign the key"), but there are still a bunch of places that expect to be able to force it.
So we'll need to purge those cases.
An example is nsImapOfflineTxn: when deleting a message it uses CopyHdrFromExistingHdr() to copy the about-to-be-deleted header to a detached header. If the Undo() is performed, the copy is shoved back into the database. Because the key is (currently) also the UID, it has to preserve it. Once UIDs and nsMsgKeys are properly separated, I don't think there's any real reason to keep the same key after an undo.
(that said, you can order messages in the GUI by nsMsgKey (the "order received" column)... and assigning a new key after an undo would screw that up. But I don't think I care :- )
While we're at it, I'd probably also get rid of the addHdrToDB param, and make it the responsibility of the caller to actually add the new header to the DB.
Description
•