Bug 452296 - "Old sent box not imported after updating Eudora" [r+sr=bienvenu]
authorJeff Beckley <beckley@qualcomm.com>
Tue, 21 Oct 2008 09:02:51 +0100
changeset 658 7ac0a06fb2be4b2ad9cd293571aa9d0e3691e832
parent 657 d6fb01b2f85b51d9a95df5917f7f2a1bb80a0ced
child 659 4515bf6e257af8c591f2dcf08c29ed5bce331f8a
push idunknown
push userunknown
push dateunknown
bugs452296
Bug 452296 - "Old sent box not imported after updating Eudora" [r+sr=bienvenu]
mailnews/import/eudora/src/nsEudoraImport.cpp
mailnews/import/src/nsImportMail.cpp
--- a/mailnews/import/eudora/src/nsEudoraImport.cpp
+++ b/mailnews/import/eudora/src/nsEudoraImport.cpp
@@ -622,17 +622,17 @@ NS_IMETHODIMP ImportEudoraMailImpl::GetI
   *pDoneSoFar = m_bytes;
   return( NS_OK);
 }
 
 
 NS_IMETHODIMP ImportEudoraMailImpl::TranslateFolderName(const nsAString & aFolderName, nsAString & _retval)
 {
   if (aFolderName.Equals(NS_LITERAL_STRING("Out"), nsCaseInsensitiveStringComparator()))
-    _retval = NS_LITERAL_STRING(kDestUnsentMessagesFolderName);
+    _retval = NS_LITERAL_STRING(kDestSentFolderName);
   else if (aFolderName.Equals(NS_LITERAL_STRING("In"), nsCaseInsensitiveStringComparator()))
     _retval = NS_LITERAL_STRING(kDestInboxFolderName);
   else
     _retval = aFolderName;
   return NS_OK;
 }
 
 nsresult ImportEudoraAddressImpl::Create(nsIImportAddressBooks** aImport)
--- a/mailnews/import/src/nsImportMail.cpp
+++ b/mailnews/import/src/nsImportMail.cpp
@@ -872,42 +872,43 @@ ImportMailThread( void *stuff)
       box->GetDisplayName( &pName);
       if (pName) {
         lastName = pName;
         NS_Free( pName);
       }
       else
         lastName.AssignLiteral("Unknown!");
 
-            // translate the folder name if we are doing migration
-            if (pData->performingMigration)
-                pData->mailImport->TranslateFolderName(lastName, lastName);
+      // translate the folder name if we are doing migration, but
+      // only for special folders which are at the root level
+      if (pData->performingMigration && depth == 1)
+        pData->mailImport->TranslateFolderName(lastName, lastName);
 
       exists = PR_FALSE;
       rv = curProxy->ContainsChildNamed( lastName, &exists);
 
-            // If we are performing profile migration (as opposed to importing) then we are starting
-            // with empty local folders. In that case, always choose to over-write the existing local folder
-            // with this name. Don't create a unique subfolder name. Otherwise you end up with "Inbox, Inbox0"
-            // or "Unsent Folders, UnsentFolders0"
-            if (exists && !pData->performingMigration) {
+      // If we are performing profile migration (as opposed to importing) then we are starting
+      // with empty local folders. In that case, always choose to over-write the existing local folder
+      // with this name. Don't create a unique subfolder name. Otherwise you end up with "Inbox, Inbox0"
+      // or "Unsent Folders, UnsentFolders0"
+      if (exists && !pData->performingMigration) {
         nsString subName;
         curProxy->GenerateUniqueSubfolderName( lastName, nsnull, subName);
         if (!subName.IsEmpty())
           lastName.Assign(subName);
       }
 
       IMPORT_LOG1("ImportMailThread: Creating new import folder '%s'.", NS_ConvertUTF16toUTF8(lastName).get());
-            curProxy->CreateSubfolder( lastName, nsnull); // this may fail if the folder already exists..that's ok
+      curProxy->CreateSubfolder( lastName, nsnull); // this may fail if the folder already exists..that's ok
 
-        rv = curProxy->GetChildNamed(lastName, getter_AddRefs(newFolder));
-        if (NS_SUCCEEDED(rv))
-          newFolder->GetFilePath(getter_AddRefs(outBox));
-        else
-          IMPORT_LOG1("*** ImportMailThread: Failed to locate subfolder '%s' after it's been created.", lastName.get());
+      rv = curProxy->GetChildNamed(lastName, getter_AddRefs(newFolder));
+      if (NS_SUCCEEDED(rv))
+        newFolder->GetFilePath(getter_AddRefs(outBox));
+      else
+        IMPORT_LOG1("*** ImportMailThread: Failed to locate subfolder '%s' after it's been created.", lastName.get());
 
       if (NS_FAILED( rv)) {
         nsImportGenericMail::ReportError(IMPORT_ERROR_MB_CREATE, lastName.get(), &error, pBundle);
       }
 
       if (size && import && newFolder && outBox && NS_SUCCEEDED( rv)) {
         PRBool fatalError = PR_FALSE;
         pData->currentSize = size;