зеркало из https://github.com/mozilla/pjs.git
Fix for bug # 78585. Import local folders from 4.x.
r=racham@netscape.com,ccarlen@netscape.com,cavin@netscape.com, ducarroz@netscape.com sr=sspitzer@netscape.com, a=asa@mozilla.org
This commit is contained in:
Родитель
94572dd179
Коммит
a65e726634
|
@ -1401,6 +1401,7 @@ sub BuildIDLProjects()
|
|||
BuildIDLProject(":mozilla:mailnews:imap:macbuild:msgimapIDL.xml", "MsgImap");
|
||||
BuildIDLProject(":mozilla:mailnews:mime:macbuild:mimeIDL.xml", "Mime");
|
||||
BuildIDLProject(":mozilla:mailnews:import:macbuild:msgImportIDL.xml", "msgImport");
|
||||
BuildIDLProject(":mozilla:mailnews:import:comm4x:macbuild:msgImportComm4xMIDL.xml", "msgImportComm4xM");
|
||||
if ($main::options{smime} && $main::options{psm}) {
|
||||
BuildIDLProject(":mozilla:mailnews:extensions:smime:macbuild:msgsmimeIDL.xml", "msgsmime");
|
||||
}
|
||||
|
@ -2300,6 +2301,7 @@ sub BuildMailNewsProjects()
|
|||
BuildOneProject(":mozilla:mailnews:import:macbuild:msgImport.xml", "msgImport$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
|
||||
BuildOneProject(":mozilla:mailnews:import:text:macbuild:msgImportText.xml", "msgImportText$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
|
||||
BuildOneProject(":mozilla:mailnews:import:eudora:macbuild:msgImportEudora.xml", "msgImportEudora$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
|
||||
BuildOneProject(":mozilla:mailnews:import:comm4x:macbuild:msgImportComm4xM.xml", "msgImportComm4xM$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
|
||||
|
||||
|
||||
if ($main::options{static_build}) {
|
||||
|
|
|
@ -26,7 +26,7 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src text
|
||||
DIRS = public src text comm4x
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
DIRS += eudora
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
DEPTH=..\..
|
||||
|
||||
LocalDirs=public src resources eudora text
|
||||
LocalDirs=public src resources eudora text comm4x
|
||||
|
||||
MODULE=import
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2002
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Srilatha Moturi <srilatha@netscape.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# 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 *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS =public src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,51 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2002
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Srilatha Moturi <srilatha@netscape.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# 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 *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = impComm4xMail
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIComm4xProfile.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
|
@ -0,0 +1,63 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* 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 ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsILocalFile.idl"
|
||||
|
||||
/**
|
||||
* This interface provides support for getting 4.x profile information
|
||||
* This interface can be used to get the existing 4.x profiles
|
||||
* and for getting the mail directory for the profile.
|
||||
*
|
||||
*/
|
||||
[scriptable, uuid(c66c1060-2bdc-11d6-92a0-0010a4b26cda)]
|
||||
interface nsIComm4xProfile: nsISupports {
|
||||
/**
|
||||
* Parses the 4.x registry file and returns a list of profiles.
|
||||
*/
|
||||
|
||||
void getProfileList(out unsigned long length, [array, size_is(length), retval] out wstring selectList);
|
||||
|
||||
/**
|
||||
* Searches the preferences file of the given profile for the pref mail.directory
|
||||
* If the pref does not exist it, returns the default value.
|
||||
* @param profileName name of the profile in the profiles array
|
||||
* @return The path to the mail directory for the profile with the name profileName
|
||||
*
|
||||
*/
|
||||
string getMailDir(in wstring profileName);
|
||||
};
|
|
@ -0,0 +1,69 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2002
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Srilatha Moturi <srilatha@netscape.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# 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 *****
|
||||
|
||||
# Short name of import module
|
||||
# LOCALIZATION NOTE : "Communicator 4.x" below is the used for previous versions of Netscape Communicator
|
||||
# Please translate using the brandname in respective languages for Netscape Communicator 4 releases.
|
||||
## @name COMM4XMAILIMPORT_NAME
|
||||
## @loc None
|
||||
2000=Communicator 4.x
|
||||
|
||||
# Description of import module
|
||||
# LOCALIZATION NOTE : "Communicator 4.x" below is the used for previous versions of Netscape Communicator
|
||||
# Please translate using the brandname in respective languages for Netscape Communicator 4 releases.
|
||||
## @name COMM4XMAILIMPORT_DESCRIPTION
|
||||
## @loc None
|
||||
2001=Import Local Mail from Communicator 4.x.
|
||||
|
||||
# Success Message
|
||||
# LOCALIZATION NOTE : Do not translate the word "%S" below.
|
||||
## @name COMM4XMAILIMPORT_MAILBOX_SUCCESS
|
||||
## @loc None
|
||||
2002=Local messages were successfully imported from %S
|
||||
|
||||
# Error Message
|
||||
## @name COMM4XMAILIMPORT_MAILBOX_BADPARAM
|
||||
## @loc None
|
||||
2003=An internal error occurred. Importing failed. Try importing again.
|
||||
|
||||
# Error message
|
||||
# LOCALIZATION NOTE : Do not translate the word "%S" below.
|
||||
## @name COMM4XMAILIMPORT_MAILBOX_CONVERTERROR
|
||||
## @loc None
|
||||
2004=An error occurred while importing messages from %S. Messages were not imported. Make more disk space available and try again.
|
||||
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef Comm4xMailDebugLog_h___
|
||||
#define Comm4xMailDebugLog_h___
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
#define IMPORT_DEBUG 1
|
||||
#endif
|
||||
|
||||
#ifdef IMPORT_DEBUG
|
||||
#include "stdio.h"
|
||||
|
||||
#define IMPORT_LOG0(x) printf(x)
|
||||
#define IMPORT_LOG1(x, y) printf(x, y)
|
||||
#define IMPORT_LOG2(x, y, z) printf(x, y, z)
|
||||
#define IMPORT_LOG3(a, b, c, d) printf(a, b, c, d)
|
||||
|
||||
#else
|
||||
|
||||
#define IMPORT_LOG0(x)
|
||||
#define IMPORT_LOG1(x, y)
|
||||
#define IMPORT_LOG2(x, y, z)
|
||||
#define IMPORT_LOG3(a, b, c, d)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif /* Comm4xMailDebugLog_h___ */
|
|
@ -0,0 +1,84 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2002
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Srilatha Moturi <srilatha@netscape.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# 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 *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = impComm4xMail
|
||||
LIBRARY_NAME = impComm4xMail
|
||||
IS_COMPONENT = 1
|
||||
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
intl \
|
||||
import \
|
||||
necko \
|
||||
msgbase \
|
||||
mailnews \
|
||||
msgbaseutil \
|
||||
profile \
|
||||
prefmigr \
|
||||
unicharutil \
|
||||
uconv \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = nsComm4xMailFactory.cpp \
|
||||
nsComm4xMailImport.cpp \
|
||||
nsComm4xMail.cpp \
|
||||
nsComm4xProfile.cpp \
|
||||
$(NULL)
|
||||
|
||||
|
||||
ifeq ($(USE_SHORT_LIBNAME),1)
|
||||
EXTRA_DSO_LIBS += msgbsutl
|
||||
else
|
||||
EXTRA_DSO_LIBS += msgbaseutil
|
||||
endif
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(LIBS_DIR) \
|
||||
$(EXTRA_DSO_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2002
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Srilatha Moturi <srilatha@netscape.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# 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 *****
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
MODULE=impComm4xMail
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
import \
|
||||
intl \
|
||||
necko \
|
||||
msgbase \
|
||||
mailnews \
|
||||
msgbaseutil \
|
||||
profile \
|
||||
prefmigr \
|
||||
unicharutil \
|
||||
uconv \
|
||||
$(NULL)
|
||||
LIBRARY_NAME = $(MODULE)
|
||||
META_COMPONENT = mail
|
||||
MODULE_NAME = nsComm4xMailImport
|
||||
|
||||
CPP_OBJS=\
|
||||
.\$(OBJDIR)\nsComm4xMailFactory.obj \
|
||||
.\$(OBJDIR)\nsComm4xMailImport.obj \
|
||||
.\$(OBJDIR)\nsComm4xMail.obj \
|
||||
.\$(OBJDIR)\nsComm4xProfile.obj \
|
||||
$(NULL)
|
||||
|
||||
LLIBS=\
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\msgbsutl.lib \
|
||||
$(LIBNSPR) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) $(DLL) $(DIST)\bin\components
|
|
@ -0,0 +1,241 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* 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 ***** */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsMsgI18N.h"
|
||||
#include "nsComm4xMail.h"
|
||||
#include "nsIImportService.h"
|
||||
#include "nsIImportMailboxDescriptor.h"
|
||||
#include "nsComm4xMailStringBundle.h"
|
||||
#include "nsComm4xMailImport.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "Comm4xMailDebugLog.h"
|
||||
#include "prmem.h"
|
||||
|
||||
#define kCopyBufferSize 8192
|
||||
#define kMailReadBufferSize 16384
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
static PRBool
|
||||
nsStringEndsWith(nsString& name, const char *ending)
|
||||
{
|
||||
if (!ending) return PR_FALSE;
|
||||
|
||||
PRInt32 len = name.Length();
|
||||
if (len == 0) return PR_FALSE;
|
||||
|
||||
PRInt32 endingLen = strlen(ending);
|
||||
if (len > endingLen && name.RFind(ending, PR_TRUE) == len - endingLen) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
else {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static PRBool
|
||||
nsShouldIgnoreFile(nsString& name)
|
||||
{
|
||||
PRUnichar firstChar=name.CharAt(0);
|
||||
if (firstChar == '.' || firstChar == '#' || name.CharAt(name.Length() - 1) == '~')
|
||||
return PR_TRUE;
|
||||
|
||||
if (name.EqualsIgnoreCase("rules.dat") || name.EqualsIgnoreCase("rulesbackup.dat"))
|
||||
return PR_TRUE;
|
||||
|
||||
|
||||
// don't add summary files to the list of folders;
|
||||
// don't add popstate files to the list either, or rules (sort.dat).
|
||||
if (nsStringEndsWith(name, ".snm") ||
|
||||
name.EqualsIgnoreCase("popstate.dat") ||
|
||||
name.EqualsIgnoreCase("sort.dat") ||
|
||||
name.EqualsIgnoreCase("mailfilt.log") ||
|
||||
name.EqualsIgnoreCase("filters.js") ||
|
||||
nsStringEndsWith(name, ".toc")||
|
||||
nsStringEndsWith(name,".sbd"))
|
||||
return PR_TRUE;
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsComm4xMail::nsComm4xMail()
|
||||
{
|
||||
}
|
||||
|
||||
nsComm4xMail::~nsComm4xMail()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsComm4xMail::FindMailboxes(nsIFileSpec *pRoot, nsISupportsArray **ppArray)
|
||||
{
|
||||
nsresult rv = NS_NewISupportsArray(ppArray);
|
||||
if (NS_FAILED(rv)) {
|
||||
IMPORT_LOG0("FAILED to allocate the nsISupportsArray\n");
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIImportService> impSvc(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
m_depth = 0;
|
||||
|
||||
return (ScanMailDir(pRoot, *ppArray, impSvc));
|
||||
}
|
||||
|
||||
|
||||
nsresult nsComm4xMail::ScanMailDir(nsIFileSpec *pFolder, nsISupportsArray *pArray, nsIImportService *pImport)
|
||||
{
|
||||
|
||||
nsCOMPtr<nsIFileSpec> descMap;
|
||||
nsresult rv;
|
||||
|
||||
if (NS_FAILED(rv = NS_NewFileSpec(getter_AddRefs(descMap))))
|
||||
return rv;
|
||||
|
||||
m_depth++;
|
||||
|
||||
descMap->FromFileSpec(pFolder);
|
||||
rv = IterateMailDir(pFolder, pArray, pImport);
|
||||
|
||||
m_depth--;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsComm4xMail::IterateMailDir(nsIFileSpec *pFolder, nsISupportsArray *pArray, nsIImportService *pImport)
|
||||
{
|
||||
nsCOMPtr<nsIDirectoryIterator> dir;
|
||||
nsresult rv = NS_NewDirectoryIterator(getter_AddRefs(dir));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
PRBool exists = PR_FALSE;
|
||||
rv = dir->Init(pFolder, PR_TRUE);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = dir->Exists(&exists);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
PRBool isFile;
|
||||
nsCOMPtr<nsIFileSpec> entry;
|
||||
nsXPIDLCString pName;
|
||||
nsXPIDLCString dirName;
|
||||
nsAutoString currentFolderNameStr;
|
||||
PRBool isDirectory;
|
||||
nsAutoString ext;
|
||||
|
||||
while (exists && NS_SUCCEEDED(rv)) {
|
||||
rv = dir->GetCurrentSpec(getter_AddRefs(entry));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = entry->GetLeafName(getter_Copies(pName));
|
||||
nsMsgGetNativePathString(pName.get(), currentFolderNameStr);
|
||||
isFile = PR_FALSE;
|
||||
entry->IsFile(&isFile);
|
||||
if (isFile) {
|
||||
if (!nsShouldIgnoreFile(currentFolderNameStr)) {
|
||||
rv = FoundMailbox(entry, ¤tFolderNameStr, pArray, pImport);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
entry->GetNativePath(getter_Copies(dirName));
|
||||
dirName.Append(".sbd");
|
||||
rv = entry->SetNativePath(dirName.get());
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
exists = PR_FALSE;
|
||||
entry->Exists(&exists);
|
||||
isDirectory = PR_FALSE;
|
||||
entry->IsDirectory(&isDirectory);
|
||||
if (exists && isDirectory) {
|
||||
rv = ScanMailDir (entry, pArray, pImport);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
rv = dir->Next();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = dir->Exists(&exists);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsComm4xMail::FoundMailbox(nsIFileSpec *mailFile, nsAutoString *pName, nsISupportsArray *pArray, nsIImportService *pImport)
|
||||
{
|
||||
nsCOMPtr<nsIImportMailboxDescriptor> desc;
|
||||
|
||||
#ifdef IMPORT_DEBUG
|
||||
char *pPath = nsnull;
|
||||
mailFile->GetNativePath(&pPath);
|
||||
if (pPath) {
|
||||
IMPORT_LOG2("Found comm4x mailbox, %s: %s\n", pPath, pName->get());
|
||||
nsCRT::free(pPath);
|
||||
}
|
||||
else {
|
||||
IMPORT_LOG1("Found comm4x mailbox, %s\n", pName->get());
|
||||
}
|
||||
IMPORT_LOG1("\tm_depth = %d\n", (int)m_depth);
|
||||
#endif
|
||||
|
||||
nsresult rv = pImport->CreateNewMailboxDescriptor(getter_AddRefs(desc));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 sz = 0;
|
||||
mailFile->GetFileSize(&sz);
|
||||
desc->SetDisplayName(pName->get());
|
||||
desc->SetDepth(m_depth);
|
||||
desc->SetSize(sz);
|
||||
nsCOMPtr <nsIFileSpec> pSpec;
|
||||
desc->GetFileSpec(getter_AddRefs(pSpec));
|
||||
if (pSpec) {
|
||||
pSpec->FromFileSpec(mailFile);
|
||||
}
|
||||
nsCOMPtr <nsISupports> pInterface = do_QueryInterface(desc);
|
||||
if (pInterface)
|
||||
pArray->AppendElement(pInterface);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* 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 ***** */
|
||||
#ifndef nsComm4xMail_h__
|
||||
#define nsComm4xMail_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
||||
class nsIImportService;
|
||||
class nsIMsgAccountManager;
|
||||
class nsIMsgAccount;
|
||||
|
||||
|
||||
class nsComm4xMail {
|
||||
public:
|
||||
nsComm4xMail();
|
||||
virtual ~nsComm4xMail();
|
||||
|
||||
// get the list of mailboxes
|
||||
virtual nsresult FindMailboxes(nsIFileSpec *pRoot, nsISupportsArray **ppArray);
|
||||
|
||||
private:
|
||||
nsresult ScanMailDir(nsIFileSpec *pFolder, nsISupportsArray *pArray, nsIImportService *pImport);
|
||||
nsresult IterateMailDir(nsIFileSpec *pFolder, nsISupportsArray *pArray, nsIImportService *pImport);
|
||||
nsresult FoundMailbox(nsIFileSpec *mailFile, nsAutoString *pName, nsISupportsArray *pArray, nsIImportService *pImport);
|
||||
|
||||
private:
|
||||
PRUint32 m_depth;
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsComm4xMail_h__ */
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* 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 ***** */
|
||||
|
||||
/*
|
||||
Comm4xMail import module
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIModule.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIImportService.h"
|
||||
#include "nsComm4xMailImport.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsComm4xMailStringBundle.h"
|
||||
#include "Comm4xMailDebugLog.h"
|
||||
#include "nsComm4xProfile.h"
|
||||
|
||||
static NS_DEFINE_CID(kComm4xMailImportCID, NS_COMM4XMAILIMPORT_CID);
|
||||
|
||||
|
||||
|
||||
NS_METHOD Comm4xMailRegister(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)) {
|
||||
nsXPIDLCString replace;
|
||||
char *theCID = kComm4xMailImportCID.ToString();
|
||||
rv = catMan->AddCategoryEntry("mailnewsimport", theCID, kComm4xMailSupportsString, PR_TRUE, PR_TRUE, getter_Copies(replace));
|
||||
nsCRT::free(theCID);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
IMPORT_LOG0("*** ERROR: Problem registering Comm4xMail Import component in the category manager\n");
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsComm4xMailImport)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ImportComm4xMailImpl, Initialize)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsComm4xProfile)
|
||||
|
||||
static nsModuleComponentInfo components[] = {
|
||||
{ "Comm4xMail Import Component",
|
||||
NS_COMM4XMAILIMPORT_CID,
|
||||
"@mozilla.org/import/import-comm4xMail;1",
|
||||
nsComm4xMailImportConstructor,
|
||||
Comm4xMailRegister,
|
||||
nsnull
|
||||
},
|
||||
{
|
||||
"Comm4xMail Import Mail Implementation",
|
||||
NS_COMM4XMAILIMPL_CID,
|
||||
NS_COMM4XMAILIMPL_CONTRACTID,
|
||||
ImportComm4xMailImplConstructor
|
||||
},
|
||||
{ NS_ICOMM4XPROFILE_CLASSNAME,
|
||||
NS_ICOMM4XPROFILE_CID,
|
||||
NS_ICOMM4XPROFILE_CONTRACTID,
|
||||
nsComm4xProfileConstructor
|
||||
}
|
||||
};
|
||||
|
||||
PR_STATIC_CALLBACK(void)
|
||||
comm4xMailModuleDtor(nsIModule* self)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_NSGETMODULE_WITH_DTOR(nsComm4xMailImportModule, components, comm4xMailModuleDtor)
|
||||
|
||||
|
|
@ -0,0 +1,357 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* 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 ***** */
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Comm4xMail import mail interface
|
||||
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIImportService.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsComm4xMailImport.h"
|
||||
#include "nsIMemory.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIImportService.h"
|
||||
#include "nsIImportMailboxDescriptor.h"
|
||||
#include "nsIImportGeneric.h"
|
||||
#include "nsIImportFieldMap.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsTextFormatter.h"
|
||||
#include "nsComm4xMailStringBundle.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "Comm4xMailDebugLog.h"
|
||||
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
|
||||
#include "nsIProxyObjectManager.h"
|
||||
#include "nsProxiedService.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
#define COMM4XMAIL_MSGS_URL "chrome://messenger/locale/comm4xMailImportMsgs.properties"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
nsComm4xMailImport::nsComm4xMailImport()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
IMPORT_LOG0("nsComm4xMailImport Module Created\n");
|
||||
|
||||
nsCOMPtr <nsIStringBundleService> pBundleService;
|
||||
nsresult rv;
|
||||
|
||||
m_pBundle = nsnull;
|
||||
|
||||
pBundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && (pBundleService))
|
||||
pBundleService->CreateBundle(COMM4XMAIL_MSGS_URL, getter_AddRefs(m_pBundle));
|
||||
}
|
||||
|
||||
|
||||
nsComm4xMailImport::~nsComm4xMailImport()
|
||||
{
|
||||
|
||||
IMPORT_LOG0("nsComm4xMailImport Module Deleted\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsComm4xMailImport, nsIImportModule)
|
||||
|
||||
|
||||
NS_IMETHODIMP nsComm4xMailImport::GetName(PRUnichar **name)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER (name);
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
if (m_pBundle)
|
||||
rv = m_pBundle->GetStringFromID(COMM4XMAILIMPORT_NAME, name);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsComm4xMailImport::GetDescription(PRUnichar **name)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER (name);
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
if (m_pBundle)
|
||||
rv = m_pBundle->GetStringFromID(COMM4XMAILIMPORT_DESCRIPTION, name);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsComm4xMailImport::GetSupports(char **supports)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER (supports);
|
||||
*supports = nsCRT::strdup(kComm4xMailSupportsString);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsComm4xMailImport::GetSupportsUpgrade(PRBool *pUpgrade)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER (pUpgrade);
|
||||
*pUpgrade = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsComm4xMailImport::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!
|
||||
nsCOMPtr <nsIImportMail> pMail = do_CreateInstance(NS_COMM4XMAILIMPL_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr <nsIImportGeneric> pGeneric;
|
||||
nsCOMPtr<nsIImportService> impSvc(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = impSvc->CreateNewGenericMail(getter_AddRefs(pGeneric));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
pGeneric->SetData("mailInterface", pMail);
|
||||
nsXPIDLString name;
|
||||
rv = m_pBundle->GetStringFromID( COMM4XMAILIMPORT_NAME, getter_Copies(name));
|
||||
|
||||
nsCOMPtr<nsISupportsWString> nameString (do_CreateInstance(NS_SUPPORTS_WSTRING_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
nameString->SetData(name.get());
|
||||
pGeneric->SetData("name", nameString);
|
||||
rv = pGeneric->QueryInterface(kISupportsIID, (void **)ppInterface);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ImportComm4xMailImpl::ImportComm4xMailImpl()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
m_pBundleProxy = nsnull;
|
||||
}
|
||||
|
||||
nsresult ImportComm4xMailImpl::Initialize()
|
||||
{
|
||||
nsCOMPtr <nsIStringBundleService> pBundleService;
|
||||
nsresult rv;
|
||||
nsCOMPtr <nsIStringBundle> pBundle;
|
||||
|
||||
pBundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && (pBundleService))
|
||||
pBundleService->CreateBundle(COMM4XMAIL_MSGS_URL, getter_AddRefs(pBundle));
|
||||
|
||||
nsCOMPtr<nsIProxyObjectManager> proxyMgr(do_GetService(NS_XPCOMPROXY_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIStringBundle),
|
||||
pBundle, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs(m_pBundleProxy));
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
ImportComm4xMailImpl::~ImportComm4xMailImpl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(ImportComm4xMailImpl, nsIImportMail)
|
||||
|
||||
NS_IMETHODIMP ImportComm4xMailImpl::GetDefaultLocation(nsIFileSpec **ppLoc, PRBool *found, PRBool *userVerify)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(found);
|
||||
NS_ENSURE_ARG_POINTER(ppLoc);
|
||||
NS_ENSURE_ARG_POINTER(userVerify);
|
||||
|
||||
*ppLoc = nsnull;
|
||||
*found = PR_FALSE;
|
||||
*userVerify = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP ImportComm4xMailImpl::FindMailboxes(nsIFileSpec *pLoc, nsISupportsArray **ppArray)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(pLoc);
|
||||
NS_ENSURE_ARG_POINTER(ppArray);
|
||||
|
||||
PRBool exists = PR_FALSE;
|
||||
nsresult rv = pLoc->Exists(&exists);
|
||||
if (NS_FAILED(rv) || !exists)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// find mail boxes
|
||||
rv = m_mail.FindMailboxes(pLoc, ppArray);
|
||||
|
||||
if (NS_FAILED(rv) && *ppArray) {
|
||||
NS_RELEASE(*ppArray);
|
||||
*ppArray = nsnull;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
void ImportComm4xMailImpl::ReportStatus( PRInt32 errorNum, nsString& name, nsString *pStream)
|
||||
{
|
||||
if (!pStream) return;
|
||||
nsXPIDLString statusStr;
|
||||
const PRUnichar * fmtStr = name.get();
|
||||
nsresult rv = m_pBundleProxy->FormatStringFromID(errorNum, &fmtStr, 1, getter_Copies(statusStr));
|
||||
if (NS_SUCCEEDED (rv)) {
|
||||
pStream->Append (statusStr.get());
|
||||
pStream->Append( PRUnichar(nsCRT::LF));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ImportComm4xMailImpl::SetLogs(nsString& success, nsString& error, PRUnichar **pError, PRUnichar **pSuccess)
|
||||
{
|
||||
if (pError)
|
||||
*pError = ToNewUnicode(error);
|
||||
if (pSuccess)
|
||||
*pSuccess = ToNewUnicode(success);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ImportComm4xMailImpl::ImportMailbox(nsIImportMailboxDescriptor *pSource,
|
||||
nsIFileSpec *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");
|
||||
|
||||
nsString success;
|
||||
nsString error;
|
||||
if (!pSource || !pDestination || !fatalError) {
|
||||
nsXPIDLString errorString;
|
||||
m_pBundleProxy->GetStringFromID(COMM4XMAILIMPORT_MAILBOX_BADPARAM, getter_Copies(errorString));
|
||||
error = errorString;
|
||||
if (fatalError)
|
||||
*fatalError = PR_TRUE;
|
||||
SetLogs(success, error, pErrorLog, pSuccessLog);
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
nsString name;
|
||||
PRUnichar * pName;
|
||||
if (NS_SUCCEEDED(pSource->GetDisplayName(&pName))) {
|
||||
name.Adopt(pName);
|
||||
}
|
||||
|
||||
PRUint32 mailSize = 0;
|
||||
pSource->GetSize(&mailSize);
|
||||
if (mailSize == 0) {
|
||||
ReportStatus(COMM4XMAILIMPORT_MAILBOX_SUCCESS, name, &success);
|
||||
SetLogs(success, error, pErrorLog, pSuccessLog);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint32 index = 0;
|
||||
pSource->GetIdentifier(&index);
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
m_bytesDone = 0;
|
||||
|
||||
// copy files from 4.x to here.
|
||||
nsCOMPtr <nsIFileSpec> inFile;
|
||||
if (NS_FAILED(pSource->GetFileSpec(getter_AddRefs(inFile)))) {
|
||||
ReportStatus(COMM4XMAILIMPORT_MAILBOX_CONVERTERROR, name, &error);
|
||||
SetLogs(success, error, pErrorLog, pSuccessLog);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef IMPORT_DEBUG
|
||||
char *pPath;
|
||||
inFile->GetNativePath(&pPath);
|
||||
IMPORT_LOG1("Import mailbox: %s\n", pPath);
|
||||
nsCRT::free(pPath);
|
||||
#endif
|
||||
|
||||
nsCOMPtr <nsIFileSpec> parent;
|
||||
if (NS_FAILED (pDestination->GetParent(getter_AddRefs(parent))))
|
||||
{
|
||||
ReportStatus( COMM4XMAILIMPORT_MAILBOX_CONVERTERROR, name, &error);
|
||||
SetLogs( success, error, pErrorLog, pSuccessLog);
|
||||
return( NS_ERROR_FAILURE);
|
||||
}
|
||||
PRBool exists = PR_FALSE;
|
||||
pDestination->Exists(&exists);
|
||||
if (exists)
|
||||
rv = pDestination->Delete(PR_FALSE);
|
||||
rv = inFile->CopyToDir(parent);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
m_bytesDone = mailSize;
|
||||
ReportStatus(COMM4XMAILIMPORT_MAILBOX_SUCCESS, name, &success);
|
||||
}
|
||||
else {
|
||||
ReportStatus(COMM4XMAILIMPORT_MAILBOX_CONVERTERROR, name, &error);
|
||||
}
|
||||
|
||||
SetLogs(success, error, pErrorLog, pSuccessLog);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP ImportComm4xMailImpl::GetImportProgress(PRUint32 *pDoneSoFar)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(pDoneSoFar);
|
||||
|
||||
*pDoneSoFar = m_bytesDone;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef nsComm4xMailImport_h___
|
||||
#define nsComm4xMailImport_h___
|
||||
|
||||
#include "nsIImportModule.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIImportMail.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsComm4xMail.h"
|
||||
|
||||
//{7792e9e0-412a-11d6-92bf-0010a4b26cda}
|
||||
#define NS_COMM4XMAILIMPL_CID \
|
||||
{ 0x7792e9e0, 0x412a, 0x11d6, { 0x92, 0xbf, 0x0, 0x10, 0xa4, 0xb2, 0x6c, 0xda } }
|
||||
#define NS_COMM4XMAILIMPL_CONTRACTID "@mozilla.org/import/import-comm4xMailImpl;1"
|
||||
// {647cc990-2bdb-11d6-92a0-0010a4b26cda}
|
||||
#define NS_COMM4XMAILIMPORT_CID \
|
||||
{ 0x647ff990, 0x2bdb, 0x11d6, { 0x92, 0xa0, 0x0, 0x10, 0xa4, 0xb2, 0x6c, 0xda } }
|
||||
|
||||
#define kComm4xMailSupportsString NS_IMPORT_MAIL_STR
|
||||
|
||||
class nsComm4xMailImport : public nsIImportModule
|
||||
{
|
||||
public:
|
||||
|
||||
nsComm4xMailImport();
|
||||
virtual ~nsComm4xMailImport();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// we suppport the nsIImportModule interface
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_DECL_NSIIMPORTMODULE
|
||||
|
||||
protected:
|
||||
nsCOMPtr <nsIStringBundle> m_pBundle;
|
||||
};
|
||||
|
||||
class ImportComm4xMailImpl : public nsIImportMail
|
||||
{
|
||||
public:
|
||||
ImportComm4xMailImpl();
|
||||
virtual ~ImportComm4xMailImpl();
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIImportMail interface
|
||||
|
||||
/* void GetDefaultLocation (out nsIFileSpec location, out boolean found, out boolean userVerify); */
|
||||
NS_IMETHOD GetDefaultLocation(nsIFileSpec **location, PRBool *found, PRBool *userVerify);
|
||||
|
||||
/* nsISupportsArray FindMailboxes (in nsIFileSpec location); */
|
||||
NS_IMETHOD FindMailboxes(nsIFileSpec *location, nsISupportsArray **_retval);
|
||||
|
||||
/* void ImportMailbox (in nsIImportMailboxDescriptor source, in nsIFileSpec destination, out boolean fatalError); */
|
||||
NS_IMETHOD ImportMailbox(nsIImportMailboxDescriptor *source, nsIFileSpec *destination,
|
||||
PRUnichar **pErrorLog, PRUnichar **pSuccessLog, PRBool *fatalError);
|
||||
|
||||
/* unsigned long GetImportProgress (); */
|
||||
NS_IMETHOD GetImportProgress(PRUint32 *_retval);
|
||||
|
||||
public:
|
||||
static void SetLogs(nsString& success, nsString& error, PRUnichar **pError, PRUnichar **pSuccess);
|
||||
void ReportStatus(PRInt32 errorNum, nsString& name, nsString *pStream);
|
||||
nsresult Initialize();
|
||||
|
||||
private:
|
||||
nsComm4xMail m_mail;
|
||||
PRUint32 m_bytesDone;
|
||||
nsCOMPtr<nsIStringBundle> m_pBundleProxy;
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsComm4xMailImport_h___ */
|
|
@ -0,0 +1,46 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* 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 ***** */
|
||||
#ifndef nsComm4xMailStringBundle_H__
|
||||
#define nsComm4xMailStringBundle_H__
|
||||
|
||||
#define COMM4XMAILIMPORT_NAME 2000
|
||||
#define COMM4XMAILIMPORT_DESCRIPTION 2001
|
||||
#define COMM4XMAILIMPORT_MAILBOX_SUCCESS 2002
|
||||
#define COMM4XMAILIMPORT_MAILBOX_BADPARAM 2003
|
||||
#define COMM4XMAILIMPORT_MAILBOX_CONVERTERROR 2004
|
||||
|
||||
#endif /* nsComm4xMailStringBundle_H__ */
|
|
@ -0,0 +1,165 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* 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 ***** */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsComm4xProfile.h"
|
||||
#include "nsIFileStreams.h"
|
||||
#include "nsIProfileInternal.h"
|
||||
#include "nsILineInputStream.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIPrefMigration.h"
|
||||
|
||||
|
||||
nsComm4xProfile::nsComm4xProfile()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsComm4xProfile::~nsComm4xProfile()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsComm4xProfile, nsIComm4xProfile)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComm4xProfile::GetProfileList(PRUint32 *length, PRUnichar ***profileNames)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIProfileInternal> profile (do_GetService(NS_PROFILE_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = profile->GetProfileListX(nsIProfileInternal::LIST_FOR_IMPORT, length, profileNames);
|
||||
return rv;
|
||||
}
|
||||
|
||||
#define PREF_NAME "user_pref(\"mail.directory\", \""
|
||||
#define PREF_LENGTH 29
|
||||
#define PREF_END "\")"
|
||||
NS_IMETHODIMP
|
||||
nsComm4xProfile::GetMailDir(const PRUnichar *profileName, char **_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
*_retval = nsnull;
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr <nsILocalFile> resolvedLocation;
|
||||
|
||||
nsCOMPtr<nsIProfileInternal> profile (do_GetService(NS_PROFILE_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = profile->GetOriginalProfileDir(profileName, getter_AddRefs(resolvedLocation));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (resolvedLocation) {
|
||||
nsCOMPtr <nsIFile> file;
|
||||
rv = resolvedLocation->Clone(getter_AddRefs(file));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr <nsILocalFile> profileLocation;
|
||||
profileLocation = do_QueryInterface(file);
|
||||
rv = profileLocation->Append(PREF_FILE_NAME_IN_4x);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
PRBool exists = PR_FALSE;
|
||||
rv = profileLocation->Exists(&exists);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (exists) {
|
||||
nsXPIDLCString prefValue;
|
||||
rv = GetPrefValue(profileLocation, PREF_NAME, PREF_END, getter_Copies(prefValue));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (prefValue) {
|
||||
#ifdef XP_MAC
|
||||
rv = profileLocation->SetPersistentDescriptor(prefValue.get());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = profileLocation->GetPath(_retval);
|
||||
#else
|
||||
*_retval = ToNewCString(prefValue);
|
||||
#endif
|
||||
}
|
||||
#if defined(XP_PC) || defined(XP_MAC)
|
||||
else {
|
||||
nsCOMPtr <nsIFile> mailLocation;
|
||||
rv = resolvedLocation->Clone(getter_AddRefs(mailLocation));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mailLocation->Append("Mail");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = mailLocation->GetPath(_retval);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsComm4xProfile::GetPrefValue(nsILocalFile *filePath, const char * prefName, const char * prefEnd, char ** retval)
|
||||
{
|
||||
nsString buffer;
|
||||
PRBool more = PR_TRUE;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFileInputStream> fileStream(do_CreateInstance(NS_LOCALFILEINPUTSTREAM_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = fileStream->Init(filePath, -1, -1, PR_FALSE);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsILineInputStream> lineStream(do_QueryInterface(fileStream, &rv));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
PRBool found = PR_FALSE;
|
||||
PRInt32 offset;
|
||||
PRInt32 endOffset;
|
||||
while (!found && more) {
|
||||
rv = lineStream->ReadLine(buffer, &more);
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
offset = buffer.Find(prefName,PR_FALSE, 0, -1);
|
||||
if (offset != kNotFound) {
|
||||
endOffset = buffer.Find(prefEnd,PR_FALSE, 0, -1);
|
||||
if (endOffset != kNotFound) {
|
||||
nsString prefValue;
|
||||
buffer.Mid(prefValue, offset + PREF_LENGTH, endOffset-(offset + PREF_LENGTH));
|
||||
found = PR_TRUE;
|
||||
NS_ConvertUCS2toUTF8 utf8Pref(prefValue.get());
|
||||
*retval = ToNewCString(utf8Pref);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fileStream->Close();
|
||||
return rv;
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef nsComm4xProfile_h__
|
||||
#define nsComm4xProfile_h__
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIComm4xProfile.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsString.h"
|
||||
|
||||
/* c66c1060-2bdc-11d6-92a0-0010a4b26cda */
|
||||
#define NS_ICOMM4XPROFILE_CID \
|
||||
{ 0xc66c1060, 0x2bdc, 0x11d6, {0x92, 0xa0, 0x0, 0x10, 0xa4, 0xb2, 0x6c, 0xda} }
|
||||
#define NS_ICOMM4XPROFILE_CONTRACTID "@mozilla.org/comm4xProfile;1"
|
||||
#define NS_ICOMM4XPROFILE_CLASSNAME "Communicator 4.x Profile"
|
||||
|
||||
class nsComm4xProfile : public nsIComm4xProfile
|
||||
{
|
||||
public:
|
||||
nsComm4xProfile();
|
||||
virtual ~nsComm4xProfile();
|
||||
nsresult Get4xProfileInfo(const char *registryName);
|
||||
nsresult GetPrefValue(nsILocalFile *filePath, const char * prefName, const char * prefEnd, char ** value);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICOMM4XPROFILE
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsComm4xProfile_h__ */
|
||||
|
|
@ -41,6 +41,7 @@
|
|||
#include "nsIImportABDescriptor.h"
|
||||
#include "nsIImportSettings.h"
|
||||
#include "nsIImportFieldMap.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsIAddrDatabase.h"
|
||||
#include "nsTextFormatter.h"
|
||||
|
@ -286,8 +287,12 @@ NS_IMETHODIMP nsEudoraImport::GetImportInterface( const char *pImportType, nsISu
|
|||
pGeneric->SetData( "mailInterface", pMail);
|
||||
nsString name;
|
||||
nsEudoraStringBundle::GetStringByID( EUDORAIMPORT_NAME, name);
|
||||
pGeneric->SetData( "name", (nsISupports *) name.get());
|
||||
rv = pGeneric->QueryInterface( kISupportsIID, (void **)ppInterface);
|
||||
nsCOMPtr<nsISupportsWString> nameString (do_CreateInstance(NS_SUPPORTS_WSTRING_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nameString->SetData(name.get());
|
||||
pGeneric->SetData( "name", nameString);
|
||||
rv = pGeneric->QueryInterface( kISupportsIID, (void **)ppInterface);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "nsIImportAddressBooks.h"
|
||||
#include "nsIImportABDescriptor.h"
|
||||
#include "nsIImportFieldMap.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "WabObject.h"
|
||||
#include "nsOEAddressIterator.h"
|
||||
#include "nsIOutputStream.h"
|
||||
|
@ -266,8 +267,12 @@ NS_IMETHODIMP nsOEImport::GetImportInterface( const char *pImportType, nsISuppor
|
|||
pGeneric->SetData( "mailInterface", pMail);
|
||||
nsString name;
|
||||
nsOEStringBundle::GetStringByID( OEIMPORT_NAME, name);
|
||||
pGeneric->SetData( "name", (nsISupports *) name.get());
|
||||
rv = pGeneric->QueryInterface( kISupportsIID, (void **)ppInterface);
|
||||
nsCOMPtr<nsISupportsWString> nameString (do_CreateInstance(NS_SUPPORTS_WSTRING_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nameString->SetData(name.get());
|
||||
pGeneric->SetData( "name", nameString);
|
||||
rv = pGeneric->QueryInterface( kISupportsIID, (void **)ppInterface);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include "nsIImportAddressBooks.h"
|
||||
#include "nsIImportABDescriptor.h"
|
||||
#include "nsIImportFieldMap.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsIAddrDatabase.h"
|
||||
#include "nsOutlookSettings.h"
|
||||
|
@ -266,8 +267,12 @@ NS_IMETHODIMP nsOutlookImport::GetImportInterface( const char *pImportType, nsIS
|
|||
pGeneric->SetData( "mailInterface", pMail);
|
||||
nsString name;
|
||||
nsOutlookStringBundle::GetStringByID( OUTLOOKIMPORT_NAME, name);
|
||||
pGeneric->SetData( "name", (nsISupports *) name.get());
|
||||
rv = pGeneric->QueryInterface( kISupportsIID, (void **)ppInterface);
|
||||
nsCOMPtr<nsISupportsWString> nameString (do_CreateInstance(NS_SUPPORTS_WSTRING_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nameString->SetData(name.get());
|
||||
pGeneric->SetData( "name", nameString);
|
||||
rv = pGeneric->QueryInterface( kISupportsIID, (void **)ppInterface);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -647,6 +647,49 @@ function ImportMail( module, success, error) {
|
|||
if (loc == null) {
|
||||
// No location found, check to see if we can ask the user.
|
||||
if (mailInterface.GetStatus( "canUserSetLocation") != 0) {
|
||||
if (selectedModuleName == gImportMsgsBundle.getString('Comm4xImportName'))
|
||||
{
|
||||
var errorValue = true;
|
||||
//open the profile dialog.
|
||||
var comm4xprofile = Components.classes["@mozilla.org/comm4xProfile;1"].createInstance();
|
||||
if(comm4xprofile != null) {
|
||||
comm4xprofile = comm4xprofile.QueryInterface( Components.interfaces.nsIComm4xProfile);
|
||||
if(comm4xprofile != null) {
|
||||
var length = {value:0};
|
||||
var profileList = comm4xprofile.getProfileList(length);
|
||||
if (profileList)
|
||||
{
|
||||
var selected = {value:0};
|
||||
if (length.value == 1)
|
||||
{
|
||||
errorValue = false;
|
||||
}
|
||||
else {
|
||||
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
|
||||
if (promptService) {
|
||||
var clickedOk = false;
|
||||
clickedOk = promptService.select(window,
|
||||
gImportMsgsBundle.getString('profileTitle'),
|
||||
gImportMsgsBundle.getString('profileText'),
|
||||
length.value, profileList, selected);
|
||||
if (clickedOk) {
|
||||
errorValue = false;
|
||||
}
|
||||
} // promptService
|
||||
}
|
||||
if (!errorValue) {
|
||||
var profileDir = comm4xprofile.getMailDir(profileList[selected.value]);
|
||||
mailInterface.SetData( "mailLocation", CreateNewFileSpecFromPath( profileDir));
|
||||
}
|
||||
} // profileList
|
||||
} // comm4xprofile
|
||||
} // comm4xprofile
|
||||
if (errorValue) {
|
||||
error.data = gImportMsgsBundle.getString('ImportMailNotFound');
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
var filePicker = Components.classes["@mozilla.org/filepicker;1"].createInstance();
|
||||
if (filePicker != null) {
|
||||
filePicker = filePicker.QueryInterface( Components.interfaces.nsIFilePicker);
|
||||
|
@ -673,6 +716,7 @@ function ImportMail( module, success, error) {
|
|||
error.data = gImportMsgsBundle.getString('ImportMailNotFound');
|
||||
return( false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
error.data = gImportMsgsBundle.getString('ImportMailNotFound');
|
||||
|
|
|
@ -326,3 +326,10 @@ WorkButtonDesc=Work
|
|||
DefaultFolderName=Imported Mail
|
||||
# LOCALIZATION NOTE: Do not translate the word "%S" below.
|
||||
ModuleFolderName=%S Mail
|
||||
|
||||
# LOCALIZATION NOTE : "Communicator 4.x" is the used for previous versions of Netscape Communicator
|
||||
# Please translate using the brandname in respective languages for Netscape Communicator 4 releases.
|
||||
# strings profile dialog that comes up when importing mail from 4.x
|
||||
profileTitle=Communicator 4.x profiles
|
||||
profileText=Choose the profile that contains the Local Mail you want to import:
|
||||
|
||||
|
|
|
@ -288,6 +288,7 @@ NS_IMETHODIMP nsImportGenericMail::GetData(const char *dataId, nsISupports **_re
|
|||
|
||||
NS_IMETHODIMP nsImportGenericMail::SetData( const char *dataId, nsISupports *item)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
NS_PRECONDITION(dataId != nsnull, "null ptr");
|
||||
if (!dataId)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -318,17 +319,17 @@ NS_IMETHODIMP nsImportGenericMail::SetData( const char *dataId, nsISupports *ite
|
|||
}
|
||||
|
||||
if (!nsCRT::strcasecmp( dataId, "name")) {
|
||||
// BIG CHEAT, is this OK to do?
|
||||
PRUnichar *pName = (PRUnichar *)item;
|
||||
if (m_pName)
|
||||
nsCRT::free( m_pName);
|
||||
if (pName)
|
||||
m_pName = nsCRT::strdup( pName);
|
||||
else
|
||||
m_pName = nsnull;
|
||||
m_pName = nsnull;
|
||||
nsCOMPtr<nsISupportsWString> nameString;
|
||||
if (item) {
|
||||
item->QueryInterface( NS_GET_IID(nsISupportsWString), getter_AddRefs(nameString));
|
||||
rv = nameString->GetData(&m_pName);
|
||||
}
|
||||
}
|
||||
|
||||
return( NS_OK);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImportGenericMail::GetStatus( const char *statusKind, PRInt32 *_retval)
|
||||
|
|
|
@ -233,6 +233,7 @@ en-US.jar:
|
|||
locale/en-US/messenger/messengercompose/sendProgress.dtd (compose/resources/locale/en-US/sendProgress.dtd)
|
||||
locale/en-US/messenger/messengercompose/composeMsgs.properties (compose/resources/locale/en-US/composeMsgs.properties)
|
||||
locale/en-US/messenger/imapMsgs.properties (imap/resources/locale/en-US/imapMsgs.properties)
|
||||
locale/en-US/messenger/comm4xMailImportMsgs.properties (import/comm4x/resources/locale/en-US/comm4xMailImportMsgs.properties)
|
||||
locale/en-US/messenger/eudoraImportMsgs.properties (import/eudora/resources/locale/en-US/eudoraImportMsgs.properties)
|
||||
locale/en-US/messenger/oeImportMsgs.properties (import/oexpress/resources/locale/en-us/oeImportMsgs.properties)
|
||||
locale/en-US/messenger/outlookImportMsgs.properties (import/outlook/resources/locale/en-us/outlookImportMsgs.properties)
|
||||
|
|
|
@ -49,6 +49,18 @@
|
|||
#define NEW_IMAPMAIL_DIR_NAME "ImapMail"
|
||||
#define NEW_LOCAL_MAIL_DIR_NAME "Local Folders"
|
||||
|
||||
#if defined(XP_UNIX)
|
||||
#define PREF_FILE_NAME_IN_4x "preferences.js"
|
||||
#elif defined(XP_MAC)
|
||||
#define PREF_FILE_NAME_IN_4x "Netscape Preferences"
|
||||
#elif defined(XP_PC)
|
||||
#define PREF_FILE_NAME_IN_4x "prefs.js"
|
||||
#else
|
||||
/* this will cause a failure at run time, as it should, since we don't know
|
||||
how to migrate platforms other than Mac, Windows and UNIX */
|
||||
#define PREF_FILE_NAME_IN_4x ""
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
%}
|
||||
|
||||
[scriptable, uuid(85c86e4c-6a6c-11d3-9a55-004005263078)]
|
||||
|
|
|
@ -178,20 +178,6 @@
|
|||
|
||||
#define NEW_DIR_SUFFIX "5"
|
||||
|
||||
/* who's going to win the file name battle? */
|
||||
#if defined(XP_UNIX)
|
||||
#define PREF_FILE_NAME_IN_4x "preferences.js"
|
||||
#elif defined(XP_MAC)
|
||||
#define PREF_FILE_NAME_IN_4x "Netscape Preferences"
|
||||
#elif defined(XP_PC)
|
||||
#define PREF_FILE_NAME_IN_4x "prefs.js"
|
||||
#else
|
||||
/* this will cause a failure at run time, as it should, since we don't know
|
||||
how to migrate platforms other than Mac, Windows and UNIX */
|
||||
#define PREF_FILE_NAME_IN_4x ""
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
/* and the winner is: Windows */
|
||||
#define PREF_FILE_NAME_IN_5x "prefs.js"
|
||||
|
||||
#define PREF_MIGRATION_PROGRESS_URL "chrome://communicator/content/profile/profileMigrationProgress.xul"
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
interface nsICmdLineService;
|
||||
interface nsIFile;
|
||||
interface nsILocalFile;
|
||||
|
||||
%{C++
|
||||
#define NS_ERROR_PROFILE_REQUIRES_INTERACTION NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_PROFILE, 1)
|
||||
|
@ -69,12 +70,16 @@ interface nsIProfileInternal : nsIProfile {
|
|||
* LIST_ONLY_NEW - the list will contain only migrated profiles
|
||||
* LIST_ONLY_OLD - the list will contain only un-migrated profiles
|
||||
* LIST_ALL - the list will contain all profiles
|
||||
* LIST_FOR_IMPORT - the list is generated from 4.x registry and contains
|
||||
* all the 4.x profiles
|
||||
* do not use this except from the import module
|
||||
*
|
||||
*/
|
||||
|
||||
const unsigned long LIST_ONLY_NEW = 1;
|
||||
const unsigned long LIST_ONLY_OLD = 2;
|
||||
const unsigned long LIST_ALL = 3;
|
||||
const unsigned long LIST_FOR_IMPORT= 4;
|
||||
|
||||
void getProfileListX(in unsigned long which, out unsigned long length, [retval, array, size_is(length)] out wstring profileNames);
|
||||
|
||||
|
@ -97,6 +102,12 @@ interface nsIProfileInternal : nsIProfile {
|
|||
*/
|
||||
wstring getProfilePath(in wstring profileName);
|
||||
|
||||
/**
|
||||
* Returns a profile directory of the importType. The path will point to
|
||||
* the 4.x profile directory. Should be used only from the import module.
|
||||
*/
|
||||
nsILocalFile getOriginalProfileDir(in wstring profileName);
|
||||
|
||||
attribute boolean automigrate;
|
||||
readonly attribute nsIFile defaultProfileParentDir;
|
||||
readonly attribute wstring firstProfile;
|
||||
|
|
|
@ -1052,6 +1052,15 @@ NS_IMETHODIMP nsProfile::GetProfilePath(const PRUnichar *profileName, PRUnichar
|
|||
return prettyDir->GetUnicodePath(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsProfile::GetOriginalProfileDir(const PRUnichar *profileName, nsILocalFile **originalDir)
|
||||
{
|
||||
NS_ENSURE_ARG(profileName);
|
||||
NS_ENSURE_ARG_POINTER(originalDir);
|
||||
*originalDir = nsnull;
|
||||
|
||||
return gProfileDataAccess->GetOriginalProfileDir(profileName, originalDir);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsProfile::GetDefaultProfileParentDir(nsIFile **aDefaultProfileParentDir)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDefaultProfileParentDir);
|
||||
|
@ -1443,6 +1452,7 @@ nsresult nsProfile::SetProfileDir(const PRUnichar *profileName, nsIFile *profile
|
|||
aProfile->profileName = profileName;
|
||||
aProfile->SetResolvedProfileDir(localFile);
|
||||
aProfile->isMigrated = PR_TRUE;
|
||||
aProfile->isImportType = PR_FALSE;
|
||||
|
||||
gProfileDataAccess->SetValue(aProfile);
|
||||
|
||||
|
@ -1840,9 +1850,29 @@ NS_IMETHODIMP nsProfile::GetProfileListX(PRUint32 whichKind, PRUint32 *length, P
|
|||
NS_ENSURE_ARG_POINTER(profileNames);
|
||||
*profileNames = nsnull;
|
||||
|
||||
if (whichKind == nsIProfileInternal::LIST_FOR_IMPORT)
|
||||
Update4xProfileInfo();
|
||||
return gProfileDataAccess->GetProfileList(whichKind, length, profileNames);
|
||||
}
|
||||
|
||||
// this will add all the 4x profiles (with isImportType flag set) to the
|
||||
// profiles list. The adding of profiles is done only once per session.
|
||||
nsresult nsProfile::Update4xProfileInfo()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
#if defined(XP_PC) || defined(XP_MAC)
|
||||
|
||||
char * oldRegFile = GetOldRegLocation();
|
||||
rv = gProfileDataAccess->Get4xProfileInfo(oldRegFile, PR_TRUE);
|
||||
nsMemory::Free(oldRegFile);
|
||||
#elif defined (XP_BEOS)
|
||||
#else
|
||||
/* XP_UNIX */
|
||||
rv = gProfileDataAccess->Get4xProfileInfo(nsnull, PR_TRUE);
|
||||
#endif /* XP_PC || XP_MAC */
|
||||
return rv;
|
||||
}
|
||||
|
||||
// launch the application with a profile of user's choice
|
||||
// Prefs and FileLocation services are used here.
|
||||
|
@ -1880,18 +1910,10 @@ nsresult nsProfile::LoadNewProfilePrefs()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// Migrate profile information from the 4x registry to 5x registry.
|
||||
NS_IMETHODIMP nsProfile::MigrateProfileInfo()
|
||||
char * nsProfile::GetOldRegLocation()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
#if defined(XP_PC) || defined(XP_MAC)
|
||||
|
||||
#if defined(DEBUG_profile_verbose)
|
||||
printf("Entered MigrateProfileInfo.\n");
|
||||
#endif
|
||||
|
||||
char oldRegFile[_MAX_LENGTH] = {'\0'};
|
||||
|
||||
#ifdef XP_PC
|
||||
|
@ -1913,13 +1935,33 @@ NS_IMETHODIMP nsProfile::MigrateProfileInfo()
|
|||
|
||||
PL_strcpy(oldRegFile, regLocation.GetNativePathCString());
|
||||
#endif /* XP_PC */
|
||||
char * result = (char *)nsMemory::Alloc((PL_strlen(oldRegFile)+1) * sizeof(char));
|
||||
PL_strcpy(result, oldRegFile);
|
||||
return result;
|
||||
#endif /* XP_PC || XP_MAC */
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
rv = gProfileDataAccess->Get4xProfileInfo(oldRegFile);
|
||||
|
||||
// Migrate profile information from the 4x registry to 5x registry.
|
||||
NS_IMETHODIMP nsProfile::MigrateProfileInfo()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
#if defined(XP_PC) || defined(XP_MAC)
|
||||
|
||||
#if defined(DEBUG_profile_verbose)
|
||||
printf("Entered MigrateProfileInfo.\n");
|
||||
#endif
|
||||
|
||||
char * oldRegFile = GetOldRegLocation();
|
||||
rv = gProfileDataAccess->Get4xProfileInfo(oldRegFile, PR_FALSE);
|
||||
nsMemory::Free(oldRegFile);
|
||||
|
||||
#elif defined (XP_BEOS)
|
||||
#else
|
||||
/* XP_UNIX */
|
||||
rv = gProfileDataAccess->Get4xProfileInfo(nsnull);
|
||||
rv = gProfileDataAccess->Get4xProfileInfo(nsnull, PR_FALSE);
|
||||
#endif /* XP_PC || XP_MAC */
|
||||
|
||||
gProfileDataAccess->mProfileDataChanged = PR_TRUE;
|
||||
|
|
|
@ -85,6 +85,8 @@ private:
|
|||
nsresult IsProfileDirSalted(nsIFile *profileDir, PRBool *isSalted);
|
||||
nsresult DefineLocaleDefaultsDir();
|
||||
nsresult UndefineFileLocations();
|
||||
nsresult Update4xProfileInfo();
|
||||
char * GetOldRegLocation();
|
||||
|
||||
PRBool mStartingUp;
|
||||
PRBool mAutomigrate;
|
||||
|
|
|
@ -93,6 +93,7 @@ nsProfileAccess::nsProfileAccess()
|
|||
{
|
||||
mProfileDataChanged = PR_FALSE;
|
||||
mForgetProfileCalled = PR_FALSE;
|
||||
m4xProfilesAdded = PR_FALSE;
|
||||
mProfiles = new nsVoidArray();
|
||||
|
||||
// Get the profile registry path
|
||||
|
@ -202,7 +203,7 @@ nsProfileAccess::GetValue(const PRUnichar* profileName, ProfileStruct** aProfile
|
|||
*aProfile = nsnull;
|
||||
|
||||
PRInt32 index = 0;
|
||||
index = FindProfileIndex(profileName);
|
||||
index = FindProfileIndex(profileName, PR_FALSE);
|
||||
if (index < 0)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -228,7 +229,7 @@ nsProfileAccess::SetValue(ProfileStruct* aProfile)
|
|||
PRBool isNewProfile = PR_FALSE;
|
||||
ProfileStruct* profileItem;
|
||||
|
||||
index = FindProfileIndex(aProfile->profileName.get());
|
||||
index = FindProfileIndex(aProfile->profileName.get(), aProfile->isImportType);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
|
@ -249,6 +250,8 @@ nsProfileAccess::SetValue(ProfileStruct* aProfile)
|
|||
|
||||
profileItem->isMigrated = aProfile->isMigrated;
|
||||
|
||||
profileItem->isImportType = aProfile->isImportType;
|
||||
|
||||
profileItem->updateProfileEntry = PR_TRUE;
|
||||
|
||||
if (!aProfile->NCProfileName.IsEmpty())
|
||||
|
@ -454,6 +457,7 @@ nsProfileAccess::FillProfileInfo(nsIFile* regName)
|
|||
if (NCHavePregInfo)
|
||||
profileItem->NCHavePregInfo = NS_STATIC_CAST(const PRUnichar*, NCHavePregInfo);
|
||||
|
||||
profileItem->isImportType = PR_FALSE;
|
||||
if (!mProfiles) {
|
||||
mProfiles = new nsVoidArray();
|
||||
|
||||
|
@ -492,7 +496,7 @@ nsProfileAccess::GetNumProfiles(PRInt32 *numProfiles)
|
|||
{
|
||||
ProfileStruct* profileItem = (ProfileStruct *) (mProfiles->ElementAt(index));
|
||||
|
||||
if (profileItem->isMigrated)
|
||||
if (profileItem->isMigrated && !profileItem->isImportType)
|
||||
{
|
||||
(*numProfiles)++;
|
||||
}
|
||||
|
@ -516,7 +520,7 @@ nsProfileAccess::GetNum4xProfiles(PRInt32 *numProfiles)
|
|||
{
|
||||
ProfileStruct* profileItem = (ProfileStruct *) (mProfiles->ElementAt(index));
|
||||
|
||||
if (!profileItem->isMigrated)
|
||||
if (!profileItem->isMigrated && !profileItem->isImportType)
|
||||
{
|
||||
(*numProfiles)++;
|
||||
}
|
||||
|
@ -543,7 +547,7 @@ nsProfileAccess::GetFirstProfile(PRUnichar **firstProfile)
|
|||
{
|
||||
ProfileStruct* profileItem = (ProfileStruct *) (mProfiles->ElementAt(index));
|
||||
|
||||
if (profileItem->isMigrated)
|
||||
if (profileItem->isMigrated && !profileItem->isImportType)
|
||||
{
|
||||
*firstProfile = ToNewUnicode(profileItem->profileName);
|
||||
break;
|
||||
|
@ -595,7 +599,7 @@ nsProfileAccess::RemoveSubTree(const PRUnichar* profileName)
|
|||
NS_ASSERTION(profileName, "Invalid profile name");
|
||||
|
||||
// delete this entry from the mProfiles array
|
||||
PRInt32 index = FindProfileIndex(profileName);
|
||||
PRInt32 index = FindProfileIndex(profileName, PR_FALSE);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
|
@ -612,7 +616,7 @@ nsProfileAccess::RemoveSubTree(const PRUnichar* profileName)
|
|||
|
||||
// Return the index of a given profiel from the arraf of profile structs.
|
||||
PRInt32
|
||||
nsProfileAccess::FindProfileIndex(const PRUnichar* profileName)
|
||||
nsProfileAccess::FindProfileIndex(const PRUnichar* profileName, PRBool forImport)
|
||||
{
|
||||
NS_ASSERTION(profileName, "Invalid profile name");
|
||||
|
||||
|
@ -623,7 +627,7 @@ nsProfileAccess::FindProfileIndex(const PRUnichar* profileName)
|
|||
{
|
||||
ProfileStruct* profileItem = (ProfileStruct *) (mProfiles->ElementAt(index));
|
||||
|
||||
if(profileItem->profileName.Equals(profileName))
|
||||
if(profileItem->profileName.Equals(profileName) && (profileItem->isImportType == forImport))
|
||||
{
|
||||
retval = index;
|
||||
break;
|
||||
|
@ -726,7 +730,7 @@ nsProfileAccess::UpdateRegistry(nsIFile* regName)
|
|||
|
||||
PRInt32 index = 0;
|
||||
|
||||
index = FindProfileIndex(profile);
|
||||
index = FindProfileIndex(profile, PR_FALSE);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
|
@ -784,7 +788,7 @@ nsProfileAccess::UpdateRegistry(nsIFile* regName)
|
|||
{
|
||||
ProfileStruct* profileItem = (ProfileStruct *) (mProfiles->ElementAt(i));
|
||||
|
||||
if (profileItem->updateProfileEntry)
|
||||
if (!profileItem->isImportType && profileItem->updateProfileEntry)
|
||||
{
|
||||
nsRegistryKey profKey;
|
||||
|
||||
|
@ -829,6 +833,46 @@ nsProfileAccess::UpdateRegistry(nsIFile* regName)
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsProfileAccess::GetOriginalProfileDir(const PRUnichar *profileName, nsILocalFile **originalDir)
|
||||
{
|
||||
NS_ENSURE_ARG(profileName);
|
||||
NS_ENSURE_ARG_POINTER(originalDir);
|
||||
*originalDir = nsnull;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
PRInt32 index = FindProfileIndex(profileName, PR_TRUE);
|
||||
if (index >= 0)
|
||||
{
|
||||
ProfileStruct* profileItem = (ProfileStruct *) (mProfiles->ElementAt(index));
|
||||
nsCOMPtr<nsILocalFile> profileDir;
|
||||
rv = profileItem->GetResolvedProfileDir(getter_AddRefs(profileDir));
|
||||
if (NS_SUCCEEDED(rv) && profileDir)
|
||||
{
|
||||
#ifdef XP_MAC
|
||||
PRBool exists;
|
||||
rv = profileDir->Exists(&exists);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (exists) {
|
||||
PRBool inTrash;
|
||||
nsCOMPtr<nsIFile> trashFolder;
|
||||
|
||||
rv = NS_GetSpecialDirectory(NS_MAC_TRASH_DIR, getter_AddRefs(trashFolder));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = trashFolder->Contains(profileDir, PR_TRUE, &inTrash);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (inTrash) {
|
||||
return NS_ERROR_FILE_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
NS_IF_ADDREF(*originalDir = profileDir);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// Return the list of profiles, 4x, 5x, or both.
|
||||
nsresult
|
||||
nsProfileAccess::GetProfileList(PRInt32 whichKind, PRUint32 *length, PRUnichar ***result)
|
||||
|
@ -842,6 +886,7 @@ nsProfileAccess::GetProfileList(PRInt32 whichKind, PRUint32 *length, PRUnichar *
|
|||
PRInt32 count, localLength = 0;
|
||||
PRUnichar **outArray, **next;
|
||||
PRInt32 numElems = mProfiles->Count();
|
||||
PRInt32 profilesCount;
|
||||
|
||||
switch (whichKind)
|
||||
{
|
||||
|
@ -852,7 +897,14 @@ nsProfileAccess::GetProfileList(PRInt32 whichKind, PRUint32 *length, PRUnichar *
|
|||
GetNum4xProfiles(&count);
|
||||
break;
|
||||
case nsIProfileInternal::LIST_ALL:
|
||||
count = numElems;
|
||||
GetNum4xProfiles(&count);
|
||||
GetNumProfiles(&profilesCount);
|
||||
count += profilesCount;
|
||||
break;
|
||||
case nsIProfileInternal::LIST_FOR_IMPORT:
|
||||
GetNum4xProfiles(&count);
|
||||
GetNumProfiles(&profilesCount);
|
||||
count = numElems - (count + profilesCount);
|
||||
break;
|
||||
default:
|
||||
NS_ASSERTION(PR_FALSE, "Bad parameter");
|
||||
|
@ -867,11 +919,14 @@ nsProfileAccess::GetProfileList(PRInt32 whichKind, PRUint32 *length, PRUnichar *
|
|||
{
|
||||
ProfileStruct* profileItem = (ProfileStruct *) (mProfiles->ElementAt(index));
|
||||
|
||||
if (whichKind == nsIProfileInternal::LIST_ONLY_OLD && profileItem->isMigrated)
|
||||
if (whichKind == nsIProfileInternal::LIST_ONLY_OLD && (profileItem->isMigrated || profileItem->isImportType))
|
||||
continue;
|
||||
else if (whichKind == nsIProfileInternal::LIST_ONLY_NEW && !profileItem->isMigrated)
|
||||
else if (whichKind == nsIProfileInternal::LIST_ONLY_NEW && (!profileItem->isMigrated || profileItem->isImportType))
|
||||
continue;
|
||||
else if (whichKind == nsIProfileInternal::LIST_ALL && profileItem->isImportType)
|
||||
continue;
|
||||
else if (whichKind == nsIProfileInternal::LIST_FOR_IMPORT && !profileItem->isImportType)
|
||||
continue;
|
||||
|
||||
*next = ToNewUnicode(profileItem->profileName);
|
||||
if (*next == nsnull)
|
||||
{
|
||||
|
@ -909,7 +964,7 @@ nsProfileAccess::ProfileExists(const PRUnichar *profileName)
|
|||
for (PRInt32 index=0; index < numElems; index++)
|
||||
{
|
||||
ProfileStruct* profileItem = (ProfileStruct *) (mProfiles->ElementAt(index));
|
||||
if (profileItem->profileName.Equals(profileName))
|
||||
if (!profileItem->isImportType && profileItem->profileName.Equals(profileName))
|
||||
{
|
||||
exists = PR_TRUE;
|
||||
break;
|
||||
|
@ -920,9 +975,11 @@ nsProfileAccess::ProfileExists(const PRUnichar *profileName)
|
|||
|
||||
// Capture the 4x profile information from the old registry (4x)
|
||||
nsresult
|
||||
nsProfileAccess::Get4xProfileInfo(const char *registryName)
|
||||
nsProfileAccess::Get4xProfileInfo(const char *registryName, PRBool fromImport)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (fromImport && m4xProfilesAdded)
|
||||
return rv;
|
||||
|
||||
nsAutoString charSet;
|
||||
rv = GetPlatformCharset(charSet);
|
||||
|
@ -947,6 +1004,8 @@ nsProfileAccess::Get4xProfileInfo(const char *registryName)
|
|||
rv = enumKeys->First();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (fromImport)
|
||||
m4xProfilesAdded = PR_TRUE;
|
||||
// Enumerate subkeys till done.
|
||||
while( (NS_OK != enumKeys->IsDone()))
|
||||
{
|
||||
|
@ -984,13 +1043,14 @@ nsProfileAccess::Get4xProfileInfo(const char *registryName)
|
|||
#endif
|
||||
|
||||
PRBool exists = PR_FALSE;
|
||||
exists = ProfileExists(convertedProfName.get());
|
||||
if (exists)
|
||||
{
|
||||
rv = enumKeys->Next();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
continue;
|
||||
if (!fromImport) {
|
||||
exists = ProfileExists(convertedProfName.get());
|
||||
if (exists)
|
||||
{
|
||||
rv = enumKeys->Next();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
nsRegistryKey key;
|
||||
|
@ -1006,6 +1066,7 @@ nsProfileAccess::Get4xProfileInfo(const char *registryName)
|
|||
rv = profileItem->InternalizeLocation(oldReg, key, PR_TRUE, PR_FALSE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Could not get 4x profile location");
|
||||
profileItem->isMigrated = PR_FALSE;
|
||||
profileItem->isImportType = fromImport;
|
||||
|
||||
SetValue(profileItem);
|
||||
|
||||
|
@ -1032,13 +1093,14 @@ nsProfileAccess::Get4xProfileInfo(const char *registryName)
|
|||
}
|
||||
}
|
||||
|
||||
PRBool exists = PR_FALSE;;
|
||||
exists = ProfileExists(NS_ConvertASCIItoUCS2(unixProfileName).get());
|
||||
if (exists)
|
||||
{
|
||||
return NS_OK;
|
||||
PRBool exists = PR_FALSE;
|
||||
if (!fromImport) {
|
||||
exists = ProfileExists(NS_ConvertASCIItoUCS2(unixProfileName).get());
|
||||
if (exists)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! unixProfileName.IsEmpty() && ! unixProfileDirectory.IsEmpty() ) {
|
||||
nsCAutoString profileLocation(unixProfileDirectory);
|
||||
profileLocation += "/.netscape";
|
||||
|
@ -1070,6 +1132,7 @@ nsProfileAccess::Get4xProfileInfo(const char *registryName)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
profileItem->SetResolvedProfileDir(localFile);
|
||||
profileItem->isMigrated = PR_FALSE;
|
||||
profileItem->isImportType = fromImport;
|
||||
|
||||
SetValue(profileItem);
|
||||
}
|
||||
|
@ -1105,7 +1168,7 @@ nsProfileAccess::CheckRegString(const PRUnichar *profileName, char **info)
|
|||
*info = nsnull;
|
||||
PRInt32 index = 0;
|
||||
|
||||
index = FindProfileIndex(profileName);
|
||||
index = FindProfileIndex(profileName, PR_FALSE);
|
||||
|
||||
if (index >= 0 )
|
||||
{
|
||||
|
@ -1160,6 +1223,7 @@ ProfileStruct::ProfileStruct(const ProfileStruct& src) :
|
|||
NCProfileName(src.NCProfileName), NCDeniedService(src.NCDeniedService),
|
||||
NCEmailAddress(src.NCEmailAddress), NCHavePregInfo(src.NCHavePregInfo),
|
||||
updateProfileEntry(src.updateProfileEntry),
|
||||
isImportType(src.isImportType),
|
||||
regLocationData(src.regLocationData)
|
||||
{
|
||||
if (src.resolvedLocation) {
|
||||
|
|
|
@ -74,6 +74,8 @@ public:
|
|||
nsString NCEmailAddress;
|
||||
nsString NCHavePregInfo;
|
||||
PRBool updateProfileEntry;
|
||||
// this flag detemines if we added this profile to the list for the import module.
|
||||
PRBool isImportType;
|
||||
|
||||
private:
|
||||
nsresult EnsureDirPathExists(nsILocalFile *aFile, PRBool *wasCreated);
|
||||
|
@ -97,6 +99,7 @@ private:
|
|||
|
||||
nsString mCurrentProfile;
|
||||
nsString mHavePREGInfo;
|
||||
PRBool m4xProfilesAdded;
|
||||
|
||||
public:
|
||||
PRBool mProfileDataChanged;
|
||||
|
@ -111,8 +114,11 @@ public:
|
|||
void GetNum4xProfiles(PRInt32 *numProfiles);
|
||||
void GetFirstProfile(PRUnichar **firstProfile);
|
||||
nsresult GetProfileList(PRInt32 whichKind, PRUint32 *length, PRUnichar ***result);
|
||||
nsresult GetOriginalProfileDir(const PRUnichar *profileName, nsILocalFile **orginalDir);
|
||||
|
||||
nsresult Get4xProfileInfo(const char *registryName);
|
||||
// if fromImport is true all the 4.x profiles will be added to mProfiles with the isImportType flag set.
|
||||
// pass fromImport as True only if you are calling from the Import Module.
|
||||
nsresult Get4xProfileInfo(const char *registryName, PRBool fromImport);
|
||||
|
||||
void SetCurrentProfile(const PRUnichar *profileName);
|
||||
void GetCurrentProfile(PRUnichar **profileName);
|
||||
|
@ -133,7 +139,10 @@ private:
|
|||
|
||||
|
||||
nsresult HavePregInfo(char **info);
|
||||
PRInt32 FindProfileIndex(const PRUnichar* profileName);
|
||||
|
||||
// if forImport is true searches only the ImportType profiles
|
||||
// else searches the non-ImportType profiles.
|
||||
PRInt32 FindProfileIndex(const PRUnichar* profileName, PRBool forImport);
|
||||
|
||||
void SetPREGInfo(const char* pregInfo);
|
||||
void FreeProfileMembers(nsVoidArray *aProfile);
|
||||
|
|
|
@ -330,6 +330,8 @@ viewer:Components:msgImport.shlb
|
|||
viewer:Components:msgImport.xpt
|
||||
viewer:Components:msgImportText.shlb
|
||||
viewer:Components:msgImportEudora.shlb
|
||||
viewer:Components:msgImportComm4xM.shlb
|
||||
viewer:Components:msgImportComm4xM.xpt
|
||||
viewer:Components:AbSyncSvc.shlb
|
||||
viewer:Components:AbSyncSvc.xpt
|
||||
viewer:Components:nsLDAPPrefsService.js
|
||||
|
|
|
@ -334,6 +334,7 @@ bin/components/libvcard.so
|
|||
bin/components/libsmimestb.so
|
||||
bin/components/libimport.so
|
||||
bin/components/libimpText.so
|
||||
bin/components/libimpComm4xMail.so
|
||||
bin/components/libabsyncsvc.so
|
||||
bin/components/mailnews.xpt
|
||||
bin/components/mime.xpt
|
||||
|
@ -348,6 +349,7 @@ bin/components/msgsearch.xpt
|
|||
bin/components/nsLDAPPrefsService.js
|
||||
bin/components/txmgr.xpt
|
||||
bin/components/import.xpt
|
||||
bin/components/impComm4xMail.xpt
|
||||
bin/components/absync.xpt
|
||||
bin/chrome/messenger.jar
|
||||
bin/components/libmsgsmime.so
|
||||
|
|
|
@ -361,6 +361,8 @@ bin\components\importOE.dll
|
|||
bin\components\impOutlk.dll
|
||||
bin\components\impEudra.dll
|
||||
bin\components\impText.dll
|
||||
bin\components\impComm4xMail.dll
|
||||
bin\components\impComm4xMail.xpt
|
||||
bin\components\absyncsv.dll
|
||||
bin\components\absync.xpt
|
||||
bin\components\nsLDAPPrefsService.js
|
||||
|
|
Загрузка…
Ссылка в новой задаче