Bug 544807 - Import from Eudora filter rules does not translate URL-style rules; Fix bundle variable declaration location.
authorJeff Beckley <beckley@qualcomm.com>
Tue, 23 Feb 2010 12:45:00 +0100
changeset 4994 ded4820bb27446e95e8e1e5d69c23533b8b93215
parent 4993 23896dd2b8755a87baf1a7078cf9eb237387c96a
child 4995 7a592c39b8325f22279e51ad9e5548c1fa32de32
push idunknown
push userunknown
push dateunknown
bugs544807
Bug 544807 - Import from Eudora filter rules does not translate URL-style rules; Fix bundle variable declaration location. r+sr=bienvenu.
mailnews/import/eudora/src/nsEudoraFilters.cpp
--- a/mailnews/import/eudora/src/nsEudoraFilters.cpp
+++ b/mailnews/import/eudora/src/nsEudoraFilters.cpp
@@ -45,16 +45,17 @@
 #include "nsCRTGlue.h"
 #include "nspr.h"
 #include "plstr.h"
 #include "nsMsgBaseCID.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsIMsgFilterList.h"
 #include "nsIMsgAccountManager.h"
+#include "nsIStringBundle.h"
 
 #include "nsEudoraFilters.h"
 #include "nsEudoraStringBundle.h"
 
 #include "nsNetUtil.h"
 #include "nsILineInputStream.h"
 #include "EudoraDebugLog.h"
 
@@ -366,20 +367,37 @@ nsresult nsEudoraFilters::Init()
   NS_ENSURE_SUCCESS(rv, rv);
 
   // we need to call GetSubFolders() so that the folders get initialized
   // if they are not initialized yet.
   nsCOMPtr<nsISimpleEnumerator> enumerator;
   rv = localRootFolder->GetSubFolders(getter_AddRefs(enumerator));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  localRootFolder->GetChildNamed(NS_LITERAL_STRING("Eudora Mail"), getter_AddRefs(m_pMailboxesRoot));
+  // Get the name of the folder where one-off imported mail is placed
+  nsAutoString folderName(NS_LITERAL_STRING("Eudora Import"));
+  nsCOMPtr<nsIStringBundleService> bundleService(do_GetService(
+                                     NS_STRINGBUNDLE_CONTRACTID, &rv));
+  if (NS_SUCCEEDED(rv))
+  {
+    nsCOMPtr<nsIStringBundle> bundle;
+    rv = bundleService->CreateBundle("chrome://messenger/locale/importMsgs.properties",
+                                     getter_AddRefs(bundle));
+    if (NS_SUCCEEDED(rv))
+    {
+      nsAutoString Eudora(NS_LITERAL_STRING("Eudora"));
+      const PRUnichar *moduleName[] = { Eudora.get() };
+      rv = bundle->FormatStringFromName(NS_LITERAL_STRING("ImportModuleFolderName").get(),
+                                        moduleName, 1, getter_Copies(folderName));
+    }
+  }
+  localRootFolder->GetChildNamed(folderName, getter_AddRefs(m_pMailboxesRoot));
   if (!m_pMailboxesRoot)
   {
-    // If no "Eudora Mail" folder then this is a
+    // If no "Eudora Import" folder then this is a
     // migration which just puts it in the root
     m_pMailboxesRoot = localRootFolder;
   }
 
   return rv;
 }
 
 nsresult nsEudoraFilters::LoadServers()
@@ -548,21 +566,21 @@ nsresult nsEudoraFilters::EnableFilter(P
     filter->SetEnabled(enable);
   }
 
   return NS_OK;
 }
 
 // Different character sets on Windows and Mac put left and right double angle quotes in different spots
 #if defined(XP_WIN) || defined(XP_OS2)
-#define LDAQ "«"
-#define RDAQ "»"
+#define LDAQ "\xAB"
+#define RDAQ "\xBB"
 #elif XP_MACOSX
-#define LDAQ "Ç"
-#define RDAQ "È"
+#define LDAQ "\xC7"
+#define RDAQ "\xC8"
 #endif
 
 static const char* gStandardHeaders[] =
 {
 // Eudora string        nsMsgSearchAttribValue
 // -------------        ----------------------
     "Subject:",              // Subject
     "From:",                 // Sender