зеркало из https://github.com/mozilla/gecko-dev.git
add some specific error codes so we can start getting rid of uses of NS_ERROR_FAILURE fix notification of filtered messages in pop folders 67556 r=naving, sr=mscott
This commit is contained in:
Родитель
d569c61ce0
Коммит
08646b2ca2
|
@ -23,6 +23,7 @@
|
|||
#include "nsISupports.idl"
|
||||
interface nsIMsgWindow;
|
||||
interface nsIUrlListener;
|
||||
interface nsIMsgDatabase;
|
||||
|
||||
[scriptable, uuid(27D2DE40-BAF1-11d2-9578-00805F8AC615)]
|
||||
interface nsIMsgLocalMailFolder : nsISupports {
|
||||
|
@ -34,5 +35,6 @@ interface nsIMsgLocalMailFolder : nsISupports {
|
|||
* like MSG_FOLDER_FLAG_INBOX | MSG_FOLDER_FLAG_DRAFTS | etc
|
||||
*/
|
||||
void setFlagsOnDefaultMailboxes(in unsigned long flags);
|
||||
void ParseFolder(in nsIMsgWindow aMsgWindow, in nsIUrlListener listener);
|
||||
nsIMsgDatabase getDatabaseWOReparse();
|
||||
void parseFolder(in nsIMsgWindow aMsgWindow, in nsIUrlListener listener);
|
||||
};
|
||||
|
|
|
@ -341,6 +341,31 @@ NS_IMETHODIMP nsMsgLocalMailFolder::ParseFolder(nsIMsgWindow *aMsgWindow, nsIUrl
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgLocalMailFolder::GetDatabaseWOReparse(nsIMsgDatabase **aDatabase)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_ENSURE_ARG(aDatabase);
|
||||
if (!mDatabase)
|
||||
{
|
||||
nsCOMPtr <nsIFileSpec> destIFolderSpec;
|
||||
rv = GetPath(getter_AddRefs(destIFolderSpec));
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIMsgDatabase> mailDBFactory;
|
||||
nsresult rv = nsComponentManager::CreateInstance(kCMailDB, nsnull, NS_GET_IID(nsIMsgDatabase), (void **) getter_AddRefs(mailDBFactory));
|
||||
if (NS_SUCCEEDED(rv) && mailDBFactory)
|
||||
{
|
||||
rv = mailDBFactory->Open(destIFolderSpec, PR_TRUE, PR_TRUE, (nsIMsgDatabase **) getter_AddRefs(mDatabase));
|
||||
if (mDatabase && NS_SUCCEEDED(rv))
|
||||
mDatabase->AddListener(this);
|
||||
}
|
||||
}
|
||||
*aDatabase = mDatabase;
|
||||
NS_IF_ADDREF(*aDatabase);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgLocalMailFolder::Enumerate(nsIEnumerator* *result)
|
||||
{
|
||||
|
@ -415,11 +440,11 @@ nsMsgLocalMailFolder::GetSubFolders(nsIEnumerator* *result)
|
|||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = GetServer(getter_AddRefs(server));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!server) return NS_ERROR_FAILURE;
|
||||
if (!server) return NS_MSG_INVALID_OR_MISSING_SERVER;
|
||||
|
||||
localMailServer = do_QueryInterface(server, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!localMailServer) return NS_ERROR_FAILURE;
|
||||
if (!localMailServer) return NS_MSG_INVALID_OR_MISSING_SERVER;
|
||||
|
||||
nsCOMPtr<nsIFileSpec> spec;
|
||||
rv = NS_NewFileSpecWithSpec(path, getter_AddRefs(spec));
|
||||
|
@ -2027,11 +2052,11 @@ NS_IMETHODIMP nsMsgLocalMailFolder::GetNewMessages(nsIMsgWindow *aWindow)
|
|||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = GetServer(getter_AddRefs(server));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!server) return NS_ERROR_FAILURE;
|
||||
if (!server) return NS_MSG_INVALID_OR_MISSING_SERVER;
|
||||
|
||||
nsCOMPtr<nsILocalMailIncomingServer> localMailServer = do_QueryInterface(server, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!localMailServer) return NS_ERROR_FAILURE;
|
||||
if (!localMailServer) return NS_MSG_INVALID_OR_MISSING_SERVER;
|
||||
|
||||
//GGGGGGG
|
||||
nsCOMPtr<nsIMsgFolder> inbox;
|
||||
|
@ -2648,14 +2673,14 @@ nsresult nsMsgLocalMailFolder::DeleteMsgsOnPop3Server(nsISupportsArray *messages
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (!server)
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_MSG_INVALID_OR_MISSING_SERVER;
|
||||
|
||||
server->GetLocalPath(getter_AddRefs(localPath));
|
||||
pop3MailServer = do_QueryInterface(server, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (!pop3MailServer)
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_MSG_INVALID_OR_MISSING_SERVER;
|
||||
|
||||
pop3MailServer->GetDeleteMailLeftOnServer(&deleteMailLeftOnServer);
|
||||
if (!deleteMailLeftOnServer)
|
||||
|
|
|
@ -80,11 +80,12 @@ nsLocalStringService::GetBundle(nsIStringBundle **aResult)
|
|||
nsresult
|
||||
nsLocalStringService::InitializeStringBundle()
|
||||
{
|
||||
nsCOMPtr<nsIStringBundleService> stringService = do_GetService(kStringBundleServiceCID);
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIStringBundleService> stringService = do_GetService(kStringBundleServiceCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(stringService, NS_ERROR_FAILURE);
|
||||
|
||||
NS_ENSURE_SUCCESS(stringService->CreateBundle(LOCAL_MSGS_URL, nsnull, getter_AddRefs(mLocalStringBundle)),
|
||||
NS_ERROR_FAILURE);
|
||||
return NS_OK;
|
||||
rv = stringService->CreateBundle(LOCAL_MSGS_URL, nsnull, getter_AddRefs(mLocalStringBundle));
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include "nsIRDFService.h"
|
||||
#include "nsMsgI18N.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
|
||||
#include "nsIMsgLocalMailFolder.h"
|
||||
|
||||
static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
|
||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
||||
|
@ -1876,15 +1876,13 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
|||
destFile->seek(PR_SEEK_END, 0);
|
||||
newMsgPos = destFile->tell();
|
||||
|
||||
nsCOMPtr<nsIMsgDatabase> mailDBFactory;
|
||||
nsCOMPtr<nsIMsgDatabase> destMailDB;
|
||||
nsresult rv = nsComponentManager::CreateInstance(kCMailDB, nsnull, NS_GET_IID(nsIMsgDatabase), (void **) getter_AddRefs(mailDBFactory));
|
||||
if (NS_SUCCEEDED(rv) && mailDBFactory)
|
||||
{
|
||||
nsCOMPtr <nsIFileSpec> dbFileSpec;
|
||||
NS_NewFileSpecWithSpec(destFolderSpec, getter_AddRefs(dbFileSpec));
|
||||
rv = mailDBFactory->Open(dbFileSpec, PR_TRUE, PR_TRUE, (nsIMsgDatabase **) getter_AddRefs(destMailDB));
|
||||
}
|
||||
nsCOMPtr<nsIMsgLocalMailFolder> localFolder = do_QueryInterface(destIFolder);
|
||||
nsCOMPtr<nsIMsgDatabase> destMailDB;
|
||||
|
||||
if (!localFolder)
|
||||
return NS_MSG_POP_FILTER_TARGET_ERROR;
|
||||
|
||||
nsresult rv = localFolder->GetDatabaseWOReparse(getter_AddRefs(destMailDB));
|
||||
NS_ASSERTION(destMailDB, "failed to open mail db parsing folder");
|
||||
// don't force upgrade in place - open the db here before we start writing to the
|
||||
// destination file because XP_Stat can return file size including bytes written...
|
||||
|
@ -1949,10 +1947,7 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
|||
else
|
||||
{
|
||||
if (destMailDB)
|
||||
{
|
||||
destMailDB->Close(PR_TRUE);
|
||||
destMailDB = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
destFile->close();
|
||||
|
@ -1983,7 +1978,7 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
|||
if (destIFolder != nsnull)
|
||||
destIFolder->SummaryChanged();
|
||||
|
||||
destMailDB->Close(PR_TRUE);
|
||||
destMailDB->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
}
|
||||
// We are logging the hit with the old mailHdr, which should work, as long
|
||||
// as LogRuleHit doesn't assume the new hdr.
|
||||
|
|
|
@ -416,7 +416,7 @@ nsresult nsPop3Protocol::Initialize(nsIURI * aURL)
|
|||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
mailnewsUrl->GetStatusFeedback(getter_AddRefs(m_statusFeedback));
|
||||
mailnewsUrl->GetServer(getter_AddRefs(server));
|
||||
NS_ENSURE_TRUE(server, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(server, NS_MSG_INVALID_OR_MISSING_SERVER);
|
||||
m_pop3Server = do_QueryInterface(server);
|
||||
if (m_pop3Server)
|
||||
m_pop3Server->GetPop3CapabilityFlags(&m_pop3ConData->capability_flags);
|
||||
|
@ -561,7 +561,7 @@ nsresult nsPop3Protocol::GetPassword(char ** aPassword, PRBool *okayValue)
|
|||
m_pop3ConData->next_state = POP3_ERROR_DONE;
|
||||
} // if we have a server
|
||||
else
|
||||
rv = NS_ERROR_FAILURE;
|
||||
rv = NS_MSG_INVALID_OR_MISSING_SERVER;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -84,18 +84,18 @@ NS_IMETHODIMP nsPop3Service::CheckForNewMail(nsIMsgWindow* aMsgWindow,
|
|||
|
||||
server = do_QueryInterface(popServer);
|
||||
|
||||
if (!server) return NS_ERROR_FAILURE;
|
||||
if (!server) return NS_MSG_INVALID_OR_MISSING_SERVER;
|
||||
|
||||
rv = server->GetHostName(getter_Copies(popHost));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!((const char *)popHost)) return NS_ERROR_FAILURE;
|
||||
if (!((const char *)popHost)) return NS_MSG_INVALID_OR_MISSING_SERVER;
|
||||
|
||||
rv = server->GetPort(&popPort);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = server->GetUsername(getter_Copies(popUser));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!((const char *)popUser)) return NS_ERROR_FAILURE;
|
||||
if (!((const char *)popUser)) return NS_MSG_SERVER_USERNAME_MISSING;
|
||||
|
||||
nsXPIDLCString escapedUsername;
|
||||
*((char**)getter_Copies(escapedUsername)) =
|
||||
|
@ -139,11 +139,11 @@ nsresult nsPop3Service::GetNewMail(nsIMsgWindow *aMsgWindow, nsIUrlListener * aU
|
|||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
server = do_QueryInterface(popServer);
|
||||
|
||||
if (!server) return NS_ERROR_FAILURE;
|
||||
if (!server) return NS_MSG_INVALID_OR_MISSING_SERVER;
|
||||
|
||||
rv = server->GetHostName(getter_Copies(popHost));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!((const char *)popHost)) return NS_ERROR_FAILURE;
|
||||
if (!((const char *)popHost)) return NS_MSG_INVALID_OR_MISSING_SERVER;
|
||||
|
||||
rv = server->GetPort(&popPort);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -156,7 +156,7 @@ nsresult nsPop3Service::GetNewMail(nsIMsgWindow *aMsgWindow, nsIUrlListener * aU
|
|||
nsEscape(popUser, url_XAlphas);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!((const char *)popUser)) return NS_ERROR_FAILURE;
|
||||
if (!((const char *)popUser)) return NS_MSG_SERVER_USERNAME_MISSING;
|
||||
|
||||
if (NS_SUCCEEDED(rv) && popServer )
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче