Bug 394687 need to import settings from Windows Mail on Vista and Windows Live Mail on XP/Vista/Windows 7. r=Neil,sr=bienvenu. r=Standard8 for the unit test. a=blocker
authorPhil Lacy <philbaseless-firefox@yahoo.com>
Fri, 23 Apr 2010 11:33:57 +0100
changeset 5521 d58818b1fb319986dc1b2cb01d506a0d58ef1897
parent 5520 43670c7cbad1943f897080fc6fbe20ba012f8226
child 5522 9ee938f84566d0640abac14bc42dc8970a35a408
push id4271
push userbugzilla@standard8.plus.com
push dateFri, 23 Apr 2010 10:34:31 +0000
treeherdercomm-central@d58818b1fb31 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil, bienvenu, Standard8, blocker
bugs394687
Bug 394687 need to import settings from Windows Mail on Vista and Windows Live Mail on XP/Vista/Windows 7. r=Neil,sr=bienvenu. r=Standard8 for the unit test. a=blocker
mail/locales/en-US/chrome/messenger/wmImportMsgs.properties
mail/locales/jar.mn
mailnews/import/Makefile.in
mailnews/import/build/Makefile.in
mailnews/import/build/nsImportModule.cpp
mailnews/import/test/unit/resources/WindowsLiveMail/MicrosoftCommunities/account{2E23}.oeaccount
mailnews/import/test/unit/resources/WindowsLiveMail/donhallimap/donhallimap{testimap}.oeaccount
mailnews/import/test/unit/resources/WindowsLiveMail/donhallnntp/donhallnntp{testnntp}.oeaccount
mailnews/import/test/unit/resources/WindowsLiveMail/news.mozilla.org/account{B3B3}.oeaccount
mailnews/import/test/unit/resources/WindowsLiveMail/pop3.test.test/account{D244}.oeaccount
mailnews/import/test/unit/test_winmail.js
mailnews/import/winlivemail/Makefile.in
mailnews/import/winlivemail/WMDebugLog.h
mailnews/import/winlivemail/nsWMImport.cpp
mailnews/import/winlivemail/nsWMImport.h
mailnews/import/winlivemail/nsWMSettings.cpp
mailnews/import/winlivemail/nsWMSettings.h
mailnews/import/winlivemail/nsWMStringBundle.cpp
mailnews/import/winlivemail/nsWMStringBundle.h
mailnews/makefiles.sh
suite/locales/en-US/chrome/mailnews/wmImportMsgs.properties
suite/locales/jar.mn
copy from mail/locales/en-US/chrome/messenger/oeImportMsgs.properties
copy to mail/locales/en-US/chrome/messenger/wmImportMsgs.properties
--- a/mail/locales/en-US/chrome/messenger/oeImportMsgs.properties
+++ b/mail/locales/en-US/chrome/messenger/wmImportMsgs.properties
@@ -30,79 +30,79 @@
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 #
-# The following are used by the outlook express import code to display status/error 
+# The following are used by the windows live mail import code to display status/error
 # and informational messages
 #
 
 # Short name of import module
-## @name OEIMPORT_NAME
+## @name WMIMPORT_NAME
 ## @loc None
 ## LOCALIZATION NOTE (2000): DONT_TRANSLATE
-2000=Outlook Express
+2000=Windows Live Mail
 
 # Description of import module
-## @name OEIMPORT_DESCRIPTION
+## @name WMIMPORT_DESCRIPTION
 ## @loc None
-## LOCALIZATION NOTE (2011): In this item, don't translate "Outlook Express"
-2011=Outlook Express mail, address books, and settings
+## LOCALIZATION NOTE (2001): In this item, don't translate "Windows Live Mail"
+2001=Windows Live Mail settings
 
 # Success message
-## @name OEIMPORT_MAILBOX_SUCCESS
+## @name WMIMPORT_MAILBOX_SUCCESS
 ## @loc None
-## LOCALIZATION NOTE (2002): In this item, don't translate "%S" or "%d"
-## The variable %S will contain the name of the Mailbox
-## The variable %d will contain the number of messages
-2002=Mailbox %S, imported %d messages
+## LOCALIZATION NOTE (2002): In this item, don't translate "%1$S" or "%2$d"
+## The variable %1$S will contain the name of the Mailbox
+## The variable %2$d will contain the number of messages
+2002=Mailbox %1$S, imported %2$d messages
 
 # Error message
-## @name OEIMPORT_MAILBOX_BADPARAM
+## @name WMIMPORT_MAILBOX_BADPARAM
 ## @loc None
 2003=Bad parameter passed to import mailbox.
 
 # Error message
-## @name OEIMPORT_MAILBOX_BADSOURCEFILE
+## @name WMIMPORT_MAILBOX_BADSOURCEFILE
 ## @loc None
 ## LOCALIZATION NOTE (2004): In this item, don't translate "%S"
 ## The variable %S will contain the name of the Mailbox
 2004=Error accessing file for mailbox %S.
 
 # Error message
-## @name OEIMPORT_MAILBOX_CONVERTERROR
+## @name WMIMPORT_MAILBOX_CONVERTERROR
 ## @loc None
 ## LOCALIZATION NOTE (2005): In this item, don't translate "%S"
 ## The variable %S will contain the name of the Mailbox
 2005=Error importing mailbox %S, all messages may not be imported from this mailbox.
 
 # Default name of imported addressbook
-## @name OEIMPORT_DEFAULT_NAME
+## @name WMIMPORT_DEFAULT_NAME
 ## @loc None
-2006=Outlook Express Address Book
+2006=Windows Live Mail Address Book
 
 # Autofind description
-## @name OEIMPORT_AUTOFIND
+## @name WMIMPORT_AUTOFIND
 ## @loc None
-2007=Outlook Express address book (windows address book)
+2007=Windows Live Mail address book (windows address book)
 
 # Description
-## @name OEIMPORT_ADDRESS_SUCCESS
+## @name WMIMPORT_ADDRESS_SUCCESS
 ## @loc None
 ## LOCALIZATION NOTE (2006): In this item, don't translate "%S"
 ## The variable %S will receive the name of the address book
 2008=Imported address book %S
 
 # Error message
-## @name OEIMPORT_ADDRESS_CONVERTERROR
+## @name WMIMPORT_ADDRESS_CONVERTERROR
 ## @loc None
 ## LOCALIZATION NOTE (2009): In this item, don't translate "%S"
 ## The variable %S will receive the name of the address book
 2009=Error importing address book %S, all addresses may not have been imported.
 
 # Error message
-## @name OEIMPORT_ADDRESS_BADPARAM
+## @name WMIMPORT_ADDRESS_BADPARAM
 ## @loc None
 2010=Bad parameter passed to import addressbook.
--- a/mail/locales/jar.mn
+++ b/mail/locales/jar.mn
@@ -88,16 +88,17 @@
   locale/@AB_CD@/messenger/importMsgs.properties                        (%chrome/messenger/importMsgs.properties)
   locale/@AB_CD@/messenger/importDialog.dtd                             (%chrome/messenger/importDialog.dtd)
   locale/@AB_CD@/messenger/fieldMapImport.dtd                           (%chrome/messenger/fieldMapImport.dtd)
   locale/@AB_CD@/messenger/textImportMsgs.properties                    (%chrome/messenger/textImportMsgs.properties)
   locale/@AB_CD@/messenger/appleMailImportMsgs.properties               (%chrome/messenger/appleMailImportMsgs.properties)
   locale/@AB_CD@/messenger/comm4xMailImportMsgs.properties              (%chrome/messenger/comm4xMailImportMsgs.properties)
   locale/@AB_CD@/messenger/eudoraImportMsgs.properties                  (%chrome/messenger/eudoraImportMsgs.properties)
   locale/@AB_CD@/messenger/oeImportMsgs.properties                      (%chrome/messenger/oeImportMsgs.properties)
+  locale/@AB_CD@/messenger/wmImportMsgs.properties                      (%chrome/messenger/wmImportMsgs.properties)
   locale/@AB_CD@/messenger/outlookImportMsgs.properties                 (%chrome/messenger/outlookImportMsgs.properties)
   locale/@AB_CD@/messenger/shutdownWindow.properties                    (%chrome/messenger/shutdownWindow.properties)
   locale/@AB_CD@/messenger/featureConfigurator.dtd                      (%chrome/messenger/featureConfigurator.dtd)
   locale/@AB_CD@/messenger/configEditorOverlay.dtd                      (%chrome/messenger/configEditorOverlay.dtd)
   locale/@AB_CD@/messenger/gloda.properties                             (%chrome/messenger/gloda.properties)
   locale/@AB_CD@/messenger/glodaComplete.properties                     (%chrome/messenger/glodaComplete.properties)
   locale/@AB_CD@/messenger/templateUtils.properties                     (%chrome/messenger/templateUtils.properties)
   locale/@AB_CD@/messenger/glodaFacetView.properties                    (%chrome/messenger/glodaFacetView.properties)
--- a/mailnews/import/Makefile.in
+++ b/mailnews/import/Makefile.in
@@ -48,17 +48,17 @@ PARALLEL_DIRS	= public src text/src comm
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 PARALLEL_DIRS	+= eudora/src applemail/src
 endif
 
 ifeq ($(OS_ARCH),WINNT)
 PARALLEL_DIRS	+= eudora/src
 ifndef GNU_CC
-PARALLEL_DIRS	+= oexpress outlook/src
+PARALLEL_DIRS	+= oexpress outlook/src winlivemail
 endif
 endif
 
 ifdef ENABLE_TESTS
 PARALLEL_DIRS	+= test
 endif
 
 DIRS = build
--- a/mailnews/import/build/Makefile.in
+++ b/mailnews/import/build/Makefile.in
@@ -64,41 +64,42 @@ ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 REQUIRES += impEudra impapplemail
 endif
 
 ifeq ($(OS_ARCH),WINNT)
 REQUIRES += impEudra
 
 ifndef GNU_CC
 
-REQUIRES += importOE impOutlk
+REQUIRES += importOE impOutlk importWM
 
 endif
 
 endif
 
-CPPSRCS		=  nsImportModule.cpp  
+CPPSRCS		=  nsImportModule.cpp
 
 SHARED_LIBRARY_LIBS = \
 		../src/$(LIB_PREFIX)import_s.$(LIB_SUFFIX) \
 		../text/src/$(LIB_PREFIX)imptext_s.$(LIB_SUFFIX) \
 		../comm4x/src/$(LIB_PREFIX)imp4mail_s.$(LIB_SUFFIX) \
 		$(NULL)
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 SHARED_LIBRARY_LIBS += ../eudora/src/$(LIB_PREFIX)impEudra_s.$(LIB_SUFFIX)
 SHARED_LIBRARY_LIBS += ../applemail/src/$(LIB_PREFIX)applmail_s.$(LIB_SUFFIX)
 endif
 
 ifeq ($(OS_ARCH),WINNT)
-SHARED_LIBRARY_LIBS += ../eudora/src/$(LIB_PREFIX)impEudra_s.$(LIB_SUFFIX) 
+SHARED_LIBRARY_LIBS += ../eudora/src/$(LIB_PREFIX)impEudra_s.$(LIB_SUFFIX)
 
 ifndef GNU_CC
-SHARED_LIBRARY_LIBS += ../oexpress/$(LIB_PREFIX)importOE_s.$(LIB_SUFFIX) 
-SHARED_LIBRARY_LIBS += ../outlook/src/$(LIB_PREFIX)impOutlk_s.$(LIB_SUFFIX) 
+SHARED_LIBRARY_LIBS += ../oexpress/$(LIB_PREFIX)importOE_s.$(LIB_SUFFIX)
+SHARED_LIBRARY_LIBS += ../outlook/src/$(LIB_PREFIX)impOutlk_s.$(LIB_SUFFIX)
+SHARED_LIBRARY_LIBS += ../winlivemail/$(LIB_PREFIX)importWM_s.$(LIB_SUFFIX)
 endif
 
 endif
 
 LOCAL_INCLUDES += -I$(srcdir)/../src \
 	-I$(srcdir)/../comm4x/src \
 	-I$(srcdir)/../text/src \
 	$(NULL)
@@ -109,16 +110,17 @@ LOCAL_INCLUDES += -I$(srcdir)/../eudora/
 									$(NULL)
 endif
 
 ifeq ($(OS_ARCH),WINNT)
 LOCAL_INCLUDES += -I$(srcdir)/../eudora/src
 ifndef GNU_CC
 LOCAL_INCLUDES += -I$(srcdir)/../oexpress \
 	-I$(srcdir)/../outlook/src \
+	-I$(srcdir)/../winlivemail  \
 	$(NULL)
 endif
 endif
 
 ifdef MOZ_STATIC_MAIL_BUILD
 EXTRA_DSO_LDOPTS += ../../base/util/$(LIB_PREFIX)msgbsutl_s.$(LIB_SUFFIX)
 else
 ifeq ($(USE_SHORT_LIBNAME),1)
--- a/mailnews/import/build/nsImportModule.cpp
+++ b/mailnews/import/build/nsImportModule.cpp
@@ -90,19 +90,22 @@ static NS_DEFINE_CID(kAppleMailImportCID
 // outlook import Include Files
 ////////////////////////////////////////////////////////////////////////////////
 #ifdef XP_WIN
 #if defined(_MSC_VER) && _MSC_VER >= 1100
 #include "nsOEImport.h"
 #include "nsOEStringBundle.h"
 #include "nsOutlookImport.h"
 #include "nsOutlookStringBundle.h"
+#include "nsWMImport.h"
+#include "nsWMStringBundle.h"
 
 static NS_DEFINE_CID(kOEImportCID,         NS_OEIMPORT_CID);
 static NS_DEFINE_CID(kOutlookImportCID,      NS_OUTLOOKIMPORT_CID);
+static NS_DEFINE_CID(kWMImportCID,         NS_WMIMPORT_CID);
 #endif
 
 #endif // XP_WIN
 
 ////////////////////////////////////////////////////////////////////////////////
 // core import factories
 ////////////////////////////////////////////////////////////////////////////////
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsImportService)
@@ -211,16 +214,17 @@ NS_METHOD AppleMailRegister(nsIComponent
 // outlook import factories
 ////////////////////////////////////////////////////////////////////////////////
 #ifdef XP_WIN
 
 #if defined(_MSC_VER) && _MSC_VER >= 1100
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsOEImport)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsOutlookImport)
+NS_GENERIC_FACTORY_CONSTRUCTOR(nsWMImport)
 
 NS_METHOD OERegister(nsIComponentManager *aCompMgr,
                      nsIFile *aPath,
                      const char *registryLocation,
                      const char *componentType,
                      const nsModuleComponentInfo *info)
 {
   nsresult rv;
@@ -231,16 +235,37 @@ NS_METHOD OERegister(nsIComponentManager
     char *theCID = kOEImportCID.ToString();
     rv = catMan->AddCategoryEntry( "mailnewsimport", theCID, kOESupportsString, PR_TRUE, PR_TRUE, getter_Copies( replace));
     NS_Free( theCID);
   }
 
     return( rv);
 }
 
+NS_METHOD WMRegister(nsIComponentManager *aCompMgr,
+                     nsIFile *aPath,
+                     const char *registryLocation,
+                     const char *componentType,
+                     const nsModuleComponentInfo *info)
+{
+  nsresult rv;
+
+  nsCOMPtr<nsICategoryManager> catMan = do_GetService(NS_CATEGORYMANAGER_CONTRACTID,
+                                                      &rv);
+  if (NS_SUCCEEDED(rv)) {
+    nsCString replace;
+    char *theCID = kWMImportCID.ToString();
+    rv = catMan->AddCategoryEntry("mailnewsimport", theCID, kWMSupportsString,
+                                  PR_TRUE, PR_TRUE, getter_Copies(replace));
+    NS_Free(theCID);
+  }
+
+    return( rv);
+}
+
 NS_METHOD OutlookRegister(nsIComponentManager *aCompMgr,
                           nsIFile *aPath, const char *registryLocation,
                           const char *componentType,
                           const nsModuleComponentInfo *info)
 {
   nsresult rv;
 
   nsCOMPtr<nsICategoryManager> catMan = do_GetService( NS_CATEGORYMANAGER_CONTRACTID, &rv);
@@ -302,16 +327,18 @@ static const nsModuleComponentInfo compo
 
 #ifdef XP_WIN
 #if defined(_MSC_VER) && _MSC_VER >= 1100
     ////////////////////////////////////////////////////////////////////////////////
     // oexpress import components
     ////////////////////////////////////////////////////////////////////////////////
     ,{ "Outlook Express Import Component", NS_OEIMPORT_CID,
     "@mozilla.org/import/import-oe;1", nsOEImportConstructor,  OERegister,  nsnull },
+    { "Windows Live Mail Import Component", NS_WMIMPORT_CID,
+    "@mozilla.org/import/import-wm;1", nsWMImportConstructor,  WMRegister,  nsnull },
     { "Outlook Import Component", NS_OUTLOOKIMPORT_CID,
     "@mozilla.org/import/import-outlook;1", nsOutlookImportConstructor, OutlookRegister, nsnull }
 #endif
 #endif
 
 };
 
 
@@ -320,16 +347,17 @@ static void importModuleDtor(nsIModule* 
 #if defined(XP_WIN) || defined(XP_MACOSX)
     nsEudoraStringBundle::Cleanup();
 #endif
 
 #ifdef XP_WIN
 
 #if defined(_MSC_VER) && _MSC_VER >= 1100
     nsOEStringBundle::Cleanup();
+    nsWMStringBundle::Cleanup();
     nsOutlookStringBundle::Cleanup();
 #endif
 
 #endif
 }
 
 NS_IMPL_NSGETMODULE_WITH_DTOR( nsImportServiceModule, components, importModuleDtor)
 
new file mode 100644
index 0000000000000000000000000000000000000000..545d6470daa4afb357602a857c5b241e8a6d43c2
GIT binary patch
literal 690
zc$|%r-Ae*d5XH}P(Eo7hy;T#+U{g$Ag0e^>>_y7eSZKF!*FOIF>UYQO!Hb3r_hV+x
z%sKbt=Q~zMpUU(ir+3Y?P@z<>%5|m#H594N>d54p5>LqHdbaFRrRF*Wb!?c9+S=Ei
zVqJkRut$(Hb*c2VODf9><0^}T>_h{qGO8Tjm)_WUuAv^7+jLGrFTfX!IT)uNyA1Ok
zQX;9bJB@5D;izq83DsN@FAQ-9cY;@fN&+?Kx}ZZ>w;G$OBjQb+7{0}LLRrfgPr1K_
zDcIIIRM4~A&&f^gEZ&=NmKFQDj=t`7jf%dhsIOVmSpV-9au2YPZa@s}FRXsV=9eg|
d+s&AL{}0v(FMOZK?maU#oBRL$n%WNk<`+c{aaI5T
new file mode 100644
index 0000000000000000000000000000000000000000..7ff7a664d9143fc911045e1e9bbb4668ddd2cd10
GIT binary patch
literal 4422
zc$~dhTWi}e6h6;`{Rgx6UP9SmkhKj<#xl00BpHFd7&mr1GsiJ;dfSiR_UYKBk>Vpu
zWDJ9ySm(P)I!99S=Xakj=#f^GQ9$>U(1uD%X-zr3qgT|UV>-n%Kub<bypPeE(=E5&
z(UxxL2vKi1=7P@YCB2|NeL;MQD?(&K10WUl4#;gC6VzAVXbtHrP%EGUe0!n-pOn^&
zzT<uledX;3VlrGQA|u4~=|to)_1-f>j+Q0js=kIaueEg5AuVV^Q#_USsdk;Qs-4Z$
z9%Ez%bcKi+k99TT?LAdJOVP(;dZ@=-@fWzS5nbZF>g|eMwDZd9-+)&UZlkR$>|?uh
zl&chORd1fGBiw7%(($s|72IyXZc{kJTT`XM*=K8s%-XP<wmJ9dRX3aLWX?ICaGu+H
z`W98G>*`opV~U71*U$$%Gh~6BrDM3gM%1IB)y`p`yQ-p9ru&Shj<n6;JsceI`WDw&
zRq&{%yqf4vOV1hg<F;p7wSJ9pPcUDl(>ye|U<bFKb#`Xi)ex-_*7~iZo85Tbh0J8j
zjSa7K1-rlDYE^F|-eVs4d)%>dn>pjcXd91|R}A}VW~x4;y6Ygs_w2x|?BcTZFF{<w
zc@lf)qK=j`(p5$F`H6S?pZGLF^))-Di^m2TXh_|k3%lv<Gu}qL|Aydc5EDKX$a{X<
zJi0QO4yHVY>l(ShSt((RIV)ZIZal8)BkT|b=l@~qI*+No+p3&Kd{VNhy=Jv`oXI}J
zJj@+WZzbGs@z&+^*3K)d`=8!y*e)I4)0-VHtGS%sdN|eS8q(QKAJaq6Za!?X6aTZD
zgq1ba9#euf;~ehFkYU~bkM-{<T~p$c)h8I2TSVnR{=)P57m?k^LaUJgY*m%$e!AIZ
zXQQ3<dw|M_c?Qe9)j_YFORwscHDq6Eoh!I9Lhkkdaq6RLtE?1yInP8@5$z85Yskde
TR)v3a_VZ<I{>eCT_%GuxCLhbr
new file mode 100644
index 0000000000000000000000000000000000000000..e9b5fc8196d4209d1c93c099259f5b803f076392
GIT binary patch
literal 2696
zc$}S9%TB^T6g_Jb|DkcOq9m>mHDc6-LI7jpra?d@p`|Gz;>W9J?zGVvJJZ%o(%0O3
z&V5h6K3h1!J0i>x;0;rxSYn0+VjN=!2iQY{_kcSw#{53vZj5KyUEvi^*rn8w$ef^!
zZET^18_F-aMwFc5jG9V!Ma|btCdgLH+6{3_t%zCy-!@42q__rn;I&PDW!np7=3KGp
zBt+SF;@EuWf)I0OOgZgqh+)QMvUYHfF8aJH?uN0N!s<t}xo^3K=uu)IvDOhU_Ecf6
z8N)qZb<7oh!s~+4>bvqb5-W;v-RyVNR}$5tZ8H4TE#pyE&1mh68QXXxd{D?`>bu!`
zv^FKWkKvGcYg#P1o<Cb-R#qz36y>~*SLJAKONNwCF<(gc`B<C8GkHy2H%EtZOQO!1
z-%V+abTa?1vYs?KU081RF5~h{shFA{y#I8S-;R5uO9G<lJ~8bnM|WFx!Tpg`VaRDS
z;YzbP=j)!+TK((haNE_VL?XQrir3XGH7n*n_SWIHJ;=NJk`k&W6R8&^JLVV7t+V5|
zTlZHTH2(}yRjeaWr>jj(Kf_XNDPuS+VEEDWO{*FAW2tUEWs2*w@n<gCdOj~wsfI+(
z+9#Qy>gz}{y_WY$$!ThPR|T=?G>^De($Ok5(@ND+tY@R=>`8V)gz{$-;jzZ)`Qq%T
oyib02R#nC-XZtldbsQsO(hc~mbL@|leNNUx&i@7XEBp<916>WfI{*Lx
new file mode 100644
index 0000000000000000000000000000000000000000..f17de718ae534bca763ca26fd1ec9ed3bf9555f7
GIT binary patch
literal 960
zc$|%s%}T>i5QWcL@EwAC+epA7#MWwD2wKHfL^mNMQG_H)lUD1)t6y$YF(FYI@-s7M
z<{akE{rqq>(wkBxvb0pJxpF<}S(y&CqdoOx^R>ui3W-N#Gd-H@LWLf*3u@nBMjC2c
zTXJ;)KF0!(vBp%EwF@eX3S(8~HnP4ZRHal|cq_f|S8`2t&wEJjCpxRJDUo-SC0IZ-
z)+_9;`kmdID$a@L25|#tgjaxy8Y+%;Mu)Mkb!XHJn9czxhbP8!;2JQKkf_aEN(Eh=
zn+i_M)JyFli1iuxnpNy|9iDD=i3-oCuxsWR*5A7|xhL36S0JWl2iBX=egcI#+v0o5
zy~gx=cyrFZRMFnIo86;J4rAG8_2({Zl+>BJdUUg%k`Ii2pR<jyd9}aoyzSd|WNyZi
WNWx#l9O`~uWjE*M4)y<Wi@pG8U7oN2
new file mode 100644
index 0000000000000000000000000000000000000000..5ec08c49452850dca2a3973c025b2f1873e2bbfa
GIT binary patch
literal 1478
zc$}qFO;3YB6r8h(|ABb7rD@^`TaERo5?f>9g^<!3A_c-nl|Qe}F5B3pY@sommSx|Y
znYY8+{rPq<#TPb+U}1|DGUN!6AjUN=Fv0*fpB5uAmRt`Qjqxs{B?_!@$*e1xGsOhw
zID>-+=I0zfGgr7JQeaCW3zcK3;WVNi9*NozW$~>-%9+rb<Bk6lt_kLX>j{6phK&`{
z!O+OsRKJsZjTu=ouim+bg;LgQnBf&qc;-`7Vrye8RgbeZwOz8gM0(tvaK84xec$zd
z$NU~U2mWS4xt+_b_(G(}IL+@;q4u3V#@VGWstxH?$o{KNaNBNG*4d7^{lT1+Grddt
z>yHjRZ)Y^u;L@jr9;LE7*PLf^)tBeyQ@#iPsHh)*v%Wb`?t)o;Ix;7_=!=2s4ZR=R
znap}K`j?X>Vue*_SJsMwhS~4QZeDXG_l*0phs4(mI5Ksc^*JFo@_yWsA>u5cEBd=$
Nomp#llMZ{_rN5|l@7DkT
new file mode 100644
--- /dev/null
+++ b/mailnews/import/test/unit/test_winmail.js
@@ -0,0 +1,214 @@
+const IMPORTNAME = 'Windows Live Mail';
+const IMPORTTYPE = 'settings';
+
+function run_test()
+{
+  if (!("nsIWindowsRegKey" in Ci))
+    return;
+
+//////////////// -- Modified nsIWindowsRegKey implementation ---
+  Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+
+  function MockWindowsRegKey() {
+  }
+  MockWindowsRegKey.prototype = {
+    QueryInterface: XPCOMUtils.generateQI([Ci.nsIWindowsRegKey]),
+
+    open: function(aRootKey, aRelPath, aMode) {
+      var f = do_get_file("resources/WindowsLiveMail");
+      this._rootkey = aRootKey;
+      this._keypath = aRelPath;
+      if (aRelPath == "Software\\Microsoft\\Windows Live Mail" ||
+          aRelPath == "Software\\Microsoft\\Windows Mail") {
+        this["Default Mail Account"] = "fill in mail account";
+        this["Default News Account"] = "fill in news account";
+        this["Store Root"] = f.path;
+      }
+    },
+    close: function() {
+    },
+    openChild: function(aRelPath, aMode) {
+      child = new MockWindowsRegKey();
+      child._rootkey = this._rootkey;
+      child._keypath = this._keypath + "\\" + aRelPath;
+      if (aRelPath == "mail")
+        child["Poll For Mail"] = 123456;
+      return child;
+    },
+    readIntValue: function(aName) {
+      return this[aName];
+    },
+    readStringValue: function(aName) {
+      return this[aName];
+    }
+  };
+
+  var factory = {
+    createInstance: function(aOuter, aIid) {
+      if (aOuter != null)
+        do_throw(Cr.NS_ERROR_NO_AGGREGATION);
+
+      var key = new MockWindowsRegKey();
+      return key.QueryInterface(aIid);
+    }
+  };
+
+  Components.manager.QueryInterface(Ci.nsIComponentRegistrar)
+            .registerFactory(Components.ID("{0478de5b-0f38-4edb-851d-4c99f1ed8eba}"),
+                             "Mock Windows Registry Implementation",
+                             "@mozilla.org/windows-registry-key;1", factory);
+//////////////// -- Modified nsIWindowsRegKey implementation ---
+
+  var importedPrefs = [];
+  var prefS = Cc["@mozilla.org/preferences-service;1"]
+               .getService(Ci.nsIPrefBranch2);
+  var obs = {
+    QueryInterface: function QueryInterface(aIID) {
+      if (aIID.equals(Ci.nsIObserver) || aaIID.equals(Ci.nsISupports))
+        return this;
+      do_throw(Cr.NS_NOINTERFACE);
+    },
+    observe: function observe(aSubj, aTopic, aData) {
+      let prefSetting = {};
+      prefSetting.name = aData;
+      switch (prefS.getPrefType(aData)) {
+        case prefS.PREF_BOOL:
+          prefSetting.data = prefS.getBoolPref(aData);
+          break;
+        case prefS.PREF_INT:
+          prefSetting.data = prefS.getIntPref(adata);
+          break;
+        case prefS.PREF_STRING:
+          prefSetting.data = prefS.getCharPref(aData);
+          break;
+        case prefS.PREF_INVALID:
+        default :
+          prefSetting.data = null;
+      }
+      importedPrefs.push(prefSetting);
+    }
+  };
+  prefS.addObserver('', obs, false);
+
+  var impS = Cc["@mozilla.org/import/import-service;1"]
+              .getService(Ci.nsIImportService);
+
+/////// import
+  // There's probably a more direct way to import a known module and type but this
+  // discovery method is used by the import dialog so we'll do it this way thereby
+  // testing from the UI.
+  var c = impS.GetModuleCount(IMPORTTYPE);
+  for (var i = 0; i < c; i++) {
+    if (impS.GetModuleName(IMPORTTYPE, i) == IMPORTNAME) {
+      var mod = impS.GetModule(IMPORTTYPE, i);
+      break;
+    }
+  }
+  if (!mod)
+    do_throw("No import module");
+  var settingsI = mod.GetImportInterface(IMPORTTYPE);
+  if (settingsI)
+    settingsI = settingsI.QueryInterface(Ci.nsIImportSettings);
+  if (!settingsI)
+    do_throw("No settings interface");
+  var acct = {};
+  if (!settingsI.Import(acct))
+    do_throw("Import failed");
+///////
+  importedPrefs.sort(
+    function(a,b){
+      return (a.name < b.name ? -1 : (a.name > b.name ? 1 : 0));
+    });
+var test = "";
+// testing data--if new accounts are added, replace this with the dump 'test'.
+// change all '\' to '\\' and replace this data. This test data needs to go
+// to a file and probably be binary since we may have other invalid string
+// characters in future checks.
+
+var testdata = "mail.account.account1.serverserver2mail.account.account2.ide" +
+"ntitiesid1mail.account.account2.serverserver1mail.account.account3.identiti" +
+"esid2mail.account.account3.serverserver3mail.account.account4.identitiesid3" +
+"mail.account.account4.serverserver4mail.account.account5.identitiesid4mail." +
+"account.account5.serverserver5mail.account.account6.identitiesid5mail.accou" +
+"nt.account6.serverserver6mail.accountmanager.accountsaccount1mail.accountma" +
+"nager.accountsaccount1,account2mail.accountmanager.accountsaccount1,account" +
+"2,account3mail.accountmanager.accountsaccount1,account2,account3,account4ma" +
+"il.accountmanager.accountsaccount1,account2,account3,account4,account5mail." +
+"accountmanager.accountsaccount1,account2,account3,account4,account5,account" +
+"6mail.accountmanager.defaultaccountaccount1mail.accountmanager.localfolders" +
+"serverserver2mail.identity.id1.fullNamepopdisplaynamemail.identity.id1.orga" +
+"nizationpopdisplaynamemail.identity.id1.reply_totestpop@invalid.invalidmail" +
+".identity.id1.smtpServersmtp1mail.identity.id1.useremailtestpop@invalid.inv" +
+"alidmail.identity.id2.fullNametestmail.identity.id2.organizationtestmail.id" +
+"entity.id2.reply_tomozillanews@invalid.invalidmail.identity.id2.useremailmo" +
+"zillanews@invalid.invalidmail.identity.id4.fullNameDon Hallmail.identity.id" +
+"4.organizationWingtip Toysmail.identity.id4.reply_todon@wingtiptoys.commail" +
+".identity.id4.useremaildon@wingtiptoys.commail.identity.id5.fullNameDon Hal" +
+"lmail.identity.id5.organizationWingtip Toysmail.identity.id5.reply_todon@wi" +
+"ngtiptoys.commail.identity.id5.smtpServersmtp2mail.identity.id5.useremaildo" +
+"n@wingtiptoys.commail.newsrc_root-rel[ProfD]Newsmail.root.imap-rel[Pr" +
+"ofD]ImapMailmail.root.nntp-rel[ProfD]Newsmail.root.none-rel[ProfD]Mailmail." +
+"root.pop3-rel[ProfD]Mailmail.server.server1.check_new_mailtruemail.server.s" +
+"erver1.defer_get_new_mailfalsemail.server.server1.deferred_to_accountaccoun" +
+"t1mail.server.server1.delete_by_age_from_servertruemail.server.server1.dele" +
+"te_mail_left_on_servertruemail.server.server" +
+"1.directory-rel[ProfD]Mail/pop3.test.testmail.server.server1.hostnamepop3.t" +
+"est.testmail.server.server1.leave_on_servertruemail.server.server1.nametest" +
+"popaccountnamemail.server.server1.typepop3mail.server.server1.userNametestp" +
+"opusernamemail.server.server2.directory-rel[P" +
+"rofD]Mail/Local Foldersmail.server.server2.hostnameLocal Foldersmail.server" +
+".server2.nameLocal Foldersmail.server.server2.typenonemail.server.server2.u" +
+"serNamenobodymail.server.server3.direc" +
+"tory-rel[ProfD]News/testnews.mozilla.orgmail.server.server3.hostnametestnew" +
+"s.mozilla.orgmail.server.server3.nameaccountnamemozillanewsmail.server.serv" +
+"er3.newsrc.file-rel[ProfD]News/te" +
+"stnews.mozilla.org.rcmail.server.server3.typenntpmail.server.server4.direct" +
+"ory-rel[ProfD]News/testmsnews.micr" +
+"osoft.commail.server.server4.hostnametestmsnews.microsoft.commail.server.se" +
+"rver4.nameMicrosoft Communities Testmail.server.server4.newsrc.file-rel[Pro" +
+"fD]News/testmsnews.microsoft." +
+"com.rcmail.server.server4.typenntpmail.server.server5.always_authenticatetr" +
+"uemail.server.server5.directory-rel[Pr" +
+"ofD]News/news.wingtiptoys.commail.server.server5.hostnamenews.wingtiptoys.c" +
+"ommail.server.server5.namedonhallnntpmail.server.server5.newsrc.file-rel[Pr" +
+"ofD]News/news.wingtiptoys.com.rcm" +
+"ail.server.server5.typenntpmail.server.server5.userNamedonmail.server.serve" +
+"r6.check_new_mailtruemail.server.s" +
+"erver6.directory-rel[ProfD]ImapMail/mail.wingtiptoys.commail.server.server6" +
+".hostnamemail.wingtiptoys.commail.server.server6.namedonhallimapmail.server" +
+".server6.server_sub_directoryInboxmail.server.server6.typeimapmail.server.s" +
+"erver6.userNamedonmail.smtpserver.smtp1.hostnamesmtp.pop.testmail.smtpserve" +
+"r.smtp2.hostnamesmtp.wingtiptoys.commail.smtpserver.smtp2.usernamedonmail.s" +
+"mtpserverssmtp1mail.smtpserverssmtp1,smtp2";
+
+  // XXX These prefs are excluded from being checked because they contain
+  // relative directories, and hence make the results dependent on where
+  // the tests are run. The prefs do have relative versions which are checked.
+  const excludedPrefs = [
+    "mail.newsrc_root", "mail.root.imap", "mail.root.nntp", "mail.root.none",
+    "mail.root.pop3", "mail.server.server1.directory",
+    "mail.server.server2.directory",
+    "mail.server.server3.directory", "mail.server.server3.newsrc.file",
+    "mail.server.server4.directory", "mail.server.server4.newsrc.file",
+    "mail.server.server5.directory", "mail.server.server5.newsrc.file",
+    "mail.server.server6.directory"
+  ];
+  dump(excludedPrefs + "\n");
+  for ( let i = 0; i < importedPrefs.length ; i++){
+    if (excludedPrefs.indexOf(importedPrefs[i].name) != -1)
+      continue;
+    dump(importedPrefs[i].name+"--"+importedPrefs[i].data+"\n");
+    test += importedPrefs[i].name + importedPrefs[i].data;
+  }
+// uncomment following to get valid test data when changing test data files.
+// dump("\nStart test dump\n" + test + "\nend test dump\n")
+
+  do_check_true(test == testdata);
+
+//////////////// -- Modified nsIWindowsRegKey implementation ---
+  Components.manager
+            .unregisterFactory(Components.ID("{0478de5b-0f38-4edb-851d-4c99f1ed8eba}"),
+                                             factory);
+//////////////// -- Modified nsIWindowsRegKey implementation ---
+}
+
copy from mailnews/import/oexpress/Makefile.in
copy to mailnews/import/winlivemail/Makefile.in
--- a/mailnews/import/oexpress/Makefile.in
+++ b/mailnews/import/winlivemail/Makefile.in
@@ -30,56 +30,52 @@
 # use your version of this file under the terms of the MPL, indicate your
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
-DEPTH		= ../../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
+DEPTH       =   ../../..
+topsrcdir   =   @top_srcdir@
+srcdir      =   @srcdir@
+VPATH       =   @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-MODULE		= importOE
-LIBRARY_NAME   = importOE_s
-ifndef MOZ_INCOMPLETE_EXTERNAL_LINKAGE
-MOZILLA_INTERNAL_API = 1
-endif
-META_COMPONENT	= mail
+MODULE      =           importWM
+LIBRARY_NAME   =        importWM_s
+MOZILLA_INTERNAL_API =  1
+META_COMPONENT  =       mail
 
-REQUIRES	= xpcom \
-		  string \
-		  import \
-		  addrbook \
-		  mork \
-		  intl \
-		  msgbase \
-		  pref \
-		  necko \
-		  msgdb \
-		  msgbaseutil \
-		  msgcompose \
-		  msglocal \
-		  msgimap \
-		  msgnews \
-		  unicharutil \
-		  $(NULL)
+REQUIRES    = \
+                        xpcom \
+                        string \
+                        content   \
+                        widget    \
+                        dom       \
+                        import \
+                        addrbook \
+                        mork \
+                        intl \
+                        msgbase \
+                        pref \
+                        necko \
+                        msgdb \
+                        msgbaseutil \
+                        msgcompose \
+                        msglocal \
+                        msgimap \
+                        msgnews \
+                        unicharutil \
+                        $(NULL)
 
-CPPSRCS		= \
-		nsOEImport.cpp			\
-		nsOEScanBoxes.cpp		\
-		nsOEMailbox.cpp			\
-		nsOEAddressIterator.cpp		\
-		WabObject.cpp			\
-		nsOERegUtil.cpp			\
-		nsOE5File.cpp			\
-		nsOESettings.cpp		\
-		nsOEStringBundle.cpp		\
-		$(NULL)
+CPPSRCS     = \
+                        nsWMSettings.cpp        \
+                        nsWMImport.cpp  \
+                        nsWMStringBundle.cpp    \
+                        $(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
-FORCE_STATIC_LIB = 1
+FORCE_STATIC_LIB =      1
 
 include $(topsrcdir)/config/rules.mk
copy from mailnews/import/oexpress/OEDebugLog.h
copy to mailnews/import/winlivemail/WMDebugLog.h
--- a/mailnews/import/oexpress/OEDebugLog.h
+++ b/mailnews/import/winlivemail/WMDebugLog.h
@@ -30,23 +30,23 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#ifndef OEDebugLog_h___
-#define OEDebugLog_h___
+#ifndef WMDebugLog_h___
+#define WMDebugLog_h___
 
 // Use PR_LOG for logging.
 #include "prlog.h"
-extern PRLogModuleInfo *OELOGMODULE;  // Logging module
+extern PRLogModuleInfo *WMLOGMODULE;  // Logging module
 
-#define IMPORT_LOG0(x)          PR_LOG(OELOGMODULE, PR_LOG_DEBUG, (x))
-#define IMPORT_LOG1(x, y)       PR_LOG(OELOGMODULE, PR_LOG_DEBUG, (x, y))
-#define IMPORT_LOG2(x, y, z)    PR_LOG(OELOGMODULE, PR_LOG_DEBUG, (x, y, z))
-#define IMPORT_LOG3(a, b, c, d) PR_LOG(OELOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
+#define IMPORT_LOG0(x)          PR_LOG(WMLOGMODULE, PR_LOG_DEBUG, (x))
+#define IMPORT_LOG1(x, y)       PR_LOG(WMLOGMODULE, PR_LOG_DEBUG, (x, y))
+#define IMPORT_LOG2(x, y, z)    PR_LOG(WMLOGMODULE, PR_LOG_DEBUG, (x, y, z))
+#define IMPORT_LOG3(a, b, c, d) PR_LOG(WMLOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
 
 
 
-#endif /* OEDebugLog_h___ */
+#endif /* WMDebugLog_h___ */
copy from mailnews/import/oexpress/nsOEImport.cpp
copy to mailnews/import/winlivemail/nsWMImport.cpp
--- a/mailnews/import/oexpress/nsOEImport.cpp
+++ b/mailnews/import/winlivemail/nsWMImport.cpp
@@ -34,63 +34,58 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 /*
 
-  Outlook Express (Win32) import mail and addressbook interfaces
+  Windows Live Mail (Win32) import mail and addressbook interfaces
 
 */
 #ifdef MOZ_LOGGING
 // sorry, this has to be before the pre-compiled header
 #define FORCE_PR_LOG /* Allow logging in the release build */
 #endif
 
 #include "nscore.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsIServiceManager.h"
 #include "nsIImportService.h"
-#include "nsOEImport.h"
+#include "nsWMImport.h"
 #include "nsIMemory.h"
-#include "nsOEScanBoxes.h"
 #include "nsIImportService.h"
 #include "nsIImportMail.h"
 #include "nsIImportMailboxDescriptor.h"
 #include "nsIImportGeneric.h"
-#include "nsOEMailbox.h"
 #include "nsIImportAddressBooks.h"
 #include "nsIImportABDescriptor.h"
 #include "nsIImportFieldMap.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
-#include "WabObject.h"
-#include "nsOEAddressIterator.h"
 #include "nsIOutputStream.h"
-#include "nsOE5File.h"
 #include "nsIAddrDatabase.h"
-#include "nsOESettings.h"
+#include "nsWMSettings.h"
 #include "nsTextFormatter.h"
-#include "nsOEStringBundle.h"
+#include "nsWMStringBundle.h"
 #include "nsIStringBundle.h"
 #include "nsUnicharUtils.h"
 
-#include "OEDebugLog.h"
+#include "WMDebugLog.h"
 
 static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
-PRLogModuleInfo *OELOGMODULE = nsnull;
+PRLogModuleInfo *WMLOGMODULE = nsnull;
 
-class ImportOEMailImpl : public nsIImportMail
+class ImportWMMailImpl : public nsIImportMail
 {
 public:
-  ImportOEMailImpl();
-  virtual ~ImportOEMailImpl();
+  ImportWMMailImpl();
+  virtual ~ImportWMMailImpl();
 
   static nsresult Create(nsIImportMail** aImport);
 
   // nsISupports interface
   NS_DECL_ISUPPORTS
 
   // nsIImportmail interface
 
@@ -114,573 +109,181 @@ public:
   static void ReportError( PRInt32 errorNum, nsString& name, nsString *pStream);
   static void AddLinebreak( nsString *pStream);
   static void SetLogs( nsString& success, nsString& error, PRUnichar **pError, PRUnichar **pSuccess);
 
 private:
   PRUint32 m_bytesDone;
 };
 
-
-class ImportOEAddressImpl : public nsIImportAddressBooks
-{
-public:
-    ImportOEAddressImpl();
-    virtual ~ImportOEAddressImpl();
-
-  static nsresult Create(nsIImportAddressBooks** aImport);
-
-    // nsISupports interface
-    NS_DECL_ISUPPORTS
-
-    // nsIImportAddressBooks interface
-
-  /* PRBool GetSupportsMultiple (); */
-  NS_IMETHOD GetSupportsMultiple(PRBool *_retval) { *_retval = PR_FALSE; return( NS_OK);}
-
-  /* PRBool GetAutoFind (out wstring description); */
-  NS_IMETHOD GetAutoFind(PRUnichar **description, PRBool *_retval);
-
-  /* PRBool GetNeedsFieldMap ( nsIFile *location); */
-  NS_IMETHOD GetNeedsFieldMap(nsIFile *pLoc, PRBool *_retval) { *_retval = PR_FALSE; return( NS_OK);}
-
-  /* void GetDefaultLocation (out nsIFile location, out boolean found, out boolean userVerify); */
-  NS_IMETHOD GetDefaultLocation(nsIFile **location, PRBool *found, PRBool *userVerify)
-    { return( NS_ERROR_FAILURE);}
-
-  /* nsISupportsArray FindAddressBooks (in nsIFile location); */
-  NS_IMETHOD FindAddressBooks(nsIFile *location, nsISupportsArray **_retval);
-
-  /* nsISupports InitFieldMap(nsIImportFieldMap *fieldMap); */
-  NS_IMETHOD InitFieldMap(nsIImportFieldMap *fieldMap)
-    { return( NS_ERROR_FAILURE); }
-
-  NS_IMETHOD ImportAddressBook(nsIImportABDescriptor *source,
-                               nsIAddrDatabase *destination,
-                               nsIImportFieldMap *fieldMap,
-                               nsISupports *aSupportService,
-                               PRBool isAddrLocHome,
-                               PRUnichar **errorLog,
-                               PRUnichar **successLog,
-                               PRBool *fatalError);
-
-  /* unsigned long GetImportProgress (); */
-  NS_IMETHOD GetImportProgress(PRUint32 *_retval);
-
-  NS_IMETHOD GetSampleData( PRInt32 index, PRBool *pFound, PRUnichar **pStr)
-    { return( NS_ERROR_FAILURE);}
-
-  NS_IMETHOD SetSampleLocation( nsIFile *) { return( NS_OK); }
-
-private:
-  static void ReportSuccess( nsString& name, nsString *pStream);
-
-private:
-  CWAB * m_pWab;
-  int m_doneSoFar;
-};
-////////////////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////////////////
-
-
-nsOEImport::nsOEImport()
+nsWMImport::nsWMImport()
 {
   // Init logging module.
-  if (!OELOGMODULE)
-    OELOGMODULE = PR_NewLogModule("IMPORT");
-  IMPORT_LOG0( "nsOEImport Module Created\n");
-  nsOEStringBundle::GetStringBundle();
+  if (!WMLOGMODULE)
+    WMLOGMODULE = PR_NewLogModule("IMPORT");
+  IMPORT_LOG0( "nsWMImport Module Created\n");
+  nsWMStringBundle::GetStringBundle();
 }
 
-
-nsOEImport::~nsOEImport()
+nsWMImport::~nsWMImport()
 {
-  IMPORT_LOG0( "nsOEImport Module Deleted\n");
+  IMPORT_LOG0( "nsWMImport Module Deleted\n");
 }
 
-NS_IMPL_ISUPPORTS1(nsOEImport, nsIImportModule)
+NS_IMPL_ISUPPORTS1(nsWMImport, nsIImportModule)
 
-NS_IMETHODIMP nsOEImport::GetName( PRUnichar **name)
+NS_IMETHODIMP nsWMImport::GetName( PRUnichar **name)
 {
   NS_ENSURE_ARG_POINTER(name);
-
-  *name = nsOEStringBundle::GetStringByID( OEIMPORT_NAME);
+  // nsString  title = "Windows Live Mail";
+  // *name = ToNewUnicode(title);
+  *name = nsWMStringBundle::GetStringByID( WMIMPORT_NAME);
 
     return NS_OK;
 }
 
-NS_IMETHODIMP nsOEImport::GetDescription( PRUnichar **name)
+NS_IMETHODIMP nsWMImport::GetDescription( PRUnichar **name)
 {
   NS_ENSURE_ARG_POINTER(name);
 
-  *name = nsOEStringBundle::GetStringByID( OEIMPORT_DESCRIPTION);
+  // nsString  desc = "Windows Live Mail mail and address books";
+  // *name = ToNewUnicode(desc);
+  *name = nsWMStringBundle::GetStringByID( WMIMPORT_DESCRIPTION);
   return NS_OK;
 }
 
-NS_IMETHODIMP nsOEImport::GetSupports( char **supports)
+NS_IMETHODIMP nsWMImport::GetSupports( char **supports)
 {
   NS_PRECONDITION(supports != nsnull, "null ptr");
   if (! supports)
       return NS_ERROR_NULL_POINTER;
 
-  *supports = strdup( kOESupportsString);
+  *supports = strdup( kWMSupportsString);
   return( NS_OK);
 }
 
-
-NS_IMETHODIMP nsOEImport::GetSupportsUpgrade( PRBool *pUpgrade)
+NS_IMETHODIMP nsWMImport::GetSupportsUpgrade( PRBool *pUpgrade)
 {
   NS_PRECONDITION(pUpgrade != nsnull, "null ptr");
   if (! pUpgrade)
     return NS_ERROR_NULL_POINTER;
 
   *pUpgrade = PR_TRUE;
   return( NS_OK);
 }
 
-NS_IMETHODIMP nsOEImport::GetImportInterface( const char *pImportType, nsISupports **ppInterface)
+NS_IMETHODIMP nsWMImport::GetImportInterface(const char *pImportType,
+                                             nsISupports **ppInterface)
 {
   NS_ENSURE_ARG_POINTER(pImportType);
   NS_ENSURE_ARG_POINTER(ppInterface);
 
   *ppInterface = nsnull;
   nsresult rv;
-  if (!strcmp( pImportType, "mail")) {
-    // create the nsIImportMail interface and return it!
-    nsIImportMail *  pMail = nsnull;
-    nsIImportGeneric *pGeneric = nsnull;
-    rv = ImportOEMailImpl::Create( &pMail);
-    if (NS_SUCCEEDED( rv)) {
-      nsCOMPtr<nsIImportService> impSvc(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
-      if (NS_SUCCEEDED( rv)) {
-        rv = impSvc->CreateNewGenericMail( &pGeneric);
-        if (NS_SUCCEEDED( rv)) {
-          pGeneric->SetData( "mailInterface", pMail);
-          nsString name;
-          nsOEStringBundle::GetStringByID( OEIMPORT_NAME, name);
-          nsCOMPtr<nsISupportsString> nameString (do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv));
-          if (NS_SUCCEEDED(rv)) {
-            nameString->SetData(name);
-            pGeneric->SetData( "name", nameString);
-            rv = pGeneric->QueryInterface( kISupportsIID, (void **)ppInterface);
-          }
-        }
-      }
-    }
-    NS_IF_RELEASE( pMail);
-    NS_IF_RELEASE( pGeneric);
-    return( rv);
-  }
-
-  if (!strcmp( pImportType, "addressbook")) {
-    // create the nsIImportMail interface and return it!
-    nsIImportAddressBooks * pAddress = nsnull;
-    nsIImportGeneric * pGeneric = nsnull;
-    rv = ImportOEAddressImpl::Create( &pAddress);
-    if (NS_SUCCEEDED( rv)) {
-      nsCOMPtr<nsIImportService> impSvc(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
-      if (NS_SUCCEEDED( rv)) {
-        rv = impSvc->CreateNewGenericAddressBooks( &pGeneric);
-        if (NS_SUCCEEDED( rv)) {
-          pGeneric->SetData( "addressInterface", pAddress);
-          rv = pGeneric->QueryInterface( kISupportsIID, (void **)ppInterface);
-        }
-      }
-    }
-    NS_IF_RELEASE( pAddress);
-    NS_IF_RELEASE( pGeneric);
-    return( rv);
-  }
 
   if (!strcmp( pImportType, "settings")) {
     nsIImportSettings *pSettings = nsnull;
-    rv = nsOESettings::Create( &pSettings);
+    rv = nsWMSettings::Create( &pSettings);
     if (NS_SUCCEEDED( rv)) {
       pSettings->QueryInterface( kISupportsIID, (void **)ppInterface);
     }
     NS_IF_RELEASE( pSettings);
     return( rv);
   }
 
   return( NS_ERROR_NOT_AVAILABLE);
 }
 
 /////////////////////////////////////////////////////////////////////////////////
-nsresult ImportOEMailImpl::Create(nsIImportMail** aImport)
+nsresult ImportWMMailImpl::Create(nsIImportMail** aImport)
 {
   NS_ENSURE_ARG_POINTER(aImport);
-  *aImport = new ImportOEMailImpl();
+  *aImport = new ImportWMMailImpl();
   NS_ENSURE_TRUE(*aImport, NS_ERROR_OUT_OF_MEMORY);
   NS_ADDREF(*aImport);
   return NS_OK;
 }
 
-ImportOEMailImpl::ImportOEMailImpl()
+ImportWMMailImpl::ImportWMMailImpl()
 {
 }
 
-
-ImportOEMailImpl::~ImportOEMailImpl()
+ImportWMMailImpl::~ImportWMMailImpl()
 {
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(ImportOEMailImpl, nsIImportMail)
+NS_IMPL_THREADSAFE_ISUPPORTS1(ImportWMMailImpl, nsIImportMail)
 
-NS_IMETHODIMP ImportOEMailImpl::TranslateFolderName(const nsAString & aFolderName, nsAString & _retval)
+NS_IMETHODIMP ImportWMMailImpl::TranslateFolderName(const nsAString & aFolderName, nsAString & _retval)
 {
-  if (aFolderName.Equals(NS_LITERAL_STRING("Deleted Items"), nsCaseInsensitiveStringComparator()))
-      _retval = NS_LITERAL_STRING(kDestTrashFolderName);
-  else if (aFolderName.Equals(NS_LITERAL_STRING("Sent Items"), nsCaseInsensitiveStringComparator()))
-      _retval = NS_LITERAL_STRING(kDestSentFolderName);
-  else if (aFolderName.Equals(NS_LITERAL_STRING("Outbox"), nsCaseInsensitiveStringComparator()))
-      _retval = NS_LITERAL_STRING(kDestUnsentMessagesFolderName);
-  else
-      _retval = aFolderName;
-
-  return NS_OK;
+  return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-NS_IMETHODIMP ImportOEMailImpl::GetDefaultLocation( nsIFile **ppLoc, PRBool *found, PRBool *userVerify)
+NS_IMETHODIMP ImportWMMailImpl::GetDefaultLocation(nsIFile **ppLoc, PRBool *found,
+                                                   PRBool *userVerify)
 {
-  NS_PRECONDITION(ppLoc != nsnull, "null ptr");
-  NS_PRECONDITION(found != nsnull, "null ptr");
-  NS_PRECONDITION(userVerify != nsnull, "null ptr");
-  if (!ppLoc || !found || !userVerify)
-    return NS_ERROR_NULL_POINTER;
-
-  // use scanboxes to find the location.
-  nsresult rv;
-  nsCOMPtr <nsILocalFile> file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
-  if (NS_FAILED(rv))
-    return rv;
-
-  if (nsOEScanBoxes::FindMail(file)) {
-    *found = PR_TRUE;
-    NS_IF_ADDREF(*ppLoc = file);
-  }
-  else {
-    *found = PR_FALSE;
-    *ppLoc = nsnull;
-  }
-  *userVerify = PR_TRUE;
-  return( NS_OK);
+  return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-
-NS_IMETHODIMP ImportOEMailImpl::FindMailboxes( nsIFile *pLoc, nsISupportsArray **ppArray)
+NS_IMETHODIMP ImportWMMailImpl::FindMailboxes(nsIFile *pLoc,
+                                              nsISupportsArray **ppArray)
 {
-    NS_PRECONDITION(pLoc != nsnull, "null ptr");
-    NS_PRECONDITION(ppArray != nsnull, "null ptr");
-    if (!pLoc || !ppArray)
-        return NS_ERROR_NULL_POINTER;
-
-  PRBool exists = PR_FALSE;
-  nsresult rv = pLoc->Exists( &exists);
-  if (NS_FAILED( rv) || !exists)
-    return( NS_ERROR_FAILURE);
-
-  nsOEScanBoxes  scan;
-
-  if (!scan.GetMailboxes( pLoc, ppArray))
-    *ppArray = nsnull;
-
-  return( NS_OK);
+  return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-void ImportOEMailImpl::AddLinebreak( nsString *pStream)
+void ImportWMMailImpl::AddLinebreak( nsString *pStream)
 {
   if (pStream)
     pStream->Append( PRUnichar('\n'));
 }
 
-void ImportOEMailImpl::ReportSuccess( nsString& name, PRInt32 count, nsString *pStream)
+void ImportWMMailImpl::ReportSuccess( nsString& name, PRInt32 count, nsString *pStream)
 {
   if (!pStream)
     return;
   // load the success string
-  nsIStringBundle *pBundle = nsOEStringBundle::GetStringBundleProxy();
-  PRUnichar *pFmt = nsOEStringBundle::GetStringByID( OEIMPORT_MAILBOX_SUCCESS, pBundle);
+  nsIStringBundle *pBundle = nsWMStringBundle::GetStringBundleProxy();
+  PRUnichar *pFmt = nsWMStringBundle::GetStringByID( WMIMPORT_MAILBOX_SUCCESS, pBundle);
   PRUnichar *pText = nsTextFormatter::smprintf( pFmt, name.get(), count);
   pStream->Append( pText);
   nsTextFormatter::smprintf_free( pText);
-  nsOEStringBundle::FreeString( pFmt);
+  nsWMStringBundle::FreeString( pFmt);
   AddLinebreak( pStream);
   NS_IF_RELEASE( pBundle);
 }
 
-void ImportOEMailImpl::ReportError( PRInt32 errorNum, nsString& name, nsString *pStream)
+void ImportWMMailImpl::ReportError( PRInt32 errorNum, nsString& name, nsString *pStream)
 {
   if (!pStream)
     return;
   // load the error string
-  nsIStringBundle *pBundle = nsOEStringBundle::GetStringBundleProxy();
-  PRUnichar *pFmt = nsOEStringBundle::GetStringByID( errorNum, pBundle);
+  nsIStringBundle *pBundle = nsWMStringBundle::GetStringBundleProxy();
+  PRUnichar *pFmt = nsWMStringBundle::GetStringByID( errorNum, pBundle);
   PRUnichar *pText = nsTextFormatter::smprintf( pFmt, name.get());
   pStream->Append( pText);
   nsTextFormatter::smprintf_free( pText);
-  nsOEStringBundle::FreeString( pFmt);
+  nsWMStringBundle::FreeString( pFmt);
   AddLinebreak( pStream);
   NS_IF_RELEASE( pBundle);
 }
 
-
-void ImportOEMailImpl::SetLogs( nsString& success, nsString& error, PRUnichar **pError, PRUnichar **pSuccess)
+void ImportWMMailImpl::SetLogs(nsString& success, nsString& error,
+                               PRUnichar **pError, PRUnichar **pSuccess)
 {
   if (pError)
     *pError = ToNewUnicode(error);
   if (pSuccess)
     *pSuccess = ToNewUnicode(success);
 }
 
-NS_IMETHODIMP ImportOEMailImpl::ImportMailbox(nsIImportMailboxDescriptor *pSource,
+NS_IMETHODIMP ImportWMMailImpl::ImportMailbox(nsIImportMailboxDescriptor *pSource,
                                               nsIFile *pDestination,
                                               PRUnichar **pErrorLog,
                                               PRUnichar **pSuccessLog,
                                               PRBool *fatalError)
 {
-  NS_PRECONDITION(pSource != nsnull, "null ptr");
-  NS_PRECONDITION(pDestination != nsnull, "null ptr");
-  NS_PRECONDITION(fatalError != nsnull, "null ptr");
-
-  nsCOMPtr<nsIStringBundle> bundle( dont_AddRef( nsOEStringBundle::GetStringBundleProxy()));
-
-  nsString success;
-  nsString error;
-  if (!pSource || !pDestination || !fatalError) {
-    nsOEStringBundle::GetStringByID( OEIMPORT_MAILBOX_BADPARAM, error, bundle);
-    if (fatalError)
-      *fatalError = PR_TRUE;
-    SetLogs( success, error, pErrorLog, pSuccessLog);
-    return NS_ERROR_NULL_POINTER;
-  }
-
-  PRBool abort = PR_FALSE;
-  nsString name;
-  nsString pName;
-  if (NS_SUCCEEDED( pSource->GetDisplayName( getter_Copies(pName))))
-    name = pName;
-
-  PRUint32 mailSize = 0;
-  pSource->GetSize( &mailSize);
-  if (mailSize == 0) {
-    ReportSuccess( name, 0, &success);
-    SetLogs( success, error, pErrorLog, pSuccessLog);
-    return( NS_OK);
-  }
-
-  nsCOMPtr <nsILocalFile> inFile;
-  if (NS_FAILED( pSource->GetFile(getter_AddRefs(inFile)))) {
-    ReportError( OEIMPORT_MAILBOX_BADSOURCEFILE, name, &error);
-    SetLogs( success, error, pErrorLog, pSuccessLog);
-    return( NS_ERROR_FAILURE);
-  }
-
-  nsCString pPath;
-  inFile->GetNativePath(pPath);
-  IMPORT_LOG1( "Importing Outlook Express mailbox: %s\n", pPath.get());
-
-  m_bytesDone = 0;
-  PRUint32 msgCount = 0;
-  nsresult rv;
-  if (nsOE5File::IsLocalMailFile( inFile)) {
-    IMPORT_LOG1( "Importing OE5 mailbox: %s!\n", NS_LossyConvertUTF16toASCII(name.get()));
-    rv = nsOE5File::ImportMailbox( &m_bytesDone, &abort, name, inFile, pDestination, &msgCount);
-  }
-  else {
-    if (CImportMailbox::ImportMailbox( &m_bytesDone, &abort, name, inFile, pDestination, &msgCount))
-      rv = NS_OK;
-    else
-      rv = NS_ERROR_FAILURE;
-  }
-
-  if (NS_SUCCEEDED( rv)) {
-    ReportSuccess( name, msgCount, &success);
-  }
-  else {
-    ReportError( OEIMPORT_MAILBOX_CONVERTERROR, name, &error);
-  }
-
-  SetLogs( success, error, pErrorLog, pSuccessLog);
-
-  return( rv);
-}
-
-NS_IMETHODIMP ImportOEMailImpl::GetImportProgress( PRUint32 *pDoneSoFar)
-{
-  NS_ENSURE_ARG_POINTER(pDoneSoFar);
-  *pDoneSoFar = m_bytesDone;
-  return( NS_OK);
-}
-
-nsresult ImportOEAddressImpl::Create(nsIImportAddressBooks** aImport)
-{
-  NS_ENSURE_ARG_POINTER(aImport);
-
-  *aImport = new ImportOEAddressImpl();
-  NS_ENSURE_TRUE(*aImport, NS_ERROR_OUT_OF_MEMORY);
-  NS_ADDREF(*aImport);
-  return NS_OK;
-}
-
-ImportOEAddressImpl::ImportOEAddressImpl()
-{
-  m_pWab = nsnull;
-}
-
-
-ImportOEAddressImpl::~ImportOEAddressImpl()
-{
-  if (m_pWab)
-    delete m_pWab;
-}
-
-NS_IMPL_THREADSAFE_ISUPPORTS1(ImportOEAddressImpl, nsIImportAddressBooks)
-
-NS_IMETHODIMP ImportOEAddressImpl::GetAutoFind(PRUnichar **description, PRBool *_retval)
-{
-  NS_PRECONDITION(description != nsnull, "null ptr");
-  NS_PRECONDITION(_retval != nsnull, "null ptr");
-  if (! description || !_retval)
-    return NS_ERROR_NULL_POINTER;
-
-  *_retval = PR_TRUE;
-  nsString str;
-  str.Append(nsOEStringBundle::GetStringByID(OEIMPORT_AUTOFIND));
-  *description = ToNewUnicode(str);
-  return( NS_OK);
+  return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-
-
-NS_IMETHODIMP ImportOEAddressImpl::FindAddressBooks(nsIFile *location, nsISupportsArray **_retval)
-{
-  NS_PRECONDITION(_retval != nsnull, "null ptr");
-  if (!_retval)
-    return NS_ERROR_NULL_POINTER;
-
-  nsresult rv = NS_NewISupportsArray( _retval);
-  if (NS_FAILED( rv))
-    return( rv);
-
-  // Make sure we can load up the windows address book...
-  rv = NS_ERROR_FAILURE;
-
-  if (m_pWab)
-    delete m_pWab;
-  m_pWab = new CWAB( nsnull);
-
-  nsIImportABDescriptor * pID;
-  nsISupports * pInterface;
-  nsString str;
-  str.Append(nsOEStringBundle::GetStringByID( OEIMPORT_DEFAULT_NAME));
-
-  if (m_pWab->Loaded()) {
-    // create a new nsIImportABDescriptor and add it to the array
-    nsCOMPtr<nsIImportService> impSvc(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
-    if (NS_SUCCEEDED( rv)) {
-      rv = impSvc->CreateNewABDescriptor( &pID);
-      if (NS_SUCCEEDED( rv)) {
-        pID->SetIdentifier( 0x4F453334);
-        pID->SetRef( 1);
-        pID->SetSize( 100);
-        pID->SetPreferredName(str);
-        rv = pID->QueryInterface( kISupportsIID, (void **) &pInterface);
-        (*_retval)->AppendElement( pInterface);
-        pInterface->Release();
-        pID->Release();
-      }
-    }
-  }
-
-  if (NS_FAILED( rv)) {
-    delete m_pWab;
-    m_pWab = nsnull;
-  }
-  return( NS_OK);
-}
-
-
-
-NS_IMETHODIMP ImportOEAddressImpl::ImportAddressBook(nsIImportABDescriptor *source,
-                                                     nsIAddrDatabase *destination,
-                                                     nsIImportFieldMap *fieldMap,
-                                                     nsISupports *aSupportService,
-                                                     PRBool isAddrLocHome,
-                                                     PRUnichar **errorLog,
-                                                     PRUnichar **successLog,
-                                                     PRBool *fatalError)
+NS_IMETHODIMP ImportWMMailImpl::GetImportProgress( PRUint32 *pDoneSoFar)
 {
-    NS_PRECONDITION(source != nsnull, "null ptr");
-    // NS_PRECONDITION(destination != nsnull, "null ptr");
-    // NS_PRECONDITION(fieldMap != nsnull, "null ptr");
-    NS_PRECONDITION(fatalError != nsnull, "null ptr");
-    if (!source || !fatalError)
-        return NS_ERROR_NULL_POINTER;
-
-  // we assume it is our one and only address book.
-  if (!m_pWab) {
-    IMPORT_LOG0( "Wab not loaded in ImportAddressBook call\n");
-    return( NS_ERROR_FAILURE);
-  }
-
-  IMPORT_LOG0( "IMPORTING OUTLOOK EXPRESS ADDRESS BOOK\n");
-
-  nsCOMPtr<nsIStringBundle>  bundle( dont_AddRef( nsOEStringBundle::GetStringBundleProxy()));
-  nsString success;
-  nsString error;
-  if (!source || !destination || !fatalError)
-  {
-    nsOEStringBundle::GetStringByID( OEIMPORT_ADDRESS_BADPARAM, error, bundle);
-    if (fatalError)
-      *fatalError = PR_TRUE;
-    ImportOEMailImpl::SetLogs( success, error, errorLog, successLog);
-    return NS_ERROR_NULL_POINTER;
-  }
-
-  m_doneSoFar = 0;
-  nsOEAddressIterator * pIter = new nsOEAddressIterator( m_pWab, destination);
-  HRESULT hr = m_pWab->IterateWABContents( pIter, &m_doneSoFar);
-  delete pIter;
-
-  nsString name;
-  if (SUCCEEDED(hr))
-  {
-    if (NS_SUCCEEDED(source->GetPreferredName(name)))
-    {
-      ReportSuccess( name, &success);
-    }
-  }
-  else
-    ImportOEMailImpl::ReportError( OEIMPORT_ADDRESS_CONVERTERROR, name, &error);
-
-  ImportOEMailImpl::SetLogs( success, error, errorLog, successLog);
-
-  nsresult rv = destination->Commit(nsAddrDBCommitType::kLargeCommit);
-  return rv;
+  return NS_ERROR_NOT_IMPLEMENTED;
 }
-
-
-NS_IMETHODIMP ImportOEAddressImpl::GetImportProgress(PRUint32 *_retval)
-{
-  NS_PRECONDITION(_retval != nsnull, "null ptr");
-  if (! _retval)
-    return NS_ERROR_NULL_POINTER;
-
-  *_retval = (PRUint32) m_doneSoFar;
-  return( NS_OK);
-}
-
-void ImportOEAddressImpl::ReportSuccess( nsString& name, nsString *pStream)
-{
-  if (!pStream)
-    return;
-  // load the success string
-  nsIStringBundle *pBundle = nsOEStringBundle::GetStringBundleProxy();
-  PRUnichar *pFmt = nsOEStringBundle::GetStringByID( OEIMPORT_ADDRESS_SUCCESS, pBundle);
-  PRUnichar *pText = nsTextFormatter::smprintf( pFmt, name.get());
-  pStream->Append( pText);
-  nsTextFormatter::smprintf_free( pText);
-  nsOEStringBundle::FreeString( pFmt);
-  ImportOEMailImpl::AddLinebreak( pStream);
-  NS_IF_RELEASE( pBundle);
-}
copy from mailnews/import/oexpress/nsOEImport.h
copy to mailnews/import/winlivemail/nsWMImport.h
--- a/mailnews/import/oexpress/nsOEImport.h
+++ b/mailnews/import/winlivemail/nsWMImport.h
@@ -30,45 +30,41 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#ifndef nsOEImport_h___
-#define nsOEImport_h___
+#ifndef nsWMImport_h___
+#define nsWMImport_h___
 
 #include "nsIImportModule.h"
 #include "nsCOMPtr.h"
 
-#define NS_OEIMPORT_CID              \
-{ /* be0bc880-1742-11d3-a206-00a0cc26da63 */      \
-   0xbe0bc880, 0x1742, 0x11d3,                   \
-   {0xa2, 0x06, 0x0, 0xa0, 0xcc, 0x26, 0xda, 0x63}}
+#define NS_WMIMPORT_CID   \
+{ /* 42bc82bc-8e9f-4597-8b6e-e529daaf3af1 */      \
+   0x42bc82bc, 0x8e9f, 0x4597,   \
+   {0x8b, 0x6e, 0xe5, 0x29, 0xda, 0xaf, 0x3a, 0xf1}}
 
-
+// currently only support setting import
+#define kWMSupportsString NS_IMPORT_SETTINGS_STR
 
-#define kOESupportsString NS_IMPORT_MAIL_STR "," NS_IMPORT_ADDRESS_STR "," NS_IMPORT_SETTINGS_STR
-
-class nsOEImport : public nsIImportModule
+class nsWMImport : public nsIImportModule
 {
 public:
 
-  nsOEImport();
-  virtual ~nsOEImport();
+  nsWMImport();
+  virtual ~nsWMImport();
 
   NS_DECL_ISUPPORTS
 
   ////////////////////////////////////////////////////////////////////////////////////////
   // we suppport the nsIImportModule interface
   ////////////////////////////////////////////////////////////////////////////////////////
 
-
   NS_DECL_NSIIMPORTMODULE
 
 protected:
 };
 
-
-
-#endif /* nsOEImport_h___ */
+#endif /* nsWMImport_h___ */
copy from mailnews/import/oexpress/nsOESettings.cpp
copy to mailnews/import/winlivemail/nsWMSettings.cpp
--- a/mailnews/import/oexpress/nsOESettings.cpp
+++ b/mailnews/import/winlivemail/nsWMSettings.cpp
@@ -33,865 +33,819 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 /*
 
-  Outlook Express (Win32) settings
+  Windows Live Mail (Win32) settings
 
 */
 
 #include "nsCOMPtr.h"
 #include "nscore.h"
-#include "nsReadableUtils.h"
-#include "nsOEImport.h"
+#include "nsStringGlue.h"
+#include "nsWMImport.h"
 #include "nsIComponentManager.h"
 #include "nsIServiceManager.h"
-#include "nsOERegUtil.h"
 #include "nsIMsgAccountManager.h"
 #include "nsIMsgAccount.h"
 #include "nsIImportSettings.h"
-#include "nsOESettings.h"
+#include "nsWMSettings.h"
 #include "nsMsgBaseCID.h"
 #include "nsMsgCompCID.h"
 #include "nsMsgI18N.h"
 #include "nsISmtpService.h"
 #include "nsISmtpServer.h"
-#include "nsOEStringBundle.h"
-#include "OEDebugLog.h"
+#include "nsWMStringBundle.h"
+#include "WMDebugLog.h"
 #include "nsIPop3IncomingServer.h"
 #include "nsIImapIncomingServer.h"
 #include "nsINntpIncomingServer.h"
 #include "stdlib.h"
-
-class OESettings {
-public:
-  static HKEY Find50Key( void);
-  static HKEY Find40Key( void);
-  static HKEY FindAccountsKey( void);
-
-  static PRBool DoImport( nsIMsgAccount **ppAccount);
+#include "nsILocalFile.h"
+#include "nsISimpleEnumerator.h"
+#include "nsIMutableArray.h"
+#include "nsIDOMDocument.h"
+#include "nsNetUtil.h"
+#include "nsIDOMNodeList.h"
+#include "nsIFileStreams.h"
+#include "nsIDOMParser.h"
+#include "nsIDOMElement.h"
+#include "nsIDOM3Node.h"
+#include "nsTArray.h"
+#include <windows.h>
+#include "nsIWindowsRegKey.h"
+#include "nsCOMArray.h"
 
-  static PRBool DoIMAPServer( nsIMsgAccountManager *pMgr, HKEY hKey, char *pServerName, nsIMsgAccount **ppAccount);
-  static PRBool DoPOP3Server( nsIMsgAccountManager *pMgr, HKEY hKey, char *pServerName, nsIMsgAccount **ppAccount);
-  static PRBool DoNNTPServer( nsIMsgAccountManager *pMgr, HKEY hKey, char *pServerName, nsIMsgAccount **ppAccount);
-
-  static void SetIdentities( nsIMsgAccountManager *pMgr, nsIMsgAccount *pAcc, HKEY hKey,
-                             char *pIncomgUserName, PRInt32 authMethodIncoming, PRBool isNNTP);
-  static void SetSmtpServer( char *pSmtpServer, HKEY hKey, nsIMsgIdentity *id,
-                             char *pIncomgUserName, PRInt32 authMethodIncoming);
-  static nsresult GetAccountName(HKEY hKey, char *defaultName, nsString &acctName);
+class WMSettings {
+public:
+  static nsresult FindWMKey(nsIWindowsRegKey* akey);
+  static PRBool getOEacctFiles(nsILocalFile* file, nsCOMArray<nsILocalFile>& fileArray);
+  static nsresult GetValueForTag(nsIDOMDocument *xmlDoc,
+                                 const nsAString& tagName,
+                                 nsAString &value);
+  static nsresult MakeXMLdoc(nsIDOMDocument** xmlDoc,
+                             nsILocalFile* file);
+  static PRBool DoImport(nsIMsgAccount **ppAccount);
+  static PRBool DoIMAPServer(nsIMsgAccountManager *pMgr,
+                             nsIDOMDocument *xmlDoc,
+                             const nsString& serverName,
+                             nsIMsgAccount **ppAccount);
+  static PRBool DoPOP3Server(nsIMsgAccountManager *pMgr,
+                             nsIDOMDocument *xmlDoc,
+                             const nsString& serverName,
+                             nsIMsgAccount **ppAccount);
+  static PRBool DoNNTPServer(nsIMsgAccountManager *pMgr,
+                             nsIDOMDocument *xmlDoc,
+                             const nsString& serverName,
+                             nsIMsgAccount **ppAccount);
+  static void SetIdentities(nsIMsgAccountManager *pMgr, nsIMsgAccount *pAcc,
+                            nsIDOMDocument *xmlDoc, nsAutoString &userName,
+                            PRInt32 authMethodIncoming, PRBool isNNTP );
+  static void SetSmtpServer(nsIDOMDocument *xmlDoc, nsIMsgIdentity *id,
+                            nsAutoString& inUserName, PRInt32 authMethodIncoming);
 };
 
-static PRInt32 checkNewMailTime;// OE global setting, let's default to 30
-static PRBool  checkNewMail;    // OE global setting, let's default to PR_FALSE
+static PRInt32 checkNewMailTime;// WM global setting, let's default to 30
+static PRBool  checkNewMail;    // WM global setting, let's default to PR_FALSE
                                 // This won't cause unwanted autodownloads-
                                 // user can set prefs after import
 
 ////////////////////////////////////////////////////////////////////////
-nsresult nsOESettings::Create(nsIImportSettings** aImport)
+nsresult nsWMSettings::Create(nsIImportSettings** aImport)
 {
     NS_PRECONDITION(aImport != nsnull, "null ptr");
     if (! aImport)
         return NS_ERROR_NULL_POINTER;
 
-    *aImport = new nsOESettings();
+    *aImport = new nsWMSettings();
     if (! *aImport)
         return NS_ERROR_OUT_OF_MEMORY;
 
     NS_ADDREF(*aImport);
     return NS_OK;
 }
 
-nsOESettings::nsOESettings()
+nsWMSettings::nsWMSettings()
 {
 }
 
-nsOESettings::~nsOESettings()
+nsWMSettings::~nsWMSettings()
 {
 }
 
-NS_IMPL_ISUPPORTS1(nsOESettings, nsIImportSettings)
+NS_IMPL_ISUPPORTS1(nsWMSettings, nsIImportSettings)
 
-NS_IMETHODIMP nsOESettings::AutoLocate(PRUnichar **description, nsIFile **location, PRBool *_retval)
+NS_IMETHODIMP nsWMSettings::AutoLocate(PRUnichar **description,
+                                       nsIFile **location, PRBool *_retval)
 {
   NS_PRECONDITION(description != nsnull, "null ptr");
   NS_PRECONDITION(_retval != nsnull, "null ptr");
   if (!description || !_retval)
-    return( NS_ERROR_NULL_POINTER);
+    return NS_ERROR_NULL_POINTER;
 
-  *description = nsOEStringBundle::GetStringByID( OEIMPORT_NAME);
+  *description = nsWMStringBundle::GetStringByID(WMIMPORT_NAME);
   *_retval = PR_FALSE;
 
+  nsCOMPtr<nsIWindowsRegKey> key =
+    do_CreateInstance("@mozilla.org/windows-registry-key;1");
   if (location)
     *location = nsnull;
-  HKEY  key;
-  key = OESettings::Find50Key();
-  if (key != nsnull) {
+  if (NS_SUCCEEDED(WMSettings::FindWMKey(key)))
     *_retval = PR_TRUE;
-    ::RegCloseKey( key);
-  }
-  else {
-    key = OESettings::Find40Key();
-    if (key != nsnull) {
-      *_retval = PR_TRUE;
-      ::RegCloseKey( key);
-    }
-  }
-  if (*_retval) {
-    key = OESettings::FindAccountsKey();
-    if (key == nsnull) {
-      *_retval = PR_FALSE;
-    }
-    else {
-      ::RegCloseKey( key);
-    }
-  }
 
-  return( NS_OK);
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsOESettings::SetLocation(nsIFile *location)
+NS_IMETHODIMP nsWMSettings::SetLocation(nsIFile *location)
 {
-  return( NS_OK);
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsOESettings::Import(nsIMsgAccount **localMailAccount, PRBool *_retval)
+NS_IMETHODIMP nsWMSettings::Import(nsIMsgAccount **localMailAccount,
+                                   PRBool *_retval)
 {
-  NS_PRECONDITION( _retval != nsnull, "null ptr");
+  NS_PRECONDITION(_retval != nsnull, "null ptr");
 
-  if (OESettings::DoImport( localMailAccount)) {
+  if (WMSettings::DoImport(localMailAccount)) {
     *_retval = PR_TRUE;
-    IMPORT_LOG0( "Settings import appears successful\n");
+    IMPORT_LOG0("Settings import appears successful\n");
   }
   else {
     *_retval = PR_FALSE;
-    IMPORT_LOG0( "Settings import returned FALSE\n");
-  }
-
-  return( NS_OK);
-}
-
-HKEY OESettings::FindAccountsKey( void)
-{
-  HKEY  sKey;
-
-  if (::RegOpenKeyEx( HKEY_CURRENT_USER, "Identities", 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS) {
-    BYTE *  pBytes = nsOERegUtil::GetValueBytes( sKey, "Default User ID");
-    ::RegCloseKey( sKey);
-    if (pBytes) {
-      nsCString  key( "Identities\\");
-      key += (const char *)pBytes;
-      nsOERegUtil::FreeValueBytes( pBytes);
-      key += "\\Software\\Microsoft\\Internet Account Manager\\Accounts";
-      if (::RegOpenKeyEx( HKEY_CURRENT_USER, key.get(), 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &sKey) == ERROR_SUCCESS) {
-        return( sKey);
-      }
-    }
-  }
-
-  if (::RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Account Manager\\Accounts", 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &sKey) == ERROR_SUCCESS) {
-    return( sKey);
-  }
-
-  return( nsnull);
-}
-
-HKEY OESettings::Find50Key( void)
-{
-  PRBool    success = PR_FALSE;
-  HKEY    sKey;
-
-  if (::RegOpenKeyEx( HKEY_CURRENT_USER, "Identities", 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS) {
-    BYTE *  pBytes = nsOERegUtil::GetValueBytes( sKey, "Default User ID");
-    ::RegCloseKey( sKey);
-    if (pBytes) {
-      nsCString  key( "Identities\\");
-      key += (const char *)pBytes;
-      nsOERegUtil::FreeValueBytes( pBytes);
-      key += "\\Software\\Microsoft\\Outlook Express\\5.0";
-      if (::RegOpenKeyEx( HKEY_CURRENT_USER, key.get(), 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS) {
-        return( sKey);
-      }
-    }
-  }
-
-  return( nsnull);
-}
-
-HKEY OESettings::Find40Key( void)
-{
-  HKEY  sKey;
-  if (::RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\Microsoft\\Outlook Express", 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS) {
-    return( sKey);
-  }
-
-  return( nsnull);
-}
-
-PRBool OESettings::DoImport( nsIMsgAccount **ppAccount)
-{
-  HKEY  hKey = FindAccountsKey();
-  if (hKey == nsnull) {
-    IMPORT_LOG0( "*** Error finding Outlook Express registry account keys\n");
-    return( PR_FALSE);
-  }
-
-  nsresult  rv;
-
-  nsCOMPtr<nsIMsgAccountManager> accMgr =
-           do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
-    if (NS_FAILED(rv)) {
-    IMPORT_LOG0( "*** Failed to create a account manager!\n");
-    ::RegCloseKey( hKey);
-    return( PR_FALSE);
+    IMPORT_LOG0("Settings import returned FALSE\n");
   }
 
-  HKEY    subKey;
-  nsCString  defMailName;
-  // OE has default mail account here when it has been
-  // set up by transfer or has multiple identities
-  // look below for orig code that looked in new OE installs
-  if (::RegOpenKeyEx(HKEY_CURRENT_USER, "Identities", 0,
-                     KEY_QUERY_VALUE, &subKey) == ERROR_SUCCESS) {
-    BYTE *  pBytes = nsOERegUtil::GetValueBytes(subKey, "Default User ID");
-    ::RegCloseKey( subKey);
-    if (pBytes) {
-      nsCString  key( "Identities\\");
-      key += (const char *)pBytes;
-      nsOERegUtil::FreeValueBytes( pBytes);
-      key += "\\Software\\Microsoft\\Internet Account Manager";
-      if (::RegOpenKeyEx(HKEY_CURRENT_USER, key.get(), 0,
-                         KEY_QUERY_VALUE , &subKey) == ERROR_SUCCESS) {
-        BYTE * pBytes = nsOERegUtil::GetValueBytes(subKey,
-                                                   "Default Mail Account");
-        ::RegCloseKey( subKey);
-        if (pBytes) {
-          defMailName = (const char *)pBytes;
-          nsOERegUtil::FreeValueBytes( pBytes);
-        }
-      }
+  return NS_OK;
+}
+
+nsresult WMSettings::FindWMKey(nsIWindowsRegKey* akey)
+{
+  nsresult rv;
+  NS_ENSURE_ARG(akey);
+  rv = akey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
+                  NS_LITERAL_STRING("Software\\Microsoft\\Windows Live Mail"),
+                  nsIWindowsRegKey::ACCESS_QUERY_VALUE);
+  if (NS_SUCCEEDED(rv))
+    return rv;
+  rv = akey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
+                  NS_LITERAL_STRING("Software\\Microsoft\\Windows Mail"),
+                  nsIWindowsRegKey::ACCESS_QUERY_VALUE);
+  return rv;
+}
+
+PRBool WMSettings::getOEacctFiles(nsILocalFile* file,
+                                  nsCOMArray<nsILocalFile>& fileArray)
+{
+  nsresult rv;
+  nsCOMPtr<nsISimpleEnumerator> entries;
+  rv = file->GetDirectoryEntries(getter_AddRefs(entries));
+  if (NS_FAILED(rv) || !entries)
+    return PR_FALSE;
+
+  PRBool hasMore;
+  while (NS_SUCCEEDED(entries->HasMoreElements(&hasMore)) && hasMore) {
+    nsCOMPtr<nsISupports> sup;
+    entries->GetNext(getter_AddRefs(sup));
+    if (!sup)
+      return PR_FALSE;
+    nsCOMPtr<nsILocalFile> fileX = do_QueryInterface(sup);
+    if (!fileX)
+      return PR_FALSE;
+    nsString name;
+    if (NS_FAILED(fileX->GetLeafName(name)))
+      return PR_FALSE;
+    PRBool isDir;
+    if (NS_FAILED(fileX->IsDirectory(&isDir)))
+      return PR_FALSE;
+    if (isDir) {
+      getOEacctFiles(fileX, fileArray);
+    }
+    else {
+      if (StringEndsWith(name, NS_LITERAL_STRING(".oeaccount")))
+        fileArray.AppendObject(fileX);
     }
   }
+  return PR_TRUE;
+}
 
-  // else it must be here in original install location from orig code
-  if (defMailName.IsEmpty()) {
-    if (::RegOpenKeyEx(HKEY_CURRENT_USER,
-                       "Software\\Microsoft\\Outlook Express",  0,
-                       KEY_QUERY_VALUE, &subKey) == ERROR_SUCCESS) {
-      BYTE *  pBytes = nsOERegUtil::GetValueBytes(subKey,
-                                                  "Default Mail Account");
-      ::RegCloseKey( subKey);
-      if (pBytes) {
-        defMailName = (const char *)pBytes;
-        nsOERegUtil::FreeValueBytes( pBytes);
-      }
-    }
+nsresult WMSettings::GetValueForTag(nsIDOMDocument *xmlDoc,
+                                    const nsAString& tagName,
+                                    nsAString &value)
+{
+  nsCOMPtr<nsIDOMNodeList> list;
+  if (NS_FAILED(xmlDoc->GetElementsByTagName(tagName, getter_AddRefs(list))))
+    return NS_ERROR_FAILURE;
+  nsCOMPtr<nsIDOMNode> domNode;
+  list->Item(0, getter_AddRefs(domNode));
+  if (!domNode)
+    return NS_ERROR_FAILURE;
+  nsCOMPtr<nsIDOM3Node> domChildNode(do_QueryInterface(domNode));
+  return domChildNode->GetTextContent(value);
+}
+
+nsresult WMSettings::MakeXMLdoc(nsIDOMDocument** xmlDoc,
+                                nsILocalFile* file)
+{
+  nsresult rv;
+  nsCOMPtr<nsIFileInputStream> stream =
+    do_CreateInstance(NS_LOCALFILEINPUTSTREAM_CONTRACTID, &rv);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  rv = stream->Init(file, PR_RDONLY, -1, 0);
+  nsCOMPtr<nsIDOMParser> parser = do_CreateInstance(NS_DOMPARSER_CONTRACTID);
+  NS_ENSURE_STATE(parser);
+  PRInt64 filesize;
+  file->GetFileSize(&filesize);
+  return parser->ParseFromStream(stream, nsnull, PRInt32(filesize),
+                                 "application/xml", xmlDoc);
+}
+
+PRBool WMSettings::DoImport(nsIMsgAccount **ppAccount)
+{
+  nsresult rv;
+
+  // do the windows registry stuff first
+  nsCOMPtr<nsIWindowsRegKey> key =
+    do_CreateInstance("@mozilla.org/windows-registry-key;1");
+  if (NS_FAILED(FindWMKey(key))) {
+    IMPORT_LOG0("*** Error finding Windows Live Mail registry account keys\n");
+    return PR_FALSE;
   }
-  // else defmailname will be "".  No big deal.
-
-  // 'poll for messages' setting in OE is a global setting
-  // in OE options general tab and in following global OE
-  // registry location.
-  // for all accounts poll interval is a 32 bit value, 0 for
-  // "don't poll", else milliseconds
-  HKEY    subSubKey;
-
-  subKey = Find50Key();
-  if (!subKey )
-    subKey = Find40Key();
-  // above key not critical
-
+  // 'poll for messages' setting in WM is a global setting-Like OE
+  // for all accounts dword ==0xffffffff for don't poll else 1/60000 = minutes
   checkNewMailTime = 30;
   checkNewMail = PR_FALSE;
-  if (subKey){
-    if (::RegOpenKeyEx(subKey, "Mail", 0, KEY_QUERY_VALUE,
-                       &subSubKey) == ERROR_SUCCESS) {
-      ::RegCloseKey( subKey);
-      BYTE *  pBytes = nsOERegUtil::GetValueBytes( subSubKey, "Poll For Mail");
-      ::RegCloseKey( subSubKey);
-      if (pBytes) {
-        if (*(PRInt32 *)pBytes != -1){
-          checkNewMail = PR_TRUE;
-          checkNewMailTime = *(PRInt32 *)pBytes / 60000;
-        }
-        nsOERegUtil::FreeValueBytes( pBytes);
-      }
+  nsCOMPtr<nsIWindowsRegKey> subKey;
+  if (NS_SUCCEEDED(key->OpenChild(NS_LITERAL_STRING("mail"),
+                                  nsIWindowsRegKey::ACCESS_QUERY_VALUE,
+                                  getter_AddRefs(subKey)))) {
+    PRUint32 dwordResult = -1;
+    rv = subKey->ReadIntValue(NS_LITERAL_STRING("Poll For Mail"), &dwordResult); // reg_dword
+    subKey->Close();
+    if (NS_SUCCEEDED(rv) && dwordResult != -1){
+      checkNewMail = PR_TRUE;
+      checkNewMailTime = dwordResult / 60000;
     }
   }
+  // these are in main windowsmail key and if they don't exist-not to worry
+  // (less than 64 chars) e.g. account{4A18B81E-83CA-472A-8D7F-5301C0B97B8D}.oeaccount
+  nsAutoString  defMailAcct, defNewsAcct;
+  key->ReadStringValue(NS_LITERAL_STRING("Default Mail Account"), defMailAcct); // ref_sz
+  key->ReadStringValue(NS_LITERAL_STRING("Default News Account"), defNewsAcct); // ref_sz
+
+  // This is essential to proceed; it is the location on disk of xml-type account files;
+  // it is in reg_expand_sz so it will need expanding to absolute path.
+  nsString  storeRoot;
+  rv = key->ReadStringValue(NS_LITERAL_STRING("Store Root"), storeRoot);
+  key->Close();  // Finished with windows registry key. We do not want to return before this closing
+  if (NS_FAILED(rv) || storeRoot.IsEmpty()) {
+    IMPORT_LOG0("*** Error finding Windows Live Mail Store Root\n");
+    return PR_FALSE;
+  }
+
+  nsCOMPtr<nsILocalFile> file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
+  if (!file) {
+    IMPORT_LOG0("*** Failed to create an nsILocalFile!\n");
+    return PR_FALSE;
+  }
+  nsCOMPtr<nsIMsgAccountManager> accMgr =
+           do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
+  if (NS_FAILED(rv)) {
+    IMPORT_LOG0("*** Failed to create an account manager!\n");
+    return PR_FALSE;
+  }
 
-  // Iterate the accounts looking for POP3 & IMAP accounts...
-  // Ignore LDAP for now!
-  DWORD      index = 0;
-  DWORD      numChars;
-  TCHAR      keyName[256];
-  LONG       result = ERROR_SUCCESS;
-  BYTE *     pBytes;
-  int        accounts = 0;
-  nsCString  keyComp;
+  PRUint32 size = ::ExpandEnvironmentStringsW((LPCWSTR)storeRoot.get(), nsnull, 0);
+  nsString expandedStoreRoot;
+  expandedStoreRoot.SetLength(size - 1);
+  if (expandedStoreRoot.Length() != size - 1)
+    return NS_ERROR_OUT_OF_MEMORY;
+  ::ExpandEnvironmentStringsW((LPCWSTR)storeRoot.get(),
+                              (LPWSTR)expandedStoreRoot.BeginWriting(),
+                              size);
+  storeRoot = expandedStoreRoot;
 
-  while (result == ERROR_SUCCESS) {
-    numChars = 256;
-    result = ::RegEnumKeyEx( hKey, index, keyName, &numChars, NULL, NULL, NULL, NULL);
-    index++;
-    if (result == ERROR_SUCCESS) {
-      if (::RegOpenKeyEx( hKey, keyName, 0, KEY_QUERY_VALUE, &subKey) == ERROR_SUCCESS) {
-        // Get the values for this account.
-        IMPORT_LOG1( "Opened Outlook Express account: %s\n", (char *)keyName);
+  if (NS_FAILED(file->InitWithPath(storeRoot))) {
+    IMPORT_LOG0("*** Failed get store root!\n");
+    return PR_FALSE;
+  }
+  nsCOMArray<nsILocalFile> fileArray;
+  if (!getOEacctFiles(file, fileArray)) {
+    IMPORT_LOG0("*** Failed to get OEacctFiles!\n");
+    return PR_FALSE;
+  }
 
-        nsIMsgAccount  *anAccount = nsnull;
-        pBytes = nsOERegUtil::GetValueBytes( subKey, "IMAP Server");
-        if (pBytes) {
-          if (DoIMAPServer( accMgr, subKey, (char *)pBytes, &anAccount))
-            accounts++;
-          nsOERegUtil::FreeValueBytes( pBytes);
-        }
+  // Loop through *.oeaccounts files looking for POP3 & IMAP & NNTP accounts
+  // Ignore LDAP for now!
+  int accounts = 0;
+  nsCOMPtr<nsIDOMDocument> xmlDoc;
 
-        pBytes = nsOERegUtil::GetValueBytes( subKey, "NNTP Server");
-        if (pBytes) {
-          if (DoNNTPServer( accMgr, subKey, (char *)pBytes, &anAccount))
-            accounts++;
-          nsOERegUtil::FreeValueBytes( pBytes);
-        }
+  for (PRInt32 i = fileArray.Count() - 1 ; i >= 0; i--){
+    MakeXMLdoc(getter_AddRefs(xmlDoc), fileArray[i]);
 
-        pBytes = nsOERegUtil::GetValueBytes( subKey, "POP3 Server");
-        if (pBytes) {
-            if (DoPOP3Server( accMgr, subKey, (char *)pBytes, &anAccount)) {
-              accounts++;
-          }
-          nsOERegUtil::FreeValueBytes( pBytes);
-        }
+    nsAutoString value;
+    nsCOMPtr<nsIMsgAccount> anAccount;
+    if (NS_SUCCEEDED(GetValueForTag(xmlDoc, NS_LITERAL_STRING("IMAP_Server"),
+        value)))
+      if (DoIMAPServer(accMgr, xmlDoc, value, getter_AddRefs(anAccount)))
+        accounts++;
+    if (NS_SUCCEEDED(GetValueForTag(xmlDoc, NS_LITERAL_STRING("NNTP_Server"),
+        value)))
+      if (DoNNTPServer(accMgr, xmlDoc, value, getter_AddRefs(anAccount)))
+        accounts++;
+    if (NS_SUCCEEDED(GetValueForTag(xmlDoc, NS_LITERAL_STRING("POP3_Server"),
+        value)))
+      if (DoPOP3Server(accMgr, xmlDoc, value, getter_AddRefs(anAccount)))
+        accounts++;
 
-        if (anAccount) {
-          // Is this the default account?
-          keyComp = keyName;
-          if (keyComp.Equals( defMailName)) {
-            accMgr->SetDefaultAccount( anAccount);
-          }
-          NS_RELEASE( anAccount);
-        }
-
-        ::RegCloseKey( subKey);
-      }
+    if (anAccount) {
+      nsString name;
+      // Is this the default account?
+      fileArray[i]->GetLeafName(name);
+      if (defMailAcct.Equals(name))
+        accMgr->SetDefaultAccount(anAccount);
     }
   }
-  ::RegCloseKey( hKey);
 
   // Now save the new acct info to pref file.
   rv = accMgr->SaveAccountInfo();
   NS_ASSERTION(NS_SUCCEEDED(rv), "Can't save account info to pref file");
 
   return( accounts != 0);
 }
 
-nsresult OESettings::GetAccountName(HKEY hKey, char *defaultName, nsString &acctName)
+PRBool WMSettings::DoIMAPServer(nsIMsgAccountManager *pMgr,
+                                nsIDOMDocument *xmlDoc,
+                                const nsString& serverName,
+                                nsIMsgAccount **ppAccount)
 {
-  BYTE *pAccName = nsOERegUtil::GetValueBytes( hKey, "Account Name");
-  nsresult rv = NS_OK;
-  if (pAccName) {
-    rv = nsMsgI18NConvertToUnicode(nsMsgI18NFileSystemCharset(),
-                                   nsDependentCString((const char *)pAccName), acctName);
-    nsOERegUtil::FreeValueBytes( pAccName);
-  }
-  else
-    acctName.AssignASCII(defaultName);
-  return rv;
-}
-
-PRBool OESettings::DoIMAPServer( nsIMsgAccountManager *pMgr, HKEY hKey, char *pServerName, nsIMsgAccount **ppAccount)
-{
-  PRInt32 authMethod;
+  PRInt32 authMethod;   // Secure Password Authentication (SPA)
+  PRInt32 errorCode;
   if (ppAccount)
     *ppAccount = nsnull;
 
-  char * pUserName;
-  pUserName = (char *)nsOERegUtil::GetValueBytes(hKey, "IMAP User Name");
-  if (!pUserName)
-    return( PR_FALSE);
-
+  nsAutoString userName, value;
+  if (NS_FAILED(GetValueForTag(xmlDoc, NS_LITERAL_STRING("IMAP_User_Name"),
+                               userName)))
+    return PR_FALSE;
   PRBool result = PR_FALSE;
-
   // I now have a user name/server name pair, find out if it already exists?
   nsCOMPtr<nsIMsgIncomingServer> in;
-  nsresult rv = pMgr->FindServer(nsDependentCString(pUserName),
-                                 nsDependentCString(pServerName),
+  nsresult rv = pMgr->FindServer(NS_ConvertUTF16toUTF8(userName),
+                                 NS_ConvertUTF16toUTF8(serverName),
                                  NS_LITERAL_CSTRING("imap"),
                                  getter_AddRefs(in));
-  if (NS_FAILED( rv) || (in == nsnull)) {
+  if (NS_FAILED(rv) || (in == nsnull)) {
     // Create the incoming server and an account for it?
-    rv = pMgr->CreateIncomingServer(nsDependentCString(pUserName),
-                                    nsDependentCString(pServerName),
+    rv = pMgr->CreateIncomingServer(NS_ConvertUTF16toUTF8(userName),
+                                    NS_ConvertUTF16toUTF8(serverName),
                                     NS_LITERAL_CSTRING("imap"),
                                     getter_AddRefs(in));
-    if (NS_SUCCEEDED( rv) && in) {
-      BYTE * pRootFolder = nsOERegUtil::GetValueBytes(hKey, "IMAP Root Folder");
-      if (pRootFolder)
-      {
-        nsCOMPtr<nsIImapIncomingServer> imapServer = do_QueryInterface(in);
-        imapServer->SetServerDirectory(nsDependentCString((const char *) pRootFolder));
-        nsOERegUtil::FreeValueBytes(pRootFolder);
+    if (NS_SUCCEEDED(rv) && in) {
+      nsCOMPtr<nsIImapIncomingServer> imapServer = do_QueryInterface(in);
+      if (!imapServer){
+        IMPORT_LOG1("*** Failed to create nsIImapIncomingServer for %S!\n",
+                    serverName.get());
+        return PR_FALSE;
       }
-
-      BYTE * pSecureConnection = nsOERegUtil::GetValueBytes(hKey, "IMAP Secure Connection");
-      if (pSecureConnection)
-      {
-        if (*pSecureConnection)
-          in->SetSocketType(nsMsgSocketType::SSL);
-        nsOERegUtil::FreeValueBytes(pSecureConnection);
-      }
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("IMAP_Root_Folder"), value);
+      if (!value.IsEmpty())
+        imapServer->SetServerDirectory(NS_ConvertUTF16toUTF8(value));
 
-      BYTE * pPort = nsOERegUtil::GetValueBytes(hKey, "IMAP Port");
-      if (pPort)
-      {
-        in->SetPort(*(PRInt32 *) pPort);
-        nsOERegUtil::FreeValueBytes(pPort);
-      }
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("IMAP_Secure_Connection"), value);
+      if (value.ToInteger(&errorCode, 16))
+        in->SetSocketType(nsMsgSocketType::SSL);
 
-      BYTE * pBytesTemp = nsOERegUtil::GetValueBytes(hKey, "IMAP Use Sicily");
-      if (pBytesTemp)
-      {
-        PRBool secAuth = *(PRBool *)pBytesTemp;
-        nsOERegUtil::FreeValueBytes(pBytesTemp);
-        authMethod = secAuth ? nsMsgAuthMethod::secure
-            : nsMsgAuthMethod::passwordCleartext;
-      }
-      else {
-        authMethod = nsMsgAuthMethod::passwordCleartext;
-      }
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("IMAP_Use_Sicily"), value);
+      PRBool secAuth = (PRBool)value.ToInteger(&errorCode, 16);
+      authMethod = secAuth ? nsMsgAuthMethod::secure :
+                             nsMsgAuthMethod::passwordCleartext;
       in->SetAuthMethod(authMethod);
 
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("IMAP_Port"), value);
+      if (!value.IsEmpty())
+        in->SetPort(value.ToInteger(&errorCode, 16));
+
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("Account_Name"), value);
+      if (!value.IsEmpty())
+        rv = in->SetPrettyName(value);
       in->SetDoBiff(checkNewMail);
       in->SetBiffMinutes(checkNewMailTime);
 
-      IMPORT_LOG2("Created IMAP server named: %s, userName: %s\n",
-                   pServerName, pUserName);
-
-      nsString prettyName;
-      if (NS_SUCCEEDED(GetAccountName(hKey, pServerName, prettyName)))
-        rv = in->SetPrettyName(prettyName);
+      IMPORT_LOG2("Created IMAP server named: %S, userName: %S\n",
+                  serverName.get(), userName.get());
 
       // We have a server, create an account.
       nsCOMPtr<nsIMsgAccount> account;
-      rv = pMgr->CreateAccount(getter_AddRefs( account));
-      if (NS_SUCCEEDED( rv) && account) {
+      rv = pMgr->CreateAccount(getter_AddRefs(account));
+      if (NS_SUCCEEDED(rv) && account) {
         rv = account->SetIncomingServer(in);
 
-        IMPORT_LOG0("Created an account and set the IMAP server as the incoming server\n");
+        IMPORT_LOG0("Created an account and set the IMAP server "
+                    "as the incoming server\n");
 
         // Fiddle with the identities
-        SetIdentities(pMgr, account, hKey, pUserName, authMethod, PR_FALSE);
+        SetIdentities(pMgr, account, xmlDoc, userName, authMethod, PR_FALSE);
         result = PR_TRUE;
         if (ppAccount)
-          account->QueryInterface(NS_GET_IID(nsIMsgAccount), (void **)ppAccount);
+          account.forget(ppAccount);
       }
     }
   }
   else if (NS_SUCCEEDED(rv) && in) {
     // for an existing server we create another identity,
     //  TB lists under 'manage identities'
     nsCOMPtr<nsIMsgAccount> account;
-    rv = pMgr->FindAccountForServer(in, getter_AddRefs( account));
-    if (NS_SUCCEEDED( rv) && account) {
-      IMPORT_LOG0("Created an identity and added to existing IMAP incoming server\n");
+    rv = pMgr->FindAccountForServer(in, getter_AddRefs(account));
+    if (NS_SUCCEEDED(rv) && account) {
+      IMPORT_LOG0("Created an identity and added to existing "
+                  "IMAP incoming server\n");
       // Fiddle with the identities
       in->GetAuthMethod(&authMethod);
-      SetIdentities(pMgr, account, hKey, pUserName, authMethod, PR_FALSE);
+      SetIdentities(pMgr, account, xmlDoc, userName, authMethod, PR_FALSE);
       result = PR_TRUE;
       if (ppAccount)
-        account->QueryInterface(NS_GET_IID(nsIMsgAccount),
-                                 (void **)ppAccount);
+        account.forget(ppAccount);
     }
   }
   else
     result = PR_TRUE;
-  nsOERegUtil::FreeValueBytes((BYTE *) pUserName);
-  return( result);
+  return result;
 }
 
-PRBool OESettings::DoPOP3Server( nsIMsgAccountManager *pMgr, HKEY hKey, char *pServerName, nsIMsgAccount **ppAccount)
+PRBool WMSettings::DoPOP3Server(nsIMsgAccountManager *pMgr,
+                                nsIDOMDocument *xmlDoc,
+                                const nsString& serverName,
+                                nsIMsgAccount **ppAccount)
 {
-  PRInt32 authMethod;    // Secure Password Authentication
+  PRInt32 authMethod;   // Secure Password Authentication (SPA)
+  PRInt32 errorCode;
   if (ppAccount)
     *ppAccount = nsnull;
 
-  char * pUserName;
-  pUserName = (char *)nsOERegUtil::GetValueBytes( hKey, "POP3 User Name");
-  if (!pUserName)
-    return( PR_FALSE);
-
+  nsAutoString userName, value;
+  if (NS_FAILED(GetValueForTag(xmlDoc, NS_LITERAL_STRING("POP3_User_Name"),
+                               userName)))
+    return PR_FALSE;
   PRBool result = PR_FALSE;
-
   // I now have a user name/server name pair, find out if it already exists?
   nsCOMPtr<nsIMsgIncomingServer> in;
-  nsresult rv = pMgr->FindServer(nsDependentCString(pUserName),
-                                 nsDependentCString(pServerName),
+  nsresult rv = pMgr->FindServer(NS_ConvertUTF16toUTF8(userName),
+                                 NS_ConvertUTF16toUTF8(serverName),
                                  NS_LITERAL_CSTRING("pop3"),
-                                 getter_AddRefs( in));
-  if (NS_FAILED( rv) || (in == nsnull)) {
+                                 getter_AddRefs(in));
+  if (NS_FAILED(rv) || (in == nsnull)) {
     // Create the incoming server and an account for it?
-    rv = pMgr->CreateIncomingServer(nsDependentCString(pUserName),
-                                    nsDependentCString(pServerName),
+    rv = pMgr->CreateIncomingServer(NS_ConvertUTF16toUTF8(userName),
+                                    NS_ConvertUTF16toUTF8(serverName),
                                     NS_LITERAL_CSTRING("pop3"),
-                                    getter_AddRefs( in));
-    if (NS_SUCCEEDED( rv) && in) {
-      BYTE * pSecureConnection = nsOERegUtil::GetValueBytes( hKey, "POP3 Secure Connection");
-      if (pSecureConnection)
-      {
-        if (*pSecureConnection)
-          in->SetSocketType(nsMsgSocketType::SSL);
-        nsOERegUtil::FreeValueBytes(pSecureConnection);
+                                    getter_AddRefs(in));
+    if (NS_SUCCEEDED(rv) && in) {
+      nsCOMPtr<nsIPop3IncomingServer> pop3Server = do_QueryInterface(in);
+      if (!pop3Server){
+        IMPORT_LOG1("*** Failed to create nsIPop3IncomingServer for %S!\n",
+          serverName.get());
+        return PR_FALSE;
       }
 
-      BYTE * pPort = nsOERegUtil::GetValueBytes( hKey, "POP3 Port");
-      if (pPort)
-      {
-        in->SetPort(*(PRInt32 *) pPort);
-        nsOERegUtil::FreeValueBytes(pPort);
-      }
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("POP3_Secure_Connection"), value);
+      if (value.ToInteger(&errorCode, 16))
+        in->SetSocketType(nsMsgSocketType::SSL);
+
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("POP3_Use_Sicily"), value);
+      PRBool secAuth = (PRBool)value.ToInteger(&errorCode, 16);
+      authMethod = secAuth ? nsMsgAuthMethod::secure :
+                             nsMsgAuthMethod::passwordCleartext;
+      in->SetAuthMethod(authMethod);
+
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("POP3_Port"), value);
+      if (!value.IsEmpty())
+        in->SetPort(value.ToInteger(&errorCode, 16));
 
-      BYTE * pBytesTemp = nsOERegUtil::GetValueBytes( hKey, "POP3 Use Sicily");
-      if (pBytesTemp)
-      {
-        PRBool secAuth = *(PRBool *)pBytesTemp;
-        nsOERegUtil::FreeValueBytes(pBytesTemp);
-        authMethod = secAuth ? nsMsgAuthMethod::secure
-            : nsMsgAuthMethod::passwordCleartext;
-      }
-      else {
-        authMethod = nsMsgAuthMethod::passwordCleartext;
-      }
-      in->SetAuthMethod(authMethod);
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("POP3_Skip_Account"), value);
+      if (!value.IsEmpty())
+        // OE:0=='Include this account when receiving mail or synchronizing'==
+        // TB:1==ActMgr:Server:advanced:Include this server when getting new mail
+        pop3Server->SetDeferGetNewMail(value.ToInteger(&errorCode, 16) == 0);
+      else
+        pop3Server->SetDeferGetNewMail(PR_FALSE);
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("Leave_Mail_On_Server"), value);
+      if (!value.IsEmpty())
+        pop3Server->SetLeaveMessagesOnServer((PRBool)value.ToInteger(&errorCode, 16));
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("Remove_When_Deleted"), value);
+      if (!value.IsEmpty())
+        pop3Server->SetDeleteMailLeftOnServer((PRBool)value.ToInteger(&errorCode, 16));
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("Remove_When_Expired"), value);
+      if (!value.IsEmpty())
+        pop3Server->SetDeleteByAgeFromServer((PRBool)value.ToInteger(&errorCode, 16));
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("Expire_Days"), value);
+      if (!value.IsEmpty())
+        pop3Server->SetNumDaysToLeaveOnServer(value.ToInteger(&errorCode, 16));
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("Account_Name"), value);
+      if (!value.IsEmpty())
+        rv = in->SetPrettyName(value);
 
       in->SetDoBiff(checkNewMail);
       in->SetBiffMinutes(checkNewMailTime);
-      nsCOMPtr<nsIPop3IncomingServer> pop3Server = do_QueryInterface(in);
-      if (pop3Server) {
-        // set local folders as the Inbox to use for this POP3 server
-        nsCOMPtr<nsIMsgIncomingServer> localFoldersServer;
-        pMgr->GetLocalFoldersServer(getter_AddRefs(localFoldersServer));
-
-        if (!localFoldersServer)
-        {
-          // If Local Folders does not exist already, create it
-
-          if (NS_FAILED(pMgr->CreateLocalMailAccount())) {
-            IMPORT_LOG0("*** Failed to create Local Folders!\n");
-            return PR_FALSE;
-          }
-
-          pMgr->GetLocalFoldersServer(getter_AddRefs(localFoldersServer));
-        }
-
-        // now get the account for this server
-        nsCOMPtr<nsIMsgAccount> localFoldersAccount;
-        pMgr->FindAccountForServer(localFoldersServer, getter_AddRefs(localFoldersAccount));
-        if (localFoldersAccount)
-        {
-          nsCString localFoldersAcctKey;
-          localFoldersAccount->GetKey(localFoldersAcctKey);
-          pop3Server->SetDeferredToAccount(localFoldersAcctKey);
-        }
 
-        pBytesTemp = nsOERegUtil::GetValueBytes(hKey, "POP3 Skip Account");
-        if (pBytesTemp)
-        {
-        // OE:0=='Include this account when receiving mail or synchronizing'==
-        // TB:1==AM:Server:advanced:Include this server when getting new mail
-          pop3Server->SetDeferGetNewMail(*pBytesTemp == 0);
-          nsOERegUtil::FreeValueBytes(pBytesTemp);
-        }
-        else
-          pop3Server->SetDeferGetNewMail(PR_FALSE);
-        pBytesTemp = nsOERegUtil::GetValueBytes(hKey, "Leave Mail On Server");
-        if (pBytesTemp)
-        {
-          pop3Server->SetLeaveMessagesOnServer(*pBytesTemp == 1);
-          nsOERegUtil::FreeValueBytes(pBytesTemp);
+      // set local folders as the Inbox to use for this POP3 server
+      nsCOMPtr<nsIMsgIncomingServer> localFoldersServer;
+      pMgr->GetLocalFoldersServer(getter_AddRefs(localFoldersServer));
+      if (!localFoldersServer) {
+        // XXX: We may need to move this local folder creation
+        // code to the generic nsImportSettings code
+        // if the other import modules end up needing to do this too.
+        // if Local Folders does not exist already, create it
+        rv = pMgr->CreateLocalMailAccount();
+        if (NS_FAILED(rv)) {
+          IMPORT_LOG0("*** Failed to create Local Folders!\n");
+          return PR_FALSE;
         }
-        pBytesTemp = nsOERegUtil::GetValueBytes(hKey, "Remove When Deleted");
-        if (pBytesTemp)
-        {
-          pop3Server->SetDeleteMailLeftOnServer(*pBytesTemp == 1);
-          nsOERegUtil::FreeValueBytes(pBytesTemp);
-        }
-        pBytesTemp = nsOERegUtil::GetValueBytes(hKey, "Remove When Expired");
-        if (pBytesTemp)
-        {
-          pop3Server->SetDeleteByAgeFromServer(*pBytesTemp == 1);
-          nsOERegUtil::FreeValueBytes(pBytesTemp);
-        }
-        pBytesTemp = nsOERegUtil::GetValueBytes(hKey, "Expire Days");
-        if (pBytesTemp)
-        {
-          pop3Server->SetNumDaysToLeaveOnServer(*(PRInt32*)pBytesTemp );
-          nsOERegUtil::FreeValueBytes(pBytesTemp);
-        }
+        pMgr->GetLocalFoldersServer(getter_AddRefs(localFoldersServer));
       }
-      IMPORT_LOG2("Created POP3 server named: %s, userName: %s\n",
-                   pServerName, pUserName);
-      nsString prettyName;
-      if (NS_SUCCEEDED(GetAccountName(hKey, pServerName, prettyName)))
-        rv = in->SetPrettyName( prettyName);
+
+      // now get the account for this server
+      nsCOMPtr<nsIMsgAccount> localFoldersAccount;
+      pMgr->FindAccountForServer(localFoldersServer,
+                                 getter_AddRefs(localFoldersAccount));
+      if (localFoldersAccount) {
+        nsCString localFoldersAcctKey;
+        localFoldersAccount->GetKey(localFoldersAcctKey);
+        pop3Server->SetDeferredToAccount(localFoldersAcctKey);
+      }
+
+      IMPORT_LOG2("Created POP3 server named: %S, userName: %S\n",
+                  serverName.get(), userName.get());
 
       // We have a server, create an account.
-      nsCOMPtr<nsIMsgAccount>  account;
-      rv = pMgr->CreateAccount(getter_AddRefs( account));
-      if (NS_SUCCEEDED( rv) && account) {
+      nsCOMPtr<nsIMsgAccount> account;
+      rv = pMgr->CreateAccount(getter_AddRefs(account));
+      if (NS_SUCCEEDED(rv) && account) {
         rv = account->SetIncomingServer(in);
-        IMPORT_LOG0("Created a new account and set the incoming server to the POP3 server.\n");
+        IMPORT_LOG0("Created a new account and set the incoming "
+                    "server to the POP3 server.\n");
 
         // Fiddle with the identities
-        SetIdentities(pMgr, account, hKey, pUserName, authMethod, PR_FALSE);
+        SetIdentities(pMgr, account, xmlDoc, userName, authMethod, PR_FALSE);
         result = PR_TRUE;
         if (ppAccount)
-          account->QueryInterface(NS_GET_IID(nsIMsgAccount),
-                                   (void **)ppAccount);
+          account.forget(ppAccount);
       }
     }
-  } 
+  }
   else if (NS_SUCCEEDED(rv) && in) {
-    IMPORT_LOG2("Existing POP3 server named: %s, userName: %s\n",
-                pServerName, pUserName);
+    IMPORT_LOG2("Existing POP3 server named: %S, userName: %S\n",
+                serverName.get(), userName.get());
     // for an existing server we create another identity,
     // TB listed under 'manage identities'
     nsCOMPtr<nsIMsgAccount>  account;
-    rv = pMgr->FindAccountForServer(in, getter_AddRefs( account));
+    rv = pMgr->FindAccountForServer(in, getter_AddRefs(account));
     if (NS_SUCCEEDED(rv) && account) {
       IMPORT_LOG0("Created identity and added to existing POP3 incoming server.\n");
       // Fiddle with the identities
       in->GetAuthMethod(&authMethod);
-      SetIdentities(pMgr, account, hKey, pUserName, authMethod, PR_FALSE);
+      SetIdentities(pMgr, account, xmlDoc, userName, authMethod, PR_FALSE);
       result = PR_TRUE;
       if (ppAccount)
-        account->QueryInterface(NS_GET_IID(nsIMsgAccount), (void **)ppAccount);
+        account.forget(ppAccount);
     }
   }
   else
     result = PR_TRUE;
-  nsOERegUtil::FreeValueBytes((BYTE *) pUserName);
   return result;
 }
 
-PRBool OESettings::DoNNTPServer( nsIMsgAccountManager *pMgr, HKEY hKey,
-                                char *pServerName, nsIMsgAccount **ppAccount)
+PRBool WMSettings::DoNNTPServer(nsIMsgAccountManager *pMgr,
+                                nsIDOMDocument *xmlDoc,
+                                const nsString& serverName,
+                                nsIMsgAccount **ppAccount)
 {
+  PRBool authMethod;
+  PRInt32 errorCode;
   if (ppAccount)
     *ppAccount = nsnull;
 
-  char * pUserName;
-  // this only exists if NNTP server requires it or not anon login
-  pUserName = (char *)nsOERegUtil::GetValueBytes(hKey, "NNTP User Name");
-
+  nsAutoString userName, value;
+  // this only exists if NNTP server requires it or not, anonymous login
+  GetValueForTag(xmlDoc, NS_LITERAL_STRING("NNTP_User_Name"), userName);
   PRBool result = PR_FALSE;
 
   // I now have a user name/server name pair, find out if it already exists?
   // NNTP can have empty user name.  This is wild card in findserver
   nsCOMPtr<nsIMsgIncomingServer> in;
   nsresult rv = pMgr->FindServer(EmptyCString(),
-                                 nsDependentCString(pServerName),
-                                 NS_LITERAL_CSTRING("nntp"),
-                                 getter_AddRefs(in));
-  if (NS_FAILED( rv) || (in == nsnull)) {
+                         NS_ConvertUTF16toUTF8(serverName),
+                         NS_LITERAL_CSTRING("nntp"),
+                         getter_AddRefs(in));
+  if (NS_FAILED(rv) || (in == nsnull)) {
     // Create the incoming server and an account for it?
-    rv = pMgr->CreateIncomingServer(EmptyCString(),
-                                    nsDependentCString(pServerName),
+    rv = pMgr->CreateIncomingServer(nsDependentCString(""),
+                                    NS_ConvertUTF16toUTF8(serverName),
                                     NS_LITERAL_CSTRING("nntp"),
                                     getter_AddRefs(in));
-    if (NS_SUCCEEDED( rv) && in) {
-      BYTE * pBytesTemp = nsOERegUtil::GetValueBytes(hKey, "NNTP Port");
-      if (pBytesTemp && *(PRInt32 *)pBytesTemp != 119)
-        in->SetPort(*(PRInt32 *) pBytesTemp);
-      nsOERegUtil::FreeValueBytes(pBytesTemp);
+    if (NS_SUCCEEDED(rv) && in) {
 
-      // do nntpincomingserver stuff
       nsCOMPtr<nsINntpIncomingServer> nntpServer = do_QueryInterface(in);
-      if (nntpServer && pUserName && *pUserName) {
+      if (!nntpServer) {
+        IMPORT_LOG1("*** Failed to create nsINnntpIncomingServer for %S!\n",
+          serverName.get());
+        return PR_FALSE;
+      }
+      if (!userName.IsEmpty()) {  // if username req'd then auth req'd
         nntpServer->SetPushAuth(PR_TRUE);
-        in->SetUsername(nsDependentCString(pUserName));
+        in->SetUsername(NS_ConvertUTF16toUTF8(userName));
       }
 
-      IMPORT_LOG2("Created NNTP server named: %s, userName: %s\n",
-                   pServerName, pUserName? pUserName : "");
+      nsAutoString value;
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("NNTP_Port"), value);
+      if (!value.IsEmpty()) {
+        in->SetPort(value.ToInteger(&errorCode, 16));
+      }
 
-      nsString prettyName;
-      if (NS_SUCCEEDED(GetAccountName(hKey, pServerName, prettyName)))
-        rv = in->SetPrettyName(prettyName);
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("Account_Name"), value);
+      if (!value.IsEmpty()) {
+        in->SetPrettyName(value);
+      }
+
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("NNTP_Use_Sicily"), value);
+      PRBool secAuth = (PRBool)value.ToInteger(&errorCode, 16);
+      authMethod = secAuth ? nsMsgAuthMethod::secure :
+                             nsMsgAuthMethod::passwordCleartext;
+      in->SetAuthMethod(authMethod);
+
+      IMPORT_LOG2("Created NNTP server named: %S, userName: %S\n",
+                  serverName.get(), userName.get());
 
       // We have a server, create an account.
       nsCOMPtr<nsIMsgAccount> account;
-      rv = pMgr->CreateAccount(getter_AddRefs( account));
+      rv = pMgr->CreateAccount(getter_AddRefs(account));
       if (NS_SUCCEEDED(rv) && account) {
         rv = account->SetIncomingServer(in);
 
-        IMPORT_LOG0("Created an account and set the NNTP server as the incoming server\n");
+        IMPORT_LOG0("Created an account and set the NNTP server "
+                    "as the incoming server\n");
 
         // Fiddle with the identities
-        SetIdentities(pMgr, account, hKey, pUserName, 0, PR_TRUE);
+        SetIdentities(pMgr, account, xmlDoc, userName, authMethod, PR_TRUE);
         result = PR_TRUE;
         if (ppAccount)
-          account->QueryInterface(NS_GET_IID(nsIMsgAccount), (void **)ppAccount);
+          account.forget(ppAccount);
       }
     }
   }
   else if (NS_SUCCEEDED(rv) && in) {
     // for the existing server...
     nsCOMPtr<nsIMsgAccount> account;
-    rv = pMgr->FindAccountForServer(in, getter_AddRefs( account));
-    if (NS_SUCCEEDED( rv) && account) {
-      IMPORT_LOG0("Using existing account and set the NNTP server as the incoming server\n");
+    rv = pMgr->FindAccountForServer(in, getter_AddRefs(account));
+    if (NS_SUCCEEDED(rv) && account) {
+      IMPORT_LOG0("Using existing account and set the "
+                  "NNTP server as the incoming server\n");
       // Fiddle with the identities
-      SetIdentities(pMgr, account, hKey, pUserName, 0, PR_TRUE);
+      in->GetAuthMethod(&authMethod);
+      SetIdentities(pMgr, account, xmlDoc, userName, authMethod, PR_TRUE);
       result = PR_TRUE;
       if (ppAccount)
-        account->QueryInterface(NS_GET_IID(nsIMsgAccount),
-                                 (void **)ppAccount);
+        account.forget(ppAccount);
     }
   }
   else
     result = PR_TRUE;
-  nsOERegUtil::FreeValueBytes((BYTE *) pUserName);
   return result;
 }
 
-void OESettings::SetIdentities(nsIMsgAccountManager *pMgr, nsIMsgAccount *pAcc,
-                               HKEY hKey, char *pIncomgUserName,
+void WMSettings::SetIdentities(nsIMsgAccountManager *pMgr, nsIMsgAccount *pAcc,
+                               nsIDOMDocument *xmlDoc, nsAutoString &inUserName,
                                PRInt32 authMethodIncoming, PRBool isNNTP )
 {
   // Get the relevant information for an identity
-  char *pSmtpServer = (char *)nsOERegUtil::GetValueBytes(hKey, "SMTP Server");
-  char *pName = (char *)nsOERegUtil::GetValueBytes(hKey, isNNTP ? "NNTP Display Name" : "SMTP Display Name");
-  char *pEmail = (char *)nsOERegUtil::GetValueBytes(hKey, isNNTP ? "NNTP Email Address" : "SMTP Email Address");
-  char *pReply = (char *)nsOERegUtil::GetValueBytes(hKey, isNNTP ? "NNTP Reply To Email Address" : "SMTP Reply To Email Address");
-  char *pOrgName = (char *)nsOERegUtil::GetValueBytes(hKey, isNNTP ? "NNTP Organization Name" : "SMTP Organization Name");
-
+  // BUG 470587. Don't set this: id->SetIdentityName(fullName);
   nsresult rv;
+  nsAutoString value;
 
-    nsCOMPtr<nsIMsgIdentity> id;
-    rv = pMgr->CreateIdentity(getter_AddRefs(id));
-    if (id) {
-      nsAutoString fullName, organization;
-      rv = nsMsgI18NConvertToUnicode(nsMsgI18NFileSystemCharset(),
-                                     nsCString(pName), fullName);
-      if (NS_SUCCEEDED(rv))
-        id->SetFullName(fullName);
-// BUG 470587. Don't set this: id->SetIdentityName(fullName);
+  nsCOMPtr<nsIMsgIdentity> id;
+  rv = pMgr->CreateIdentity(getter_AddRefs(id));
+  if (id) {
+    IMPORT_LOG0("Created identity and added to the account\n");
+    GetValueForTag(xmlDoc, isNNTP ?
+      NS_LITERAL_STRING("NNTP_Display_Name") :
+      NS_LITERAL_STRING("SMTP_Display_Name"), value);
+    id->SetFullName(value);
+    IMPORT_LOG1("\tname: %S\n", value.get());
 
-      rv = nsMsgI18NConvertToUnicode(nsMsgI18NFileSystemCharset(),
-                                     nsCString(pOrgName), organization);
-      if (NS_SUCCEEDED(rv))
-        id->SetOrganization(organization);
-
-      id->SetEmail(nsCString(pEmail));
-      if (pReply)
-        id->SetReplyTo(nsCString(pReply));
+    GetValueForTag(xmlDoc, isNNTP ?
+      NS_LITERAL_STRING("NNTP_Organization_Name") :
+      NS_LITERAL_STRING("SMTP_Organization_Name"), value);
+    id->SetOrganization(value);
 
-      // Outlook Express users are used to top style quoting.
-      id->SetReplyOnTop(isNNTP ? 0 : 1);
-      pAcc->AddIdentity(id);
+    GetValueForTag(xmlDoc, isNNTP ?
+      NS_LITERAL_STRING("NNTP_Email_Address") :
+      NS_LITERAL_STRING("SMTP_Email_Address"), value);
+    id->SetEmail(NS_ConvertUTF16toUTF8(value));
+    IMPORT_LOG1("\temail: %S\n", value.get());
 
-      IMPORT_LOG0("Created identity and added to the account\n");
-      IMPORT_LOG1("\tname: %s\n", pName);
-      IMPORT_LOG1("\temail: %s\n", pEmail);
-    }
+    GetValueForTag(xmlDoc,  isNNTP ?
+      NS_LITERAL_STRING("NNTP_Reply_To_Email_Address") :
+      NS_LITERAL_STRING("SMTP_Reply_To_Email_Address"), value);
+    id->SetReplyTo(NS_ConvertUTF16toUTF8(value));
+
+    // Windows users are used to top style quoting.
+    id->SetReplyOnTop(isNNTP ? 0 : 1);
+    pAcc->AddIdentity(id);
+  }
 
   if (!isNNTP)  // NNTP does not use SMTP in OE or TB
-    SetSmtpServer(pSmtpServer, hKey, id, pIncomgUserName, authMethodIncoming);
-
-  nsOERegUtil::FreeValueBytes((BYTE *)pName);
-  nsOERegUtil::FreeValueBytes((BYTE *)pSmtpServer);
-  nsOERegUtil::FreeValueBytes((BYTE *)pEmail);
-  nsOERegUtil::FreeValueBytes((BYTE *)pReply);
+    SetSmtpServer(xmlDoc, id, inUserName, authMethodIncoming);
 }
 
-void OESettings::SetSmtpServer(char *pSmtpServer, HKEY hKey,
-                               nsIMsgIdentity *id, char *pIncomgUserName,
-                               PRInt32 authMethodIncoming)
+void WMSettings::SetSmtpServer(nsIDOMDocument *xmlDoc, nsIMsgIdentity *id,
+                               nsAutoString& inUserName, PRInt32 authMethodIncoming)
 {
+  PRInt32 errorCode;
+
   // set the id.smtpserver accordingly
-  // first we have to calculate the smtp user name which is based on sicily
-  if (!hKey || !id || !pIncomgUserName || !pSmtpServer)
+  if (!id)
     return;
   nsCString smtpServerKey, userName;
-  BYTE *pBytes;
+  nsAutoString value, smtpName;
+  if (NS_FAILED(GetValueForTag(xmlDoc, NS_LITERAL_STRING("SMTP_Server"), smtpName)))
+    return;
+
+  // first we have to calculate the smtp user name which is based on sicily
   // smtp user name depends on sicily which may or not exist
   PRInt32 useSicily = 0;
-  if (pBytes = nsOERegUtil::GetValueBytes(hKey, "SMTP Use Sicily")){
-    useSicily = *(PRInt32 *)pBytes;
-    nsOERegUtil::FreeValueBytes(pBytes);
-  }
+  GetValueForTag(xmlDoc, NS_LITERAL_STRING("SMTP_Use_Sicily"), value);
+  useSicily = (PRInt32)value.ToInteger(&errorCode,16);
+
   switch (useSicily) {
     case 1 : case 3 :
-      // has to go in whether empty or no
-      // shouldn't be empty but better safe than sorry
-      if (pBytes = nsOERegUtil::GetValueBytes(hKey, "SMTP User Name")){
-        userName = (char *)pBytes;  // this may be empty; shouldn't be non-existent
-        nsOERegUtil::FreeValueBytes(pBytes);
-      }
+      GetValueForTag(xmlDoc, NS_LITERAL_STRING("SMTP_User_Name"), value);
+      CopyUTF16toUTF8(value, userName);
       break;
     case 2 :
-      userName = pIncomgUserName;
+      CopyUTF16toUTF8(inUserName, userName);
       break;
     default :
       break; // initial userName == ""
   }
 
   nsresult rv;
-  nsCOMPtr<nsISmtpService> smtpService(do_GetService(NS_SMTPSERVICE_CONTRACTID, &rv));
+  nsCOMPtr<nsISmtpService>
+    smtpService(do_GetService(NS_SMTPSERVICE_CONTRACTID, &rv));
   if (NS_SUCCEEDED(rv) && smtpService) {
-    nsCOMPtr<nsISmtpServer> foundServer;
+    nsCOMPtr<nsISmtpServer> extgServer;
     // don't try to make another server
     // regardless if username doesn't match
-    rv = smtpService->FindServer(userName.get(), pSmtpServer,
-                                 getter_AddRefs( foundServer));
-    if (NS_SUCCEEDED( rv) && foundServer) {
+    rv = smtpService->FindServer(userName.get(),
+                                 NS_ConvertUTF16toUTF8(smtpName).get(),
+                                 getter_AddRefs(extgServer));
+    if (NS_SUCCEEDED(rv) && extgServer) {
       // set our account keyed to this smptserver key
-      foundServer->GetKey(getter_Copies(smtpServerKey));
+      extgServer->GetKey(getter_Copies(smtpServerKey));
       id->SetSmtpServerKey(smtpServerKey);
 
-      IMPORT_LOG1("SMTP server already exists: %s\n", pSmtpServer);
+      IMPORT_LOG1("SMTP server already exists: %S\n", smtpName);
     }
     else {
       nsCOMPtr<nsISmtpServer> smtpServer;
-      rv = smtpService->CreateSmtpServer(getter_AddRefs( smtpServer));
-      if (NS_SUCCEEDED( rv) && smtpServer) {
-        pBytes = nsOERegUtil::GetValueBytes(hKey, "SMTP Port");
-        if (pBytes)
-        {
-          smtpServer->SetPort(*(PRInt32 *) pBytes);
-          nsOERegUtil::FreeValueBytes(pBytes);
+      rv = smtpService->CreateSmtpServer(getter_AddRefs(smtpServer));
+      if (NS_SUCCEEDED(rv) && smtpServer) {
+        GetValueForTag(xmlDoc, NS_LITERAL_STRING("SMTP_Port"), value);
+        if (!value.IsEmpty()) {
+          smtpServer->SetPort(value.ToInteger(&errorCode,16));
         }
-        pBytes = nsOERegUtil::GetValueBytes(hKey,"SMTP Secure Connection");
-        if (pBytes)
-        {
-          if (*(PRInt32 *)pBytes == 1)
+
+        GetValueForTag(xmlDoc, NS_LITERAL_STRING("SMTP_Secure_Connection"),
+                       value);
+        if (!value.IsEmpty()) {
+          if (value.ToInteger(&errorCode, 16) == 1)
             smtpServer->SetSocketType(nsMsgSocketType::SSL);
           else
             smtpServer->SetSocketType(nsMsgSocketType::plain);
-          nsOERegUtil::FreeValueBytes(pBytes);
         }
         smtpServer->SetUsername(userName);
         switch (useSicily) {
           case 1 :
             smtpServer->SetAuthMethod(nsMsgAuthMethod::secure);
             break;
-          case 2 : // requires SMTP authentication to use the incoming server settings
+           case 2 : // requires SMTP authentication to use the incoming server settings
             smtpServer->SetAuthMethod(authMethodIncoming);
             break;
           case 3 :
             smtpServer->SetAuthMethod(nsMsgAuthMethod::passwordCleartext);
             break;
           default:
             smtpServer->SetAuthMethod(nsMsgAuthMethod::none);
         }
 
-        smtpServer->SetHostname(nsDependentCString(pSmtpServer));
+        smtpServer->SetHostname(NS_ConvertUTF16toUTF8(smtpName));
 
         smtpServer->GetKey(getter_Copies(smtpServerKey));
         id->SetSmtpServerKey(smtpServerKey);
 
-        IMPORT_LOG1("Created new SMTP server: %s\n", pSmtpServer);
+        IMPORT_LOG1("Created new SMTP server: %S\n", smtpName);
       }
     }
   }
 }
copy from mailnews/import/oexpress/nsOESettings.h
copy to mailnews/import/winlivemail/nsWMSettings.h
--- a/mailnews/import/oexpress/nsOESettings.h
+++ b/mailnews/import/winlivemail/nsWMSettings.h
@@ -30,25 +30,25 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#ifndef nsOESettings_h___
-#define nsOESettings_h___
+#ifndef nsWMSettings_h___
+#define nsWMSettings_h___
 
 #include "nsIImportSettings.h"
 
-class nsOESettings : public nsIImportSettings {
+class nsWMSettings : public nsIImportSettings {
 public:
-  nsOESettings();
-  virtual ~nsOESettings();
+  nsWMSettings();
+  virtual ~nsWMSettings();
   static nsresult Create(nsIImportSettings** aImport);
   NS_DECL_ISUPPORTS
   NS_DECL_NSIIMPORTSETTINGS
 
 private:
 };
 
-#endif /* nsOESettings_h___ */
+#endif /* nsWMSettings_h___ */
copy from mailnews/import/oexpress/nsOEStringBundle.cpp
copy to mailnews/import/winlivemail/nsWMStringBundle.cpp
--- a/mailnews/import/oexpress/nsOEStringBundle.cpp
+++ b/mailnews/import/winlivemail/nsWMStringBundle.cpp
@@ -34,69 +34,69 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "prprf.h"
 #include "prmem.h"
 #include "nsCOMPtr.h"
 #include "nsReadableUtils.h"
 #include "nsIStringBundle.h"
-#include "nsOEStringBundle.h"
+#include "nsWMStringBundle.h"
 #include "nsIServiceManager.h"
 #include "nsIProxyObjectManager.h"
 #include "nsIURI.h"
 
-#define OE_MSGS_URL       "chrome://messenger/locale/oeImportMsgs.properties"
+#define WM_MSGS_URL       "chrome://messenger/locale/wmImportMsgs.properties"
 
-nsIStringBundle *  nsOEStringBundle::m_pBundle = nsnull;
+nsIStringBundle *  nsWMStringBundle::m_pBundle = nsnull;
 
-nsIStringBundle *nsOEStringBundle::GetStringBundle( void)
+nsIStringBundle *nsWMStringBundle::GetStringBundle( void)
 {
   if (m_pBundle)
     return( m_pBundle);
 
   nsresult      rv;
-  char*        propertyURL = OE_MSGS_URL;
+  char*        propertyURL = WM_MSGS_URL;
   nsIStringBundle*  sBundle = nsnull;
 
 
   nsCOMPtr<nsIStringBundleService> sBundleService =
            do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
   if (NS_SUCCEEDED(rv) && (nsnull != sBundleService)) {
     rv = sBundleService->CreateBundle(propertyURL, &sBundle);
   }
 
   m_pBundle = sBundle;
 
   return( sBundle);
 }
 
-nsIStringBundle *nsOEStringBundle::GetStringBundleProxy( void)
+nsIStringBundle *nsWMStringBundle::GetStringBundleProxy( void)
 {
   if (!m_pBundle)
     return( nsnull);
 
   nsIStringBundle *strProxy = nsnull;
   // create a proxy object if we aren't on the same thread?
   NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD, NS_GET_IID(nsIStringBundle),
                        m_pBundle, NS_PROXY_SYNC | NS_PROXY_ALWAYS,
                        (void **) &strProxy);
 
   return( strProxy);
 }
 
-void nsOEStringBundle::GetStringByID( PRInt32 stringID, nsString& result, nsIStringBundle *pBundle)
+void nsWMStringBundle::GetStringByID( PRInt32 stringID, nsString& result, nsIStringBundle *pBundle)
 {
 
   PRUnichar *ptrv = GetStringByID( stringID, pBundle);
   result = ptrv;
   FreeString( ptrv);
 }
 
-PRUnichar *nsOEStringBundle::GetStringByID(PRInt32 stringID, nsIStringBundle *pBundle)
+PRUnichar *nsWMStringBundle::GetStringByID(PRInt32 stringID, nsIStringBundle *pBundle)
 {
   if (!pBundle) {
     pBundle = GetStringBundle();
   }
 
   if (pBundle) {
     PRUnichar *ptrv = nsnull;
     nsresult rv = pBundle->GetStringFromID(stringID, &ptrv);
@@ -108,14 +108,14 @@ PRUnichar *nsOEStringBundle::GetStringBy
   nsString resultString;
   resultString.AppendLiteral("[StringID ");
   resultString.AppendInt(stringID);
   resultString.AppendLiteral("?]");
 
   return( ToNewUnicode(resultString));
 }
 
-void nsOEStringBundle::Cleanup( void)
+void nsWMStringBundle::Cleanup( void)
 {
   if (m_pBundle)
     m_pBundle->Release();
   m_pBundle = nsnull;
 }
copy from mailnews/import/oexpress/nsOEStringBundle.h
copy to mailnews/import/winlivemail/nsWMStringBundle.h
--- a/mailnews/import/oexpress/nsOEStringBundle.h
+++ b/mailnews/import/winlivemail/nsWMStringBundle.h
@@ -29,43 +29,43 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#ifndef _nsOEStringBundle_H__
-#define _nsOEStringBundle_H__
+#ifndef _nsWMStringBundle_H__
+#define _nsWMStringBundle_H__
 
 #include "nsString.h"
 
 class nsIStringBundle;
 
-class nsOEStringBundle {
+class nsWMStringBundle {
 public:
   static PRUnichar     *    GetStringByID(PRInt32 stringID, nsIStringBundle *pBundle = nsnull);
   static void          GetStringByID(PRInt32 stringID, nsString& result, nsIStringBundle *pBundle = nsnull);
   static nsIStringBundle *  GetStringBundle( void); // don't release
   static void          FreeString( PRUnichar *pStr) { NS_Free( pStr);}
   static void          Cleanup( void);
   static nsIStringBundle *  GetStringBundleProxy( void); // release
 
 private:
   static nsIStringBundle *  m_pBundle;
 };
 
 
 
-#define OEIMPORT_NAME                     2000
-#define OEIMPORT_DESCRIPTION              2011
-#define OEIMPORT_MAILBOX_SUCCESS          2002
-#define OEIMPORT_MAILBOX_BADPARAM         2003
-#define OEIMPORT_MAILBOX_BADSOURCEFILE    2004
-#define OEIMPORT_MAILBOX_CONVERTERROR     2005
-#define OEIMPORT_DEFAULT_NAME             2006
-#define OEIMPORT_AUTOFIND                 2007
-#define OEIMPORT_ADDRESS_SUCCESS          2008
-#define OEIMPORT_ADDRESS_CONVERTERROR     2009
-#define OEIMPORT_ADDRESS_BADPARAM         2010
+#define WMIMPORT_NAME                     2000
+#define WMIMPORT_DESCRIPTION              2001
+#define WMIMPORT_MAILBOX_SUCCESS          2002
+#define WMIMPORT_MAILBOX_BADPARAM         2003
+#define WMIMPORT_MAILBOX_BADSOURCEFILE    2004
+#define WMIMPORT_MAILBOX_CONVERTERROR     2005
+#define WMIMPORT_DEFAULT_NAME             2006
+#define WMIMPORT_AUTOFIND                 2007
+#define WMIMPORT_ADDRESS_SUCCESS          2008
+#define WMIMPORT_ADDRESS_CONVERTERROR     2009
+#define WMIMPORT_ADDRESS_BADPARAM         2010
 
-#endif /* _nsOEStringBundle_H__ */
+#endif /* _nsWMStringBundle_H__ */
--- a/mailnews/makefiles.sh
+++ b/mailnews/makefiles.sh
@@ -103,16 +103,17 @@ mailnews/import/comm4x/public/Makefile
 mailnews/import/comm4x/src/Makefile
 mailnews/import/eudora/src/Makefile
 mailnews/import/oexpress/Makefile
 mailnews/import/outlook/src/Makefile
 mailnews/import/public/Makefile
 mailnews/import/src/Makefile
 mailnews/import/test/Makefile
 mailnews/import/text/src/Makefile
+mailnews/import/winlivemail/Makefile
 mailnews/local/Makefile
 mailnews/local/build/Makefile
 mailnews/local/public/Makefile
 mailnews/local/src/Makefile
 mailnews/local/test/Makefile
 mailnews/mapi/mapiDll/Makefile
 mailnews/mapi/mapihook/Makefile
 mailnews/mapi/mapihook/build/Makefile
copy from suite/locales/en-US/chrome/mailnews/oeImportMsgs.properties
copy to suite/locales/en-US/chrome/mailnews/wmImportMsgs.properties
--- a/suite/locales/en-US/chrome/mailnews/oeImportMsgs.properties
+++ b/suite/locales/en-US/chrome/mailnews/wmImportMsgs.properties
@@ -16,94 +16,93 @@
 # The Initial Developer of the Original Code is
 # Netscape Communications Corporation.
 # Portions created by the Initial Developer are Copyright (C) 1998
 # the Initial Developer. All Rights Reserved.
 #
 # Contributor(s):
 #
 # Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 # in which case the provisions of the GPL or the LGPL are applicable instead
 # of those above. If you wish to allow use of your version of this file only
 # under the terms of either the GPL or the LGPL, and not to allow others to
 # use your version of this file under the terms of the MPL, indicate your
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 #
-# The following are used by the outlook express import code to display status/error 
+# The following are used by the windows live mail import code to display status/error
 # and informational messages
 #
 
 # Short name of import module
-## @name OEIMPORT_NAME
+## @name WMIMPORT_NAME
 ## @loc None
 ## LOCALIZATION NOTE (2000): DONT_TRANSLATE
-2000=Outlook Express
+2000=Windows Live Mail
 
 # Description of import module
-## @name OEIMPORT_DESCRIPTION
+## @name WMIMPORT_DESCRIPTION
 ## @loc None
-## LOCALIZATION NOTE (2011): In this item, don't translate "Outlook Express"
-2011=Outlook Express mail, address books, and settings
+## LOCALIZATION NOTE (2001): In this item, don't translate "Windows Live Mail"
+2001=Windows Live Mail settings
 
 # Success message
-## @name OEIMPORT_MAILBOX_SUCCESS
+## @name WMIMPORT_MAILBOX_SUCCESS
 ## @loc None
-## LOCALIZATION NOTE (2002): In this item, don't translate "%S" or "%d"
-## The variable %S will contain the name of the Mailbox
-## The variable %d will contain the number of messages
-
-2002=Mailbox %S, imported %d messages
+## LOCALIZATION NOTE (2002): In this item, don't translate "%1$S" or "%2$d"
+## The variable %1$S will contain the name of the Mailbox
+## The variable %2$d will contain the number of messages
+2002=Mailbox %1$S, imported %2$d messages
 
 # Error message
-## @name OEIMPORT_MAILBOX_BADPARAM
+## @name WMIMPORT_MAILBOX_BADPARAM
 ## @loc None
 2003=Bad parameter passed to import mailbox.
 
 # Error message
-## @name OEIMPORT_MAILBOX_BADSOURCEFILE
+## @name WMIMPORT_MAILBOX_BADSOURCEFILE
 ## @loc None
 ## LOCALIZATION NOTE (2004): In this item, don't translate "%S"
 ## The variable %S will contain the name of the Mailbox
 2004=Error accessing file for mailbox %S.
 
 # Error message
-## @name OEIMPORT_MAILBOX_CONVERTERROR
+## @name WMIMPORT_MAILBOX_CONVERTERROR
 ## @loc None
 ## LOCALIZATION NOTE (2005): In this item, don't translate "%S"
 ## The variable %S will contain the name of the Mailbox
 2005=Error importing mailbox %S, all messages may not be imported from this mailbox.
 
 # Default name of imported addressbook
-## @name OEIMPORT_DEFAULT_NAME
+## @name WMIMPORT_DEFAULT_NAME
 ## @loc None
-2006=Outlook Express Address Book
+2006=Windows Live Mail Address Book
 
 # Autofind description
-## @name OEIMPORT_AUTOFIND
+## @name WMIMPORT_AUTOFIND
 ## @loc None
-2007=Outlook Express address book (windows address book)
+2007=Windows Live Mail address book (windows address book)
 
 # Description
-## @name OEIMPORT_ADDRESS_SUCCESS
+## @name WMIMPORT_ADDRESS_SUCCESS
 ## @loc None
 ## LOCALIZATION NOTE (2006): In this item, don't translate "%S"
 ## The variable %S will receive the name of the address book
 2008=Imported address book %S
 
 # Error message
-## @name OEIMPORT_ADDRESS_CONVERTERROR
+## @name WMIMPORT_ADDRESS_CONVERTERROR
 ## @loc None
 ## LOCALIZATION NOTE (2009): In this item, don't translate "%S"
 ## The variable %S will receive the name of the address book
 2009=Error importing address book %S, all addresses may not have been imported.
 
 # Error message
-## @name OEIMPORT_ADDRESS_BADPARAM
+## @name WMIMPORT_ADDRESS_BADPARAM
 ## @loc None
 2010=Bad parameter passed to import addressbook.
--- a/suite/locales/jar.mn
+++ b/suite/locales/jar.mn
@@ -297,16 +297,17 @@
   locale/@AB_CD@/messenger/subscribe.dtd                                    (%chrome/mailnews/subscribe.dtd)
   locale/@AB_CD@/messenger/subscribe.properties                             (%chrome/mailnews/subscribe.properties)
   locale/@AB_CD@/messenger/textImportMsgs.properties                        (%chrome/mailnews/textImportMsgs.properties)
   locale/@AB_CD@/messenger/threadpane.dtd                                   (%chrome/mailnews/threadpane.dtd)
   locale/@AB_CD@/messenger/vcard.properties                                 (%chrome/mailnews/vcard.properties)
   locale/@AB_CD@/messenger/viewLog.dtd                                      (%chrome/mailnews/viewLog.dtd)
   locale/@AB_CD@/messenger/virtualFolderProperties.dtd                      (%chrome/mailnews/virtualFolderProperties.dtd)
   locale/@AB_CD@/messenger/virtualFolderListDialog.dtd                      (%chrome/mailnews/virtualFolderListDialog.dtd)
+  locale/@AB_CD@/messenger/wmImportMsgs.properties                          (%chrome/mailnews/wmImportMsgs.properties)
   locale/@AB_CD@/messenger-mapi/mapi.properties                             (%chrome/mailnews/mapi/mapi.properties)
   locale/@AB_CD@/messenger-region/region.properties                         (%chrome/mailnews/region.properties)
 #ifdef MOZ_PSM
   locale/@AB_CD@/messenger/am-smime.dtd                                     (%chrome/mailnews/smime/am-smime.dtd)
   locale/@AB_CD@/messenger/am-smime.properties                              (%chrome/mailnews/smime/am-smime.properties)
   locale/@AB_CD@/messenger-smime/certFetchingStatus.dtd                     (%chrome/mailnews/smime/certFetchingStatus.dtd)
   locale/@AB_CD@/messenger-smime/msgCompSecurityInfo.dtd                    (%chrome/mailnews/smime/msgCompSecurityInfo.dtd)
   locale/@AB_CD@/messenger-smime/msgCompSecurityInfo.properties             (%chrome/mailnews/smime/msgCompSecurityInfo.properties)