Fix for bug 131853. Import fails if local folders doesnot exist

r=naving, sr=sspitzer, a=asa
This commit is contained in:
srilatha%netscape.com 2002-04-03 15:39:31 +00:00
Родитель 5c86f60b5d
Коммит 66cf373e7f
1 изменённых файлов: 16 добавлений и 0 удалений

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

@ -59,6 +59,7 @@
#include "nsIFileSpec.h"
#include "nsIMsgAccountManager.h"
#include "nsIMessengerMigrator.h"
#include "nsIMsgMailSession.h"
#include "nsMsgBaseCID.h"
#include "nsIMsgFolder.h"
@ -997,6 +998,21 @@ PRBool nsImportGenericMail::CreateFolder( nsIMsgFolder **ppFolder)
nsCOMPtr <nsIMsgIncomingServer> server;
rv = accMgr->GetLocalFoldersServer(getter_AddRefs(server));
// if Local Folders does not exist already, create it
if (NS_FAILED(rv) || !server)
{
nsCOMPtr <nsIMessengerMigrator> messengerMigrator = do_GetService(NS_MESSENGERMIGRATOR_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
IMPORT_LOG0( "*** Failed to create messenger migrator!\n");
return PR_FALSE;
}
rv = messengerMigrator->CreateLocalMailAccount(PR_FALSE);
if (NS_FAILED(rv)) {
IMPORT_LOG0( "*** Failed to create Local Folders!\n");
return PR_FALSE;
}
rv = accMgr->GetLocalFoldersServer(getter_AddRefs(server));
}
if (NS_SUCCEEDED(rv) && server) {
nsCOMPtr <nsIMsgFolder> localRootFolder;
rv = server->GetRootMsgFolder(getter_AddRefs(localRootFolder));