зеркало из https://github.com/mozilla/pjs.git
fix line endings when delete/detach of imap attachments on mac/linux with cyrus server, sr=mscott
This commit is contained in:
Родитель
4d042b226b
Коммит
2f8dd32d44
|
@ -71,7 +71,7 @@ typedef long nsMsgBiffState;
|
|||
// enumerated type for determining if a message has been replied to, forwarded, etc.
|
||||
typedef long nsMsgDispositionState;
|
||||
|
||||
[scriptable, uuid(a7555ae2-78a4-40ed-b49f-744ad42b6f2d)]
|
||||
[scriptable, uuid(fb7f256b-905c-4185-ad27-31662f7d82eb)]
|
||||
interface nsIMsgFolder : nsICollection {
|
||||
|
||||
const nsMsgBiffState nsMsgBiffState_NewMail = 0; // User has new mail waiting.
|
||||
|
@ -468,4 +468,7 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
|
|||
|
||||
readonly attribute boolean inVFEditSearchScope;
|
||||
void setInVFEditSearchScope(in boolean aSearchThisFolder, in boolean aSetOnSubFolders);
|
||||
void copyDataToOutputStreamForAppend(in nsIInputStream aIStream,
|
||||
in long aLength, in nsIOutputStream outputStream);
|
||||
void copyDataDone();
|
||||
};
|
||||
|
|
|
@ -2517,6 +2517,7 @@ nsDelAttachListener::OnStopRequest(nsIRequest * aRequest, nsISupports * aContext
|
|||
// We now start to copy the processed message from the temporary file
|
||||
// back into the message store, replacing the original message.
|
||||
|
||||
mMessageFolder->CopyDataDone();
|
||||
if (NS_FAILED(aStatusCode))
|
||||
return aStatusCode;
|
||||
|
||||
|
@ -2524,9 +2525,6 @@ nsDelAttachListener::OnStopRequest(nsIRequest * aRequest, nsISupports * aContext
|
|||
// This is called before OnStopRunningUrl().
|
||||
nsresult rv;
|
||||
|
||||
// all attachments refer to the same message
|
||||
const char * messageUri = mAttach->mAttachmentArray[0].mMessageUri;
|
||||
|
||||
// copy the file back into the folder. Note: if we set msgToReplace then
|
||||
// CopyFileMessage() fails, do the delete ourselves
|
||||
nsCOMPtr<nsIMsgCopyServiceListener> listenerCopyService;
|
||||
|
@ -2536,43 +2534,12 @@ nsDelAttachListener::OnStopRequest(nsIRequest * aRequest, nsISupports * aContext
|
|||
mMsgFileStream = nsnull;
|
||||
mMsgFileSpec->CloseStream();
|
||||
mNewMessageKey = PR_UINT32_MAX;
|
||||
rv = mMessageFolder->CopyFileMessage(
|
||||
return mMessageFolder->CopyFileMessage(
|
||||
mMsgFileSpec, // fileSpec
|
||||
nsnull, // msgToReplace
|
||||
PR_FALSE, // isDraft
|
||||
mMsgWindow, // msgWindow
|
||||
listenerCopyService); // listener
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
// only if the currently selected message is the one that we are about to delete then we
|
||||
// change the selection to the new message that we just added. Failures in this code are not fatal.
|
||||
// Note that can only do this if we have the new message key, which we don't always get from IMAP.
|
||||
if (mNewMessageKey != PR_UINT32_MAX && mMsgWindow)
|
||||
{
|
||||
nsXPIDLCString displayUri;
|
||||
mMessenger->GetLastDisplayedMessageUri(getter_Copies(displayUri));
|
||||
if (displayUri.Equals(messageUri))
|
||||
{
|
||||
mMessageFolder->GenerateMessageURI(mNewMessageKey, getter_Copies(displayUri));
|
||||
if (displayUri)
|
||||
{
|
||||
mMsgWindow->SelectMessage(displayUri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// delete the original message
|
||||
nsCOMPtr<nsISupportsArray> messageArray;
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(messageArray));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = messageArray->AppendElement(mOriginalMessage);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
return mMessageFolder->DeleteMessages(
|
||||
messageArray, // messages
|
||||
mMsgWindow, // msgWindow
|
||||
PR_TRUE, // deleteStorage
|
||||
PR_TRUE, // isMove
|
||||
listenerCopyService, // listener
|
||||
PR_FALSE); // allowUndo
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -2586,13 +2553,7 @@ nsDelAttachListener::OnDataAvailable(nsIRequest * aRequest, nsISupports * aSuppo
|
|||
{
|
||||
if (!mMsgFileStream)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
// the 'correct' way is something like creating a stream converter that calls a
|
||||
// mime converter which we pass stuff to and it will modify the stream for us.
|
||||
// I haven't got that bit working yet so at the moment we just write the message
|
||||
// out raw to the file.
|
||||
|
||||
PRUint32 uiWritten;
|
||||
return mMsgFileStream->WriteFrom(aInStream, aCount, &uiWritten);
|
||||
return mMessageFolder->CopyDataToOutputStreamForAppend(aInStream, aCount, mMsgFileStream);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -2610,6 +2571,22 @@ nsDelAttachListener::OnStartRunningUrl(nsIURI * aUrl)
|
|||
NS_IMETHODIMP
|
||||
nsDelAttachListener::OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode)
|
||||
{
|
||||
// check if we've deleted the original message, and we know the new msg id.
|
||||
if (!mOriginalMessage && mNewMessageKey != PR_UINT32_MAX && mMsgWindow)
|
||||
{
|
||||
nsXPIDLCString displayUri;
|
||||
// all attachments refer to the same message
|
||||
const char * messageUri = mAttach->mAttachmentArray[0].mMessageUri;
|
||||
mMessenger->GetLastDisplayedMessageUri(getter_Copies(displayUri));
|
||||
if (displayUri.Equals(messageUri))
|
||||
{
|
||||
mMessageFolder->GenerateMessageURI(mNewMessageKey, getter_Copies(displayUri));
|
||||
if (displayUri)
|
||||
{
|
||||
mMsgWindow->SelectMessage(displayUri);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2650,8 +2627,38 @@ nsDelAttachListener::GetMessageId(nsCString * aMessageId)
|
|||
NS_IMETHODIMP
|
||||
nsDelAttachListener::OnStopCopy(nsresult aStatus)
|
||||
{
|
||||
// never called?
|
||||
return aStatus;
|
||||
// only if the currently selected message is the one that we are about to delete then we
|
||||
// change the selection to the new message that we just added. Failures in this code are not fatal.
|
||||
// Note that can only do this if we have the new message key, which we don't always get from IMAP.
|
||||
// delete the original message
|
||||
if (NS_FAILED(aStatus))
|
||||
return aStatus;
|
||||
|
||||
if (mOriginalMessage)
|
||||
{
|
||||
|
||||
nsCOMPtr<nsISupportsArray> messageArray;
|
||||
nsresult rv = NS_NewISupportsArray(getter_AddRefs(messageArray));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = messageArray->AppendElement(mOriginalMessage);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
nsCOMPtr<nsIMsgCopyServiceListener> listenerCopyService;
|
||||
|
||||
QueryInterface( NS_GET_IID(nsIMsgCopyServiceListener), getter_AddRefs(listenerCopyService) );
|
||||
|
||||
rv = mMessageFolder->DeleteMessages(
|
||||
messageArray, // messages
|
||||
mMsgWindow, // msgWindow
|
||||
PR_TRUE, // deleteStorage
|
||||
PR_TRUE, // isMove
|
||||
listenerCopyService, // listener
|
||||
PR_FALSE); // allowUndo
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mOriginalMessage = nsnull;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -2499,7 +2499,7 @@ nsMsgDBView::ApplyCommandToIndices(nsMsgViewCommandTypeValue command, nsMsgViewI
|
|||
}
|
||||
|
||||
if (flags != kNoImapMsgFlag || commandIsLabelSet) // can't get here without thisIsImapThreadPane == TRUE
|
||||
imapFolder->StoreImapFlags(flags, addFlags, imapUids.GetArray(), imapUids.GetSize());
|
||||
imapFolder->StoreImapFlags(flags, addFlags, imapUids.GetArray(), imapUids.GetSize(), nsnull);
|
||||
|
||||
}
|
||||
|
||||
|
@ -4523,6 +4523,12 @@ PRInt32 nsMsgDBView::FindLevelInThread(nsIMsgDBHdr *msgHdr, nsMsgViewIndex start
|
|||
NS_ERROR("msgKey == parentKey, or GetMsgHdrForKey failed, this used to be an infinte loop condition");
|
||||
curMsgHdr = nsnull;
|
||||
}
|
||||
else
|
||||
{
|
||||
// need to update msgKey so the check for a msgHdr with matching
|
||||
// key+parentKey will work after first time through loop
|
||||
curMsgHdr->GetMessageKey(&msgKey);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,8 @@ NS_IMETHODIMP nsMsgQuickSearchDBView::DoCommand(nsMsgViewCommandTypeValue aComma
|
|||
|
||||
nsCOMPtr<nsIMsgImapMailFolder> imapFolder = do_QueryInterface(m_folder);
|
||||
if (NS_SUCCEEDED(rv) && imapFolder)
|
||||
rv = imapFolder->StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, m_keys.GetArray(), m_keys.GetSize());
|
||||
rv = imapFolder->StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, m_keys.GetArray(),
|
||||
m_keys.GetSize(), nsnull);
|
||||
|
||||
m_db->SetSummaryValid(PR_TRUE);
|
||||
m_db->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
|
|
|
@ -4327,6 +4327,21 @@ nsMsgDBFolder::CopyFileMessage(nsIFileSpec* fileSpec,
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDBFolder::CopyDataToOutputStreamForAppend(nsIInputStream *aInStream,
|
||||
PRInt32 aLength, nsIOutputStream *aOutputStream)
|
||||
{
|
||||
if (!aInStream)
|
||||
return NS_OK;
|
||||
|
||||
PRUint32 uiWritten;
|
||||
return aOutputStream->WriteFrom(aInStream, aLength, &uiWritten);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDBFolder::CopyDataDone()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDBFolder::MatchName(nsString *name, PRBool *matches)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(matches);
|
||||
|
|
|
@ -3110,7 +3110,8 @@ nsMsgComposeSendListener::RemoveCurrentDraftMessage(nsIMsgCompose *compObj, PRBo
|
|||
if (num != PRInt32(nsMsgKey_None))
|
||||
{
|
||||
messageID.Add(num);
|
||||
rv = imapFolder->StoreImapFlags(kImapMsgDeletedFlag, PR_TRUE, messageID.GetArray(), messageID.GetSize());
|
||||
rv = imapFolder->StoreImapFlags(kImapMsgDeletedFlag, PR_TRUE, messageID.GetArray(),
|
||||
messageID.GetSize(), nsnull);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ nsresult nsMsgMdnGenerator::StoreMDNSentFlag(nsIMsgFolder *folder,
|
|||
nsMsgKeyArray keyArray;
|
||||
keyArray.Add(key);
|
||||
return imapFolder->StoreImapFlags(kImapMsgMDNSentFlag, PR_TRUE,
|
||||
keyArray.GetArray(), keyArray.GetSize());
|
||||
keyArray.GetArray(), keyArray.GetSize(), nsnull);
|
||||
}
|
||||
|
||||
PRBool nsMsgMdnGenerator::ProcessSendMode()
|
||||
|
|
|
@ -76,7 +76,7 @@ interface nsIMsgImapFolderProps : nsISupports {
|
|||
};
|
||||
|
||||
|
||||
[scriptable, uuid(FBFEBE79-C1DD-11d2-8A40-0060B0FC04D2)]
|
||||
[scriptable, uuid(ba8ddecd-4814-4757-9a15-028157cdabb3)]
|
||||
interface nsIMsgImapMailFolder : nsISupports {
|
||||
void removeSubFolder(in nsIMsgFolder folder);
|
||||
void createClientSubfolderInfo(in string folderName, in wchar hierarchyDelimiter, in long flags, in boolean suppressNotification);
|
||||
|
@ -88,7 +88,8 @@ interface nsIMsgImapMailFolder : nsISupports {
|
|||
void renameClient(in nsIMsgWindow msgWindow, in nsIMsgFolder msgFolder, in string oldName, in string newName);
|
||||
|
||||
// these are used for offline synchronization
|
||||
void storeImapFlags(in long flags, in boolean addFlags, [array, size_is (numKeys)] in nsMsgKey keysToFlag, in unsigned long numKeys);
|
||||
void storeImapFlags(in long aFlags, in boolean aAddFlags, [array, size_is (aNumKeys)]
|
||||
in nsMsgKey aKeysToFlag, in unsigned long aNumKeys, in nsIUrlListener aUrlListener);
|
||||
void setImapFlags(in string uids, in long flags, out nsIURI url);
|
||||
void replayOfflineMoveCopy([array, size_is (numKeys)] in nsMsgKey keys, in unsigned long numKeys, in boolean isMove, in nsIMsgFolder aDstFolder,
|
||||
in nsIUrlListener aUrlListener, in nsIMsgWindow aWindow);
|
||||
|
|
|
@ -1811,9 +1811,9 @@ nsImapMailFolder::AddMessageDispositionState(nsIMsgDBHdr *aMessage, nsMsgDisposi
|
|||
messageIDs.Add(msgKey);
|
||||
|
||||
if (aDispositionFlag == nsIMsgFolder::nsMsgDispositionState_Replied)
|
||||
StoreImapFlags(kImapMsgAnsweredFlag, PR_TRUE, messageIDs.GetArray(), messageIDs.GetSize());
|
||||
StoreImapFlags(kImapMsgAnsweredFlag, PR_TRUE, messageIDs.GetArray(), messageIDs.GetSize(), nsnull);
|
||||
else if (aDispositionFlag == nsIMsgFolder::nsMsgDispositionState_Forwarded)
|
||||
StoreImapFlags(kImapMsgForwardedFlag, PR_TRUE, messageIDs.GetArray(), messageIDs.GetSize());
|
||||
StoreImapFlags(kImapMsgForwardedFlag, PR_TRUE, messageIDs.GetArray(), messageIDs.GetSize(), nsnull);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1830,7 +1830,7 @@ nsImapMailFolder::MarkMessagesRead(nsISupportsArray *messages, PRBool markRead)
|
|||
rv = BuildIdsAndKeyArray(messages, messageIds, keysToMarkRead);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
StoreImapFlags(kImapMsgSeenFlag, markRead, keysToMarkRead.GetArray(), keysToMarkRead.GetSize());
|
||||
StoreImapFlags(kImapMsgSeenFlag, markRead, keysToMarkRead.GetArray(), keysToMarkRead.GetSize(), nsnull);
|
||||
rv = GetDatabase(nsnull);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
|
@ -1850,7 +1850,7 @@ nsImapMailFolder::SetLabelForMessages(nsISupportsArray *aMessages, nsMsgLabelVal
|
|||
nsMsgKeyArray keysToLabel;
|
||||
nsresult rv = BuildIdsAndKeyArray(aMessages, messageIds, keysToLabel);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
StoreImapFlags((aLabel << 9), PR_TRUE, keysToLabel.GetArray(), keysToLabel.GetSize());
|
||||
StoreImapFlags((aLabel << 9), PR_TRUE, keysToLabel.GetArray(), keysToLabel.GetSize(), nsnull);
|
||||
rv = GetDatabase(nsnull);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
|
@ -1871,7 +1871,8 @@ nsImapMailFolder::MarkAllMessagesRead(void)
|
|||
EnableNotifications(allMessageCountNotifications, PR_TRUE, PR_TRUE /*dbBatching*/);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, thoseMarked.GetArray(), thoseMarked.GetSize());
|
||||
rv = StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, thoseMarked.GetArray(),
|
||||
thoseMarked.GetSize(), nsnull);
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
}
|
||||
}
|
||||
|
@ -1889,7 +1890,8 @@ NS_IMETHODIMP nsImapMailFolder::MarkThreadRead(nsIMsgThread *thread)
|
|||
rv = mDatabase->MarkThreadRead(thread, nsnull, &thoseMarked);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, thoseMarked.GetArray(), thoseMarked.GetSize());
|
||||
rv = StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, thoseMarked.GetArray(),
|
||||
thoseMarked.GetSize(), nsnull);
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
}
|
||||
}
|
||||
|
@ -1948,7 +1950,8 @@ nsImapMailFolder::MarkMessagesFlagged(nsISupportsArray *messages, PRBool markFla
|
|||
rv = BuildIdsAndKeyArray(messages, messageIds, keysToMarkFlagged);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = StoreImapFlags(kImapMsgFlaggedFlag, markFlagged, keysToMarkFlagged.GetArray(), keysToMarkFlagged.GetSize());
|
||||
rv = StoreImapFlags(kImapMsgFlaggedFlag, markFlagged, keysToMarkFlagged.GetArray(),
|
||||
keysToMarkFlagged.GetSize(), nsnull);
|
||||
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
}
|
||||
return rv;
|
||||
|
@ -2229,9 +2232,11 @@ NS_IMETHODIMP nsImapMailFolder::DeleteMessages(nsISupportsArray *messages,
|
|||
}
|
||||
}
|
||||
}
|
||||
nsCOMPtr <nsIUrlListener> urlListener = do_QueryInterface(listener);
|
||||
if (deleteMsgs)
|
||||
messageFlags |= kImapMsgSeenFlag;
|
||||
rv = StoreImapFlags(messageFlags, deleteMsgs, srcKeyArray.GetArray(), srcKeyArray.GetSize());
|
||||
rv = StoreImapFlags(messageFlags, deleteMsgs, srcKeyArray.GetArray(),
|
||||
srcKeyArray.GetSize(), urlListener);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
@ -2989,8 +2994,15 @@ NS_IMETHODIMP nsImapMailFolder::BeginCopy(nsIMsgDBHdr *message)
|
|||
tmpFileSpec.MakeUnique();
|
||||
rv = NS_NewFileSpecWithSpec(tmpFileSpec,
|
||||
getter_AddRefs(m_copyState->m_tmpFileSpec));
|
||||
if (NS_SUCCEEDED(rv) && m_copyState->m_tmpFileSpec)
|
||||
rv = m_copyState->m_tmpFileSpec->OpenStreamForWriting();
|
||||
nsCOMPtr<nsILocalFile> msgFile;
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = NS_FileSpecToIFile(&tmpFileSpec, getter_AddRefs(msgFile));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
nsCOMPtr<nsIOutputStream> fileOutputStream;
|
||||
rv = NS_NewLocalFileOutputStream(getter_AddRefs(fileOutputStream), msgFile, -1, 00600);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewBufferedOutputStream(getter_AddRefs(m_copyState->m_msgFileStream), fileOutputStream, FOUR_K);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (!m_copyState->m_dataBuffer)
|
||||
m_copyState->m_dataBuffer = (char*) PR_CALLOC(COPY_BUFFER_SIZE+1);
|
||||
|
@ -3001,18 +3013,17 @@ NS_IMETHODIMP nsImapMailFolder::BeginCopy(nsIMsgDBHdr *message)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::CopyData(nsIInputStream *aIStream,
|
||||
PRInt32 aLength)
|
||||
NS_IMETHODIMP nsImapMailFolder::CopyDataToOutputStreamForAppend(nsIInputStream *aIStream,
|
||||
PRInt32 aLength, nsIOutputStream *outputStream)
|
||||
{
|
||||
nsresult rv = NS_ERROR_NULL_POINTER;
|
||||
NS_ASSERTION(m_copyState && m_copyState->m_tmpFileSpec
|
||||
&& m_copyState->m_dataBuffer, "Fatal copy operation error\n");
|
||||
if (!m_copyState || !m_copyState->m_tmpFileSpec || !m_copyState->m_dataBuffer)
|
||||
return rv;
|
||||
|
||||
PRUint32 readCount;
|
||||
PRInt32 writeCount;
|
||||
PRUint32 writeCount;
|
||||
|
||||
if (!m_copyState)
|
||||
{
|
||||
nsImapMailCopyState* copyState = new nsImapMailCopyState();
|
||||
m_copyState = do_QueryInterface(copyState);
|
||||
}
|
||||
if ( aLength + m_copyState->m_leftOver > m_copyState->m_dataBufferSize )
|
||||
{
|
||||
m_copyState->m_dataBuffer = (char *) PR_REALLOC(m_copyState->m_dataBuffer, aLength + m_copyState->m_leftOver+ 1);
|
||||
|
@ -3024,7 +3035,7 @@ NS_IMETHODIMP nsImapMailFolder::CopyData(nsIInputStream *aIStream,
|
|||
char *start, *end;
|
||||
PRUint32 linebreak_len = 1;
|
||||
|
||||
rv = aIStream->Read(m_copyState->m_dataBuffer+m_copyState->m_leftOver, aLength, &readCount);
|
||||
nsresult rv = aIStream->Read(m_copyState->m_dataBuffer+m_copyState->m_leftOver, aLength, &readCount);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -3050,10 +3061,10 @@ NS_IMETHODIMP nsImapMailFolder::CopyData(nsIInputStream *aIStream,
|
|||
PL_strncasecmp(start, "X-Mozilla-Status2:", 18) &&
|
||||
PL_strncmp(start, "From - ", 7))
|
||||
{
|
||||
rv = m_copyState->m_tmpFileSpec->Write(start,
|
||||
rv = outputStream->Write(start,
|
||||
end-start,
|
||||
&writeCount);
|
||||
rv = m_copyState->m_tmpFileSpec->Write(CRLF, 2, &writeCount);
|
||||
rv = outputStream->Write(CRLF, 2, &writeCount);
|
||||
}
|
||||
start = end+linebreak_len;
|
||||
if (start >=
|
||||
|
@ -3081,14 +3092,32 @@ NS_IMETHODIMP nsImapMailFolder::CopyData(nsIInputStream *aIStream,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::CopyDataDone()
|
||||
{
|
||||
m_copyState = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::CopyData(nsIInputStream *aIStream,
|
||||
PRInt32 aLength)
|
||||
{
|
||||
nsresult rv = NS_ERROR_NULL_POINTER;
|
||||
NS_ASSERTION(m_copyState && m_copyState->m_tmpFileSpec
|
||||
&& m_copyState->m_dataBuffer, "Fatal copy operation error\n");
|
||||
if (!m_copyState || !m_copyState->m_msgFileStream || !m_copyState->m_dataBuffer)
|
||||
return rv;
|
||||
|
||||
return CopyDataToOutputStreamForAppend(aIStream, aLength, m_copyState->m_msgFileStream);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::EndCopy(PRBool copySucceeded)
|
||||
{
|
||||
nsresult rv = copySucceeded ? NS_OK : NS_ERROR_FAILURE;
|
||||
if (copySucceeded && m_copyState && m_copyState->m_tmpFileSpec)
|
||||
if (copySucceeded && m_copyState && m_copyState->m_msgFileStream)
|
||||
{
|
||||
nsCOMPtr<nsIUrlListener> urlListener;
|
||||
m_copyState->m_tmpFileSpec->Flush();
|
||||
m_copyState->m_tmpFileSpec->CloseStream();
|
||||
m_copyState->m_msgFileStream->Close();
|
||||
|
||||
nsCOMPtr<nsIImapService> imapService =
|
||||
do_GetService(NS_IMAPSERVICE_CONTRACTID, &rv);
|
||||
|
@ -3212,7 +3241,8 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWindo
|
|||
nsMsgKeyArray keysToFlag;
|
||||
|
||||
keysToFlag.Add(msgKey);
|
||||
StoreImapFlags(kImapMsgSeenFlag | kImapMsgDeletedFlag, PR_TRUE, keysToFlag.GetArray(), keysToFlag.GetSize());
|
||||
StoreImapFlags(kImapMsgSeenFlag | kImapMsgDeletedFlag, PR_TRUE, keysToFlag.GetArray(),
|
||||
keysToFlag.GetSize(), nsnull);
|
||||
m_msgMovedByFilter = PR_TRUE; // this will prevent us from adding the header to the db.
|
||||
}
|
||||
msgIsNew = PR_FALSE;
|
||||
|
@ -3247,7 +3277,7 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWindo
|
|||
nsMsgKeyArray keysToFlag;
|
||||
keysToFlag.Add(msgKey);
|
||||
msgHdr->OrFlags(MSG_FLAG_READ, &newFlags);
|
||||
StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, keysToFlag.GetArray(), keysToFlag.GetSize());
|
||||
StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, keysToFlag.GetArray(), keysToFlag.GetSize(), nsnull);
|
||||
msgIsNew = PR_FALSE;
|
||||
}
|
||||
break;
|
||||
|
@ -3255,7 +3285,7 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWindo
|
|||
{
|
||||
nsMsgKeyArray keysToFlag;
|
||||
keysToFlag.Add(msgKey);
|
||||
StoreImapFlags(kImapMsgFlaggedFlag, PR_TRUE, keysToFlag.GetArray(), keysToFlag.GetSize());
|
||||
StoreImapFlags(kImapMsgFlaggedFlag, PR_TRUE, keysToFlag.GetArray(), keysToFlag.GetSize(), nsnull);
|
||||
}
|
||||
break;
|
||||
case nsMsgFilterAction::KillThread:
|
||||
|
@ -3280,7 +3310,8 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWindo
|
|||
nsMsgKeyArray keysToFlag;
|
||||
|
||||
keysToFlag.Add(msgKey);
|
||||
StoreImapFlags((filterLabel << 9), PR_TRUE, keysToFlag.GetArray(), keysToFlag.GetSize());
|
||||
StoreImapFlags((filterLabel << 9), PR_TRUE, keysToFlag.GetArray(),
|
||||
keysToFlag.GetSize(), nsnull);
|
||||
}
|
||||
break;
|
||||
case nsMsgFilterAction::JunkScore:
|
||||
|
@ -3376,7 +3407,9 @@ NS_IMETHODIMP nsImapMailFolder::ReplayOfflineMoveCopy(nsMsgKey *msgKeys, PRUint3
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::StoreImapFlags(PRInt32 flags, PRBool addFlags, nsMsgKey *keys, PRUint32 numKeys)
|
||||
NS_IMETHODIMP nsImapMailFolder::StoreImapFlags(PRInt32 flags, PRBool addFlags,
|
||||
nsMsgKey *keys, PRUint32 numKeys,
|
||||
nsIUrlListener *aUrlListener)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!WeAreOffline())
|
||||
|
@ -3389,12 +3422,12 @@ NS_IMETHODIMP nsImapMailFolder::StoreImapFlags(PRInt32 flags, PRBool addFlags, n
|
|||
|
||||
if (addFlags)
|
||||
{
|
||||
imapService->AddMessageFlags(m_eventQueue, this, this,
|
||||
imapService->AddMessageFlags(m_eventQueue, this, aUrlListener ? aUrlListener : this,
|
||||
nsnull, msgIds.get(), flags, PR_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
imapService->SubtractMessageFlags(m_eventQueue, this, this,
|
||||
imapService->SubtractMessageFlags(m_eventQueue, this, aUrlListener ? aUrlListener : this,
|
||||
nsnull, msgIds.get(), flags,
|
||||
PR_TRUE);
|
||||
}
|
||||
|
@ -7081,6 +7114,8 @@ nsImapMailFolder::CopyFileMessage(nsIFileSpec* fileSpec,
|
|||
if (NS_FAILED(rv))
|
||||
return OnCopyCompleted(srcSupport, rv);
|
||||
|
||||
m_copyState->m_streamCopy = PR_TRUE;
|
||||
|
||||
nsCOMPtr<nsISupports> copySupport;
|
||||
if( m_copyState )
|
||||
copySupport = do_QueryInterface(m_copyState);
|
||||
|
|
|
@ -101,6 +101,7 @@ public:
|
|||
PRUint32 m_unreadCount; // num unread messages we're moving
|
||||
PRBool m_streamCopy;
|
||||
char *m_dataBuffer; // temporary buffer for this copy operation
|
||||
nsCOMPtr<nsIOutputStream> m_msgFileStream; // temporary file (processed mail)
|
||||
PRUint32 m_dataBufferSize;
|
||||
PRUint32 m_leftOver;
|
||||
PRBool m_allowUndo;
|
||||
|
@ -218,6 +219,9 @@ public:
|
|||
NS_IMETHOD Compact(nsIUrlListener *aListener, nsIMsgWindow *aMsgWindow);
|
||||
NS_IMETHOD CompactAll(nsIUrlListener *aListener, nsIMsgWindow *aMsgWindow, nsISupportsArray *aFolderArray, PRBool aCompactOfflineAlso, nsISupportsArray *aOfflineFolderArray);
|
||||
NS_IMETHOD EmptyTrash(nsIMsgWindow *msgWindow, nsIUrlListener *aListener);
|
||||
NS_IMETHOD CopyDataToOutputStreamForAppend(nsIInputStream *aIStream,
|
||||
PRInt32 aLength, nsIOutputStream *outputStream);
|
||||
NS_IMETHOD CopyDataDone();
|
||||
NS_IMETHOD Delete ();
|
||||
NS_IMETHOD Rename (const PRUnichar *newName, nsIMsgWindow *msgWindow);
|
||||
NS_IMETHOD RenameSubFolders(nsIMsgWindow *msgWindow, nsIMsgFolder *oldFolder);
|
||||
|
|
|
@ -296,7 +296,7 @@ MimeMultipart_parse_line (char *line, PRInt32 length, MimeObject *obj)
|
|||
&now);
|
||||
MimeWriteAString(obj, nsDependentCString(timeBuffer));
|
||||
MimeWriteAString(obj, NS_LITERAL_CSTRING("\""MSG_LINEBREAK));
|
||||
MimeWriteAString(obj, NS_LITERAL_CSTRING("The original MIME headers for this attachment are:"MSG_LINEBREAK));
|
||||
MimeWriteAString(obj, NS_LITERAL_CSTRING(MSG_LINEBREAK"The original MIME headers for this attachment are:"MSG_LINEBREAK));
|
||||
MimeHeaders_write_raw_headers(mult->hdrs, obj->options, PR_FALSE);
|
||||
}
|
||||
status = ((MimeMultipartClass *) obj->clazz)->create_child(obj);
|
||||
|
|
Загрузка…
Ссылка в новой задаче