зеркало из 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"
|
#include "nsISupports.idl"
|
||||||
interface nsIMsgWindow;
|
interface nsIMsgWindow;
|
||||||
interface nsIUrlListener;
|
interface nsIUrlListener;
|
||||||
|
interface nsIMsgDatabase;
|
||||||
|
|
||||||
[scriptable, uuid(27D2DE40-BAF1-11d2-9578-00805F8AC615)]
|
[scriptable, uuid(27D2DE40-BAF1-11d2-9578-00805F8AC615)]
|
||||||
interface nsIMsgLocalMailFolder : nsISupports {
|
interface nsIMsgLocalMailFolder : nsISupports {
|
||||||
|
@ -34,5 +35,6 @@ interface nsIMsgLocalMailFolder : nsISupports {
|
||||||
* like MSG_FOLDER_FLAG_INBOX | MSG_FOLDER_FLAG_DRAFTS | etc
|
* like MSG_FOLDER_FLAG_INBOX | MSG_FOLDER_FLAG_DRAFTS | etc
|
||||||
*/
|
*/
|
||||||
void setFlagsOnDefaultMailboxes(in unsigned long flags);
|
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;
|
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
|
NS_IMETHODIMP
|
||||||
nsMsgLocalMailFolder::Enumerate(nsIEnumerator* *result)
|
nsMsgLocalMailFolder::Enumerate(nsIEnumerator* *result)
|
||||||
{
|
{
|
||||||
|
@ -415,11 +440,11 @@ nsMsgLocalMailFolder::GetSubFolders(nsIEnumerator* *result)
|
||||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||||
rv = GetServer(getter_AddRefs(server));
|
rv = GetServer(getter_AddRefs(server));
|
||||||
if (NS_FAILED(rv)) return rv;
|
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);
|
localMailServer = do_QueryInterface(server, &rv);
|
||||||
if (NS_FAILED(rv)) return 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;
|
nsCOMPtr<nsIFileSpec> spec;
|
||||||
rv = NS_NewFileSpecWithSpec(path, getter_AddRefs(spec));
|
rv = NS_NewFileSpecWithSpec(path, getter_AddRefs(spec));
|
||||||
|
@ -2027,11 +2052,11 @@ NS_IMETHODIMP nsMsgLocalMailFolder::GetNewMessages(nsIMsgWindow *aWindow)
|
||||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||||
rv = GetServer(getter_AddRefs(server));
|
rv = GetServer(getter_AddRefs(server));
|
||||||
if (NS_FAILED(rv)) return rv;
|
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);
|
nsCOMPtr<nsILocalMailIncomingServer> localMailServer = do_QueryInterface(server, &rv);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
if (!localMailServer) return NS_ERROR_FAILURE;
|
if (!localMailServer) return NS_MSG_INVALID_OR_MISSING_SERVER;
|
||||||
|
|
||||||
//GGGGGGG
|
//GGGGGGG
|
||||||
nsCOMPtr<nsIMsgFolder> inbox;
|
nsCOMPtr<nsIMsgFolder> inbox;
|
||||||
|
@ -2648,14 +2673,14 @@ nsresult nsMsgLocalMailFolder::DeleteMsgsOnPop3Server(nsISupportsArray *messages
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
if (!server)
|
if (!server)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_MSG_INVALID_OR_MISSING_SERVER;
|
||||||
|
|
||||||
server->GetLocalPath(getter_AddRefs(localPath));
|
server->GetLocalPath(getter_AddRefs(localPath));
|
||||||
pop3MailServer = do_QueryInterface(server, &rv);
|
pop3MailServer = do_QueryInterface(server, &rv);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
if (!pop3MailServer)
|
if (!pop3MailServer)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_MSG_INVALID_OR_MISSING_SERVER;
|
||||||
|
|
||||||
pop3MailServer->GetDeleteMailLeftOnServer(&deleteMailLeftOnServer);
|
pop3MailServer->GetDeleteMailLeftOnServer(&deleteMailLeftOnServer);
|
||||||
if (!deleteMailLeftOnServer)
|
if (!deleteMailLeftOnServer)
|
||||||
|
|
|
@ -80,11 +80,12 @@ nsLocalStringService::GetBundle(nsIStringBundle **aResult)
|
||||||
nsresult
|
nsresult
|
||||||
nsLocalStringService::InitializeStringBundle()
|
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_TRUE(stringService, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(stringService->CreateBundle(LOCAL_MSGS_URL, nsnull, getter_AddRefs(mLocalStringBundle)),
|
rv = stringService->CreateBundle(LOCAL_MSGS_URL, nsnull, getter_AddRefs(mLocalStringBundle));
|
||||||
NS_ERROR_FAILURE);
|
return rv;
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
#include "nsIRDFService.h"
|
#include "nsIRDFService.h"
|
||||||
#include "nsMsgI18N.h"
|
#include "nsMsgI18N.h"
|
||||||
#include "nsAppDirectoryServiceDefs.h"
|
#include "nsAppDirectoryServiceDefs.h"
|
||||||
|
#include "nsIMsgLocalMailFolder.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
|
static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
|
||||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
||||||
|
@ -1876,15 +1876,13 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||||
destFile->seek(PR_SEEK_END, 0);
|
destFile->seek(PR_SEEK_END, 0);
|
||||||
newMsgPos = destFile->tell();
|
newMsgPos = destFile->tell();
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgDatabase> mailDBFactory;
|
nsCOMPtr<nsIMsgLocalMailFolder> localFolder = do_QueryInterface(destIFolder);
|
||||||
nsCOMPtr<nsIMsgDatabase> destMailDB;
|
nsCOMPtr<nsIMsgDatabase> destMailDB;
|
||||||
nsresult rv = nsComponentManager::CreateInstance(kCMailDB, nsnull, NS_GET_IID(nsIMsgDatabase), (void **) getter_AddRefs(mailDBFactory));
|
|
||||||
if (NS_SUCCEEDED(rv) && mailDBFactory)
|
if (!localFolder)
|
||||||
{
|
return NS_MSG_POP_FILTER_TARGET_ERROR;
|
||||||
nsCOMPtr <nsIFileSpec> dbFileSpec;
|
|
||||||
NS_NewFileSpecWithSpec(destFolderSpec, getter_AddRefs(dbFileSpec));
|
nsresult rv = localFolder->GetDatabaseWOReparse(getter_AddRefs(destMailDB));
|
||||||
rv = mailDBFactory->Open(dbFileSpec, PR_TRUE, PR_TRUE, (nsIMsgDatabase **) getter_AddRefs(destMailDB));
|
|
||||||
}
|
|
||||||
NS_ASSERTION(destMailDB, "failed to open mail db parsing folder");
|
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
|
// 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...
|
// destination file because XP_Stat can return file size including bytes written...
|
||||||
|
@ -1949,11 +1947,8 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (destMailDB)
|
if (destMailDB)
|
||||||
{
|
|
||||||
destMailDB->Close(PR_TRUE);
|
|
||||||
destMailDB = nsnull;
|
destMailDB = nsnull;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
destFile->close();
|
destFile->close();
|
||||||
m_inboxFileStream->close();
|
m_inboxFileStream->close();
|
||||||
|
@ -1983,7 +1978,7 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||||
if (destIFolder != nsnull)
|
if (destIFolder != nsnull)
|
||||||
destIFolder->SummaryChanged();
|
destIFolder->SummaryChanged();
|
||||||
|
|
||||||
destMailDB->Close(PR_TRUE);
|
destMailDB->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||||
}
|
}
|
||||||
// We are logging the hit with the old mailHdr, which should work, as long
|
// We are logging the hit with the old mailHdr, which should work, as long
|
||||||
// as LogRuleHit doesn't assume the new hdr.
|
// as LogRuleHit doesn't assume the new hdr.
|
||||||
|
|
|
@ -416,7 +416,7 @@ nsresult nsPop3Protocol::Initialize(nsIURI * aURL)
|
||||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||||
mailnewsUrl->GetStatusFeedback(getter_AddRefs(m_statusFeedback));
|
mailnewsUrl->GetStatusFeedback(getter_AddRefs(m_statusFeedback));
|
||||||
mailnewsUrl->GetServer(getter_AddRefs(server));
|
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);
|
m_pop3Server = do_QueryInterface(server);
|
||||||
if (m_pop3Server)
|
if (m_pop3Server)
|
||||||
m_pop3Server->GetPop3CapabilityFlags(&m_pop3ConData->capability_flags);
|
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;
|
m_pop3ConData->next_state = POP3_ERROR_DONE;
|
||||||
} // if we have a server
|
} // if we have a server
|
||||||
else
|
else
|
||||||
rv = NS_ERROR_FAILURE;
|
rv = NS_MSG_INVALID_OR_MISSING_SERVER;
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,18 +84,18 @@ NS_IMETHODIMP nsPop3Service::CheckForNewMail(nsIMsgWindow* aMsgWindow,
|
||||||
|
|
||||||
server = do_QueryInterface(popServer);
|
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));
|
rv = server->GetHostName(getter_Copies(popHost));
|
||||||
if (NS_FAILED(rv)) return rv;
|
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);
|
rv = server->GetPort(&popPort);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
rv = server->GetUsername(getter_Copies(popUser));
|
rv = server->GetUsername(getter_Copies(popUser));
|
||||||
if (NS_FAILED(rv)) return rv;
|
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;
|
nsXPIDLCString escapedUsername;
|
||||||
*((char**)getter_Copies(escapedUsername)) =
|
*((char**)getter_Copies(escapedUsername)) =
|
||||||
|
@ -139,11 +139,11 @@ nsresult nsPop3Service::GetNewMail(nsIMsgWindow *aMsgWindow, nsIUrlListener * aU
|
||||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||||
server = do_QueryInterface(popServer);
|
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));
|
rv = server->GetHostName(getter_Copies(popHost));
|
||||||
if (NS_FAILED(rv)) return rv;
|
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);
|
rv = server->GetPort(&popPort);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
@ -156,7 +156,7 @@ nsresult nsPop3Service::GetNewMail(nsIMsgWindow *aMsgWindow, nsIUrlListener * aU
|
||||||
nsEscape(popUser, url_XAlphas);
|
nsEscape(popUser, url_XAlphas);
|
||||||
if (NS_FAILED(rv)) return rv;
|
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 )
|
if (NS_SUCCEEDED(rv) && popServer )
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче