From bf9bfe407a32d114df69e49c7bdeab2e4511df7c Mon Sep 17 00:00:00 2001 From: "mkmelin+mozilla%iki.fi" Date: Thu, 15 May 2008 08:19:48 +0000 Subject: [PATCH] Bug 433405 - itemAdded event not called when a message is sent or draft is saved p=Siddharth Agarwal [:sid0] r+sr=bienvenu git-svn-id: svn://10.0.0.236/trunk@251635 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/mailnews/local/src/nsLocalMailFolder.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mozilla/mailnews/local/src/nsLocalMailFolder.cpp b/mozilla/mailnews/local/src/nsLocalMailFolder.cpp index 92eeff04475..1d74cb2b12c 100644 --- a/mozilla/mailnews/local/src/nsLocalMailFolder.cpp +++ b/mozilla/mailnews/local/src/nsLocalMailFolder.cpp @@ -2467,11 +2467,11 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndCopy(PRBool copySucceeded) mCopyState->m_parseMsgState->ParseAFolderLine(CRLF, MSG_LINEBREAK_LEN); } + nsCOMPtr newHdr; // CopyFileMessage() and CopyMessages() from servers other than mailbox if (mCopyState->m_parseMsgState) { nsCOMPtr msgDb; - nsCOMPtr newHdr; mCopyState->m_parseMsgState->FinishHeader(); GetDatabaseWOReparse(getter_AddRefs(msgDb)); if (msgDb) @@ -2564,6 +2564,8 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndCopy(PRBool copySucceeded) } } + // Store whether the message is CopyMessages() or CopyFileMessage() + PRBool isCopyFileMessage = ! mCopyState->m_message; if(!mCopyState->m_isMove) { if (multipleCopiesFinished) @@ -2588,6 +2590,13 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndCopy(PRBool copySucceeded) EnableNotifications(allMessageCountNotifications, PR_TRUE, PR_FALSE /*dbBatching*/); //dest folder doesn't need db batching } } + // if CopyFileMessage() then notify that an item has been added + if (isCopyFileMessage) + { + nsCOMPtr notifier = do_GetService(NS_MSGNOTIFICATIONSERVICE_CONTRACTID); + if (notifier) + notifier->NotifyItemAdded(newHdr); + } } return rv; }