fix handling of connection to server errors when downloading for offline use, sr=mscott 236532

This commit is contained in:
bienvenu%nventure.com 2004-03-10 00:59:13 +00:00
Родитель 9de81ba967
Коммит 0a73295c97
1 изменённых файлов: 13 добавлений и 8 удалений

Просмотреть файл

@ -95,14 +95,18 @@ nsImapOfflineSync::OnStopRunningUrl(nsIURI* url, nsresult exitCode)
PRBool stopped = PR_FALSE;
if (m_window)
m_window->GetStopped(&stopped);
if (stopped)
exitCode = NS_BINDING_ABORTED;
if (m_curTempFile)
{
m_curTempFile->Delete(PR_FALSE);
m_curTempFile = nsnull;
}
if (stopped)
{
if (m_listener)
m_listener->OnStopRunningUrl(url, NS_BINDING_ABORTED);
return NS_OK;
}
// NS_BINDING_ABORTED is used for the user pressing stop, which
// should cause us to abort the offline process. Other errors
// should allow us to continue.
@ -110,10 +114,12 @@ nsImapOfflineSync::OnStopRunningUrl(nsIURI* url, nsresult exitCode)
rv = ProcessNextOperation();
// else if it's a non-stop error, and we're doing multiple folders,
// go to the next folder.
else if (exitCode != NS_BINDING_ABORTED && !m_singleFolderToUpdate)
else if (!m_singleFolderToUpdate)
{
rv = AdvanceToNextFolder();
else if (m_listener) // notify main observer.
m_listener->OnStopRunningUrl(url, exitCode);
if (NS_SUCCEEDED(rv))
rv = ProcessNextOperation();
}
return rv;
}
@ -592,8 +598,7 @@ PRBool nsImapOfflineSync::CreateOfflineFolder(nsIMsgFolder *folder)
imapFolder->GetOnlineName(getter_Copies(onlineName));
NS_ConvertASCIItoUCS2 folderName(onlineName);
// folderName.AssignWithConversion(onlineName);
nsresult rv = imapFolder->PlaybackOfflineFolderCreate(folderName.get(), nsnull, getter_AddRefs(createFolderURI));
nsresult rv = imapFolder->PlaybackOfflineFolderCreate(folderName.get(), nsnull, getter_AddRefs(createFolderURI));
if (createFolderURI && NS_SUCCEEDED(rv))
{
nsCOMPtr <nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(createFolderURI);
@ -1025,7 +1030,7 @@ nsresult nsImapOfflineDownloader::ProcessNextOperation()
if (m_currentFolder)
imapFolder = do_QueryInterface(m_currentFolder);
m_currentFolder->GetFlags(&folderFlags);
// need to check if folder has offline events, or is configured for offline
// need to check if folder has offline events, or is configured for offline
if (imapFolder && folderFlags & MSG_FOLDER_FLAG_OFFLINE)
{
rv = m_currentFolder->DownloadAllForOffline(this, m_window);