зеркало из https://github.com/mozilla/pjs.git
fix move of local messages to imap delete source local message 131595 r=sspitzer, sr=mscott, a=asa
This commit is contained in:
Родитель
2407cfe7f8
Коммит
e63eb965e4
|
@ -91,12 +91,12 @@ interface nsIImapMailFolderSink : nsISupports {
|
|||
|
||||
void NotifySearchHit(in nsIMsgMailNewsUrl aUrl, in string hitLine);
|
||||
|
||||
void copyNextStreamMessage(in boolean copySucceeded);
|
||||
// these two hokey methods are needed so we can try to make sure the imap url is released
|
||||
// on the UI thread. This in turn ensures that the objects the imap url holds on to
|
||||
// are only released / destroyed from the UI thread.
|
||||
void prepareToReleaseUrl(in nsIMsgMailNewsUrl aUrl);
|
||||
void releaseUrl();
|
||||
void copyNextStreamMessage(in boolean copySucceeded, in nsISupports copyState);
|
||||
// these two hokey methods are needed so we can try to make sure the imap objects are released
|
||||
// on the UI thread. This in turn ensures that the objects the imap object holds on to
|
||||
// are only released / destroyed from the UI thread. This is used for urls and copy state objects now.
|
||||
void prepareToReleaseObject(in nsISupports aISupports);
|
||||
void releaseObject();
|
||||
void closeMockChannel(in nsIImapMockChannel aChannel);
|
||||
void setUrlState(in nsIImapProtocol aProtocol, in nsIMsgMailNewsUrl aUrl, in boolean isRunning, in nsresult status);
|
||||
void releaseUrlCacheEntry(in nsIMsgMailNewsUrl aUrl);
|
||||
|
|
|
@ -3751,16 +3751,17 @@ nsImapMailFolder::OnlineCopyCompleted(nsIImapProtocol *aProtocol, ImapOnlineCopy
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::PrepareToReleaseUrl(nsIMsgMailNewsUrl * aUrl)
|
||||
nsImapMailFolder::PrepareToReleaseObject(nsISupports * aSupports)
|
||||
{
|
||||
mUrlToRelease = aUrl;
|
||||
NS_ASSERTION(!mSupportsToRelease, "can't prepare to release w/o releasing prev object");
|
||||
mSupportsToRelease = aSupports;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::ReleaseUrl()
|
||||
nsImapMailFolder::ReleaseObject()
|
||||
{
|
||||
mUrlToRelease = nsnull;
|
||||
mSupportsToRelease = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -5382,38 +5383,44 @@ nsImapMailFolder::ProcessTunnel(nsIImapProtocol* aProtocol,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::CopyNextStreamMessage(PRBool copySucceeded)
|
||||
nsImapMailFolder::CopyNextStreamMessage(PRBool copySucceeded, nsISupports *copyState)
|
||||
{
|
||||
//if copy has failed it could be either user interrupted it or for some other reason
|
||||
//don't do any subsequent copies or delete src messages if it is move
|
||||
|
||||
if (!copySucceeded || !m_copyState)
|
||||
|
||||
if (!copySucceeded)
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (!m_copyState->m_streamCopy)
|
||||
nsCOMPtr<nsImapMailCopyState> mailCopyState = do_QueryInterface(copyState,
|
||||
&rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!mailCopyState->m_streamCopy)
|
||||
return NS_OK;
|
||||
if (m_copyState->m_curIndex < m_copyState->m_totalCount)
|
||||
|
||||
if (mailCopyState->m_curIndex < mailCopyState->m_totalCount)
|
||||
{
|
||||
nsCOMPtr<nsISupports> aSupport =
|
||||
getter_AddRefs(m_copyState->m_messages->ElementAt
|
||||
(m_copyState->m_curIndex));
|
||||
m_copyState->m_message = do_QueryInterface(aSupport,
|
||||
getter_AddRefs(mailCopyState->m_messages->ElementAt
|
||||
(mailCopyState->m_curIndex));
|
||||
mailCopyState->m_message = do_QueryInterface(aSupport,
|
||||
&rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = CopyStreamMessage(m_copyState->m_message,
|
||||
this, m_copyState->m_msgWindow, m_copyState->m_isMove);
|
||||
rv = CopyStreamMessage(mailCopyState->m_message,
|
||||
this, mailCopyState->m_msgWindow, mailCopyState->m_isMove);
|
||||
}
|
||||
}
|
||||
else if (m_copyState->m_isMove)
|
||||
else if (mailCopyState->m_isMove)
|
||||
{
|
||||
nsCOMPtr<nsIMsgFolder> srcFolder =
|
||||
do_QueryInterface(m_copyState->m_srcSupport, &rv);
|
||||
do_QueryInterface(mailCopyState->m_srcSupport, &rv);
|
||||
if (NS_SUCCEEDED(rv) && srcFolder)
|
||||
{
|
||||
srcFolder->DeleteMessages(m_copyState->m_messages, nsnull,
|
||||
srcFolder->DeleteMessages(mailCopyState->m_messages, nsnull,
|
||||
PR_TRUE, PR_TRUE, nsnull, PR_FALSE);
|
||||
// we want to send this notification after the source messages have
|
||||
// been deleted.
|
||||
|
|
|
@ -468,7 +468,7 @@ protected:
|
|||
|
||||
nsMsgIMAPFolderACL *m_folderACL;
|
||||
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mUrlToRelease;
|
||||
nsCOMPtr<nsISupports> mSupportsToRelease;
|
||||
|
||||
// offline imap support
|
||||
PRBool m_downloadMessageForOfflineUse;
|
||||
|
|
|
@ -715,11 +715,13 @@ void nsImapProtocol::ReleaseUrlState()
|
|||
// for real.
|
||||
if (m_imapMailFolderSink)
|
||||
{
|
||||
m_imapMailFolderSink->PrepareToReleaseUrl(mailnewsurl);
|
||||
nsCOMPtr <nsISupports> supports = do_QueryInterface(mailnewsurl);
|
||||
m_imapMailFolderSink->PrepareToReleaseObject(supports);
|
||||
supports = nsnull;
|
||||
mailnewsurl = nsnull;
|
||||
// at this point in time, we MUST have released all of our references to
|
||||
// the url from the imap protocol. otherwise this whole exercise is moot.
|
||||
m_imapMailFolderSink->ReleaseUrl();
|
||||
m_imapMailFolderSink->ReleaseObject();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1211,10 +1213,9 @@ PRBool nsImapProtocol::ProcessCurrentURL()
|
|||
m_lastActiveTime = PR_Now(); // ** jt -- is this the best place for time stamp
|
||||
SetFlag(IMAP_CLEAN_UP_URL_STATE);
|
||||
|
||||
#ifdef DEBUG_bienvenu1
|
||||
mailnewsurl->GetSpec(getter_Copies(urlSpec));
|
||||
printf("end processing url %s\n", (const char *) urlSpec);
|
||||
#endif
|
||||
nsCOMPtr <nsISupports> copyState;
|
||||
if (m_runningUrl)
|
||||
m_runningUrl->GetCopyState(getter_AddRefs(copyState));
|
||||
// this is so hokey...we MUST clear any local references to the url
|
||||
// BEFORE calling ReleaseUrlState
|
||||
mailnewsurl = nsnull;
|
||||
|
@ -1229,7 +1230,10 @@ PRBool nsImapProtocol::ProcessCurrentURL()
|
|||
|
||||
if (GetConnectionStatus() >= 0 && imapMailFolderSink)
|
||||
{
|
||||
imapMailFolderSink->CopyNextStreamMessage(GetServerStateParser().LastCommandSuccessful());
|
||||
imapMailFolderSink->PrepareToReleaseObject(copyState);
|
||||
imapMailFolderSink->CopyNextStreamMessage(GetServerStateParser().LastCommandSuccessful(), copyState);
|
||||
copyState = nsnull;
|
||||
imapMailFolderSink->ReleaseObject();
|
||||
imapMailFolderSink = nsnull;
|
||||
}
|
||||
|
||||
|
@ -4775,6 +4779,7 @@ void nsImapProtocol::UploadMessageFromFile (nsIFileSpec* fileSpec,
|
|||
rv = fileInputStream->Read(dataBuffer, COPY_BUFFER_SIZE, &readCount);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
NS_ASSERTION(readCount <= (PRUint32) totalSize, "got more bytes than there should be");
|
||||
dataBuffer[readCount] = 0;
|
||||
rv = SendData(dataBuffer);
|
||||
totalSize -= readCount;
|
||||
|
|
Загрузка…
Ссылка в новой задаче