Bug 1017028 - fix error message about not enough disk space when we just hit the 4GB folder limit. r=irving, r=Neil, a=Ratty on a SeaMonkey CLOSED TREE

This commit is contained in:
aceman 2015-02-17 14:29:31 +01:00
Родитель 22285172b8
Коммит 4156d31cfb
9 изменённых файлов: 49 добавлений и 24 удалений

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

@ -40,8 +40,6 @@ noNewMessages=There are no new messages.
# %2$S will receive the total number of messages
receivedMsgs=Received %1$S of %2$S messages
pop3OutOfDiskSpace=There is not enough disk space to download new messages. Try deleting old mail, emptying the Trash folder, and compacting your mail folders, and then try again.
# Status - parsing folder
#LOCALIZATION NOTE (buildingSummary): Do not translate %S in the following line.
# Place the word %S where the name of the mailbox should appear

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

@ -96,6 +96,7 @@ verboseFolderFormat=%1$S on %2$S
filterFolderTruncateFailed=There was an error truncating the Inbox after filtering a message to folder '%1$S'. You may need to shutdown %2$S and delete INBOX.msf.
mailboxTooLarge=The folder %S is full, and can't hold any more messages. To make room for more messages, delete any old or unwanted mail and compact the folder.
outOfDiskSpace=There is not enough disk space to download new messages. Try deleting old mail, emptying the Trash folder, and compacting your mail folders, and then try again.
errorGettingDB=Unable to open the summary file for %S. Perhaps there was an error on disk, or the full path is too long.
defaultServerTag=(Default)

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

@ -82,6 +82,11 @@ interface nsIMsgPluggableStore : nsISupports {
*
* @param aFolder folder we want to add messages to.
* @param aSpaceRequested How many bytes we're trying to add to the store.
*
* The function returns an exception if there is not enough space to
* indicate the reason of the shortage:
* NS_ERROR_FILE_TOO_BIG = the store cannot grow further due to internal limits
* NS_ERROR_FILE_DISK_FULL = there is not enough space on the disk
*/
boolean hasSpaceAvailable(in nsIMsgFolder aFolder,
in long long aSpaceRequested);

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

@ -1469,14 +1469,10 @@ bool nsMsgLocalMailFolder::CheckIfSpaceForCopy(nsIMsgWindow *msgWindow,
bool isMove,
int64_t totalMsgSize)
{
nsCOMPtr<nsIMsgPluggableStore> msgStore;
nsresult rv = GetMsgStore(getter_AddRefs(msgStore));
NS_ENSURE_SUCCESS(rv, false);
bool spaceAvailable;
rv = msgStore->HasSpaceAvailable(this, totalMsgSize, &spaceAvailable);
if (!spaceAvailable)
bool spaceNotAvailable = true;
nsresult rv = WarnIfLocalFileTooBig(msgWindow, totalMsgSize, &spaceNotAvailable);
if (NS_FAILED(rv) || spaceNotAvailable)
{
ThrowAlertMsg("mailboxTooLarge", msgWindow);
if (isMove && srcFolder)
srcFolder->NotifyFolderEvent(mDeleteOrMoveMsgFailedAtom);
OnCopyCompleted(srcSupports, false);
@ -3719,11 +3715,12 @@ nsMsgLocalMailFolder::WarnIfLocalFileTooBig(nsIMsgWindow *aWindow,
bool spaceAvailable = false;
// check if we have a reasonable amount of space left
rv = msgStore->HasSpaceAvailable(this, aSpaceRequested, &spaceAvailable);
if (NS_FAILED(rv) || !spaceAvailable)
{
if (NS_SUCCEEDED(rv) && spaceAvailable) {
*aTooBig = false;
} else if (rv == NS_ERROR_FILE_TOO_BIG) {
ThrowAlertMsg("mailboxTooLarge", aWindow);
} else {
*aTooBig = false;
ThrowAlertMsg("outOfDiskSpace", aWindow);
}
return NS_OK;
}

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

@ -196,13 +196,18 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::HasSpaceAvailable(nsIMsgFolder *aFolder,
nsresult rv = aFolder->GetFilePath(getter_AddRefs(pathFile));
NS_ENSURE_SUCCESS(rv, rv);
// Allow the mbox to only reach 0xFFC00000 = 4 GiB - 4 MiB for now.
// This limit can be increased after bug 789679 is fixed.
int64_t fileSize;
rv = pathFile->GetFileSize(&fileSize);
NS_ENSURE_SUCCESS(rv, rv);
*aResult = ((fileSize + aSpaceRequested) < 0xFFC00000);
if (!*aResult)
return NS_ERROR_FILE_TOO_BIG;
// Allow the mbox to only reach 0xFFC00000 = 4 GiB - 4 MiB for now.
*aResult = ((fileSize + aSpaceRequested) < 0xFFC00000) &&
DiskSpaceAvailableInStore(pathFile, aSpaceRequested);
*aResult = DiskSpaceAvailableInStore(pathFile, aSpaceRequested);
if (!*aResult)
return NS_ERROR_FILE_DISK_FULL;
return NS_OK;
}

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

@ -263,7 +263,19 @@ NS_IMETHODIMP nsMsgMaildirStore::HasSpaceAvailable(nsIMsgFolder *aFolder,
nsresult rv = aFolder->GetFilePath(getter_AddRefs(pathFile));
NS_ENSURE_SUCCESS(rv, rv);
// Allow the folder to only reach 0xFFC00000 = 4 GiB - 4 MiB for now.
// This limit can be increased after bug 1078367 is fixed.
uint32_t folderSize;
rv = aFolder->GetSizeOnDisk(&folderSize);
NS_ENSURE_SUCCESS(rv, rv);
*aResult = (0xFFC00000ULL - aSpaceRequested > folderSize);
if (!*aResult)
return NS_ERROR_FILE_TOO_BIG;
*aResult = DiskSpaceAvailableInStore(pathFile, aSpaceRequested);
if (!*aResult)
return NS_ERROR_FILE_DISK_FULL;
return NS_OK;
}

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

@ -31,6 +31,7 @@
#include "nsCOMPtr.h"
#include "nsIMsgWindow.h"
#include "nsIMsgFolder.h" // TO include biffState enum. Change to bool later...
#include "nsIMsgLocalMailFolder.h"
#include "nsIDocShell.h"
#include "nsMsgUtils.h"
#include "nsISocketTransport.h"
@ -2932,18 +2933,25 @@ int32_t nsPop3Protocol::GetMsg()
if (NS_FAILED(rv))
return -1;
nsCOMPtr<nsIMsgPluggableStore> msgStore;
rv = folder->GetMsgStore(getter_AddRefs(msgStore));
NS_ENSURE_SUCCESS(rv, -1);
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(m_url, &rv);
if (NS_FAILED(rv) || !mailnewsUrl)
return -1;
nsCOMPtr<nsIMsgWindow> msgWindow;
(void)mailnewsUrl->GetMsgWindow(getter_AddRefs(msgWindow));
bool spaceNotAvailable = true;
nsCOMPtr<nsIMsgLocalMailFolder> localFolder(do_QueryInterface(folder, &rv));
if (NS_FAILED(rv) || !localFolder)
return -1;
bool spaceAvailable;
// check if we have a reasonable amount of space left
rv = msgStore->HasSpaceAvailable(folder, m_totalDownloadSize, &spaceAvailable);
if (NS_FAILED(rv) || !spaceAvailable) {
rv = localFolder->WarnIfLocalFileTooBig(msgWindow, m_totalDownloadSize, &spaceNotAvailable);
if (NS_FAILED(rv) || spaceNotAvailable) {
#ifdef DEBUG
printf("Not enough disk space! Raising error!\n");
#endif
return Error("pop3OutOfDiskSpace");
return -1;
}
// Here we know how many messages we're going to download, so let

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

@ -40,8 +40,6 @@ noNewMessages=There are no new messages.
# %2$S will receive the total number of messages
receivedMsgs=Received %1$S of %2$S messages
pop3OutOfDiskSpace=There is not enough disk space to download new messages. Try deleting old mail, emptying the Trash folder, and compacting your mail folders, and then try again.
# Status - parsing folder
#LOCALIZATION NOTE (buildingSummary): Do not translate %S in the following line.
# Place the word %S where the name of the mailbox should appear

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

@ -93,6 +93,7 @@ verboseFolderFormat=%1$S on %2$S
filterFolderTruncateFailed=There was an error truncating the Inbox after filtering a message to folder '%1$S'. You may need to shutdown %2$S and delete INBOX.msf.
mailboxTooLarge=The folder %S is full, and can't hold any more messages. To make room for more messages, delete any old or unwanted mail and compact the folder.
outOfDiskSpace=There is not enough disk space to download new messages. Try deleting old mail, emptying the Trash folder, and compacting your mail folders, and then try again.
errorGettingDB=Unable to open the summary file for '%S'. Perhaps there was an error on disk, or the full path is too long.
defaultServerTag=(Default)