Open Bug 1956980 Opened 9 months ago Updated 6 months ago

Remove redundant nsICopyMessageListener .startMessage() and .endMessage() callbacks

Categories

(MailNews Core :: Backend, task)

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: benc, Assigned: benc)

References

(Blocks 1 open bug)

Details

(Keywords: leave-open)

Attachments

(2 files)

When copying messages (using messageservice copyMessage[s]()) the general nsICopyMessageListener callback sequence is:

  1. beginCopy() - at the start of each message
  2. copyData() - as many times as required to transfer the message data
  3. endCopy() - at the end of the message

.startMessage() is called only when copying a single message from local folder to local folder.

The current functionality in nsMsgLocalMailFolder::StartMessage() can easily be rolled into the .beginCopy() handling, but there are a whole bunch of tricky single-vs-multiple message copy issues. mCopyState->m_curCopyIndex acts differently if mCopyState->m_copyingMultipleMessages is set - there's a whole bunch of needless voodoo in there to iron out.

The non-local (IMAP, EWS) implementations of .startMessage() are no-ops, so can be ditched without problem.

.endMessage() doesn't seem to be used at all.

The attached patch is a partial roadmap. It removes the callbacks and redundant code, but gets tripped up on m_curCopyIndex.

.endMove() could be looked at too - it's called for moves, invoked right after .endCopy(), but only for certain combinations of source and dest folder types.

Assignee: nobody → benc
Status: NEW → ASSIGNED

Pushed by vineet@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/28a0bce02166
Remove redundant var in nsLocalMailCopyState. r=mkmelin

(In reply to Ben Campbell from comment #0)

.endMessage() doesn't seem to be used at all.

OK, that's not quite true.
Looks like .endMessage() is called when it copies (or moves) multiple messages from a IMAP folder into a local folder.
It's not used for single-message operations.

(In reply to Ben Campbell from comment #0)

.startMessage() is called only when copying a single message from local folder to local folder.

This is wrong too. .startMessage() is called when it copies (or moves) multiple messages into a local folder from either local or IMAP.
But not for single-message copies/moves.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: