Added string bundles for the mailnews import tools

This commit is contained in:
tonyr%fbdesigns.com 1999-10-18 19:58:07 +00:00
Родитель e83c28a24f
Коммит f938e3ca92
28 изменённых файлов: 1197 добавлений и 311 удалений

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

@ -16,6 +16,9 @@
# Reserved.
DEPTH=..\..\..
DIRS=resources
MODULE=importOE
MAKE_OBJ_TYPE=DLL
@ -33,6 +36,7 @@ CPP_OBJS=\
.\$(OBJDIR)\nsOERegUtil.obj \
.\$(OBJDIR)\nsOE5File.obj \
.\$(OBJDIR)\nsOESettings.obj \
.\$(OBJDIR)\nsOEStringBundle.obj \
$(NULL)
LLIBS=\

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

@ -217,10 +217,13 @@ PRBool nsOE5File::IsFromLine( char *pLine, PRUint32 len)
#define kMailboxBufferSize 0x4000
const char *nsOE5File::m_pFromLineSep = "From ????@???? 1 Jan 1965 00:00:00\x0D\x0A";
nsresult nsOE5File::ImportMailbox( PRBool *pAbort, nsString& name, nsIFileSpec *inFile, nsIFileSpec *pDestination)
nsresult nsOE5File::ImportMailbox( PRBool *pAbort, nsString& name, nsIFileSpec *inFile, nsIFileSpec *pDestination, PRInt32 *pCount)
{
nsresult rv;
PRInt32 msgCount = 0;
if (pCount)
*pCount = 0;
rv = inFile->OpenStreamForReading();
if (NS_FAILED( rv)) return( rv);
rv = pDestination->OpenStreamForWriting();
@ -312,6 +315,8 @@ nsresult nsOE5File::ImportMailbox( PRBool *pAbort, nsString& name, nsIFileSpec *
last2[0] = 13;
last2[1] = 10;
}
msgCount++;
}
else {
// Error reading message, should this be logged???
@ -324,6 +329,9 @@ nsresult nsOE5File::ImportMailbox( PRBool *pAbort, nsString& name, nsIFileSpec *
delete [] pBuffer;
inFile->CloseStream();
pDestination->CloseStream();
if (pCount)
*pCount = msgCount;
return( rv);
}

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

@ -32,7 +32,7 @@ public:
static PRBool ReadIndex( nsIFileSpec *pFile, PRUint32 **ppIndex, PRUint32 *pSize);
static nsresult ImportMailbox( PRBool *pAbort, nsString& name, nsIFileSpec *inFile, nsIFileSpec *pDestination);
static nsresult ImportMailbox( PRBool *pAbort, nsString& name, nsIFileSpec *inFile, nsIFileSpec *pDestination, PRInt32 *pCount);
private:
typedef struct {

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

@ -43,6 +43,8 @@
#include "nsOE5File.h"
#include "nsIAddrDatabase.h"
#include "nsOESettings.h"
#include "nsTextFormater.h"
#include "nsOEStringBundle.h"
#include "OEDebugLog.h"
@ -73,15 +75,16 @@ public:
/* void ImportMailbox (in nsIImportMailboxDescriptor source, in nsIFileSpec destination, out boolean fatalError); */
NS_IMETHOD ImportMailbox(nsIImportMailboxDescriptor *source, nsIFileSpec *destination,
nsIOutputStream *pErrorLog, nsIOutputStream *pSuccessLog, PRBool *fatalError);
PRUnichar **pErrorLog, PRUnichar **pSuccessLog, PRBool *fatalError);
/* unsigned long GetImportProgress (); */
NS_IMETHOD GetImportProgress(PRUint32 *_retval);
/* wstring GetErrorString (); */
NS_IMETHOD GetErrorString(PRUnichar **_retval);
private:
static void ReportSuccess( nsString& name, PRInt32 count, nsString *pStream);
static void ReportError( PRInt32 errorNum, nsString& name, nsString *pStream);
static void AddLinebreak( nsString *pStream);
static void SetLogs( nsString& success, nsString& error, PRUnichar **pError, PRUnichar **pSuccess);
};
class ImportAddressImpl : public nsIImportAddressBooks
@ -121,8 +124,8 @@ public:
NS_IMETHOD ImportAddressBook( nsIImportABDescriptor *source,
nsIAddrDatabase * destination,
nsISupports * fieldMap,
nsIOutputStream * errorLog,
nsIOutputStream * successLog,
PRUnichar ** errorLog,
PRUnichar ** successLog,
PRBool * fatalError);
/* unsigned long GetImportProgress (); */
@ -178,8 +181,9 @@ NS_IMETHODIMP nsOEImport::GetName( PRUnichar **name)
if (! name)
return NS_ERROR_NULL_POINTER;
nsString title = "Outlook Express";
*name = title.ToNewUnicode();
// nsString title = "Outlook Express";
// *name = title.ToNewUnicode();
*name = nsOEStringBundle::GetStringByID( OEIMPORT_NAME);
return NS_OK;
}
@ -190,8 +194,9 @@ NS_IMETHODIMP nsOEImport::GetDescription( PRUnichar **name)
if (! name)
return NS_ERROR_NULL_POINTER;
nsString desc = "Outlook Express mail and address books";
*name = desc.ToNewUnicode();
// nsString desc = "Outlook Express mail and address books";
// *name = desc.ToNewUnicode();
*name = nsOEStringBundle::GetStringByID( OEIMPORT_DESCRIPTION);
return NS_OK;
}
@ -228,6 +233,9 @@ NS_IMETHODIMP nsOEImport::GetImportInterface( const char *pImportType, nsISuppor
rv = impSvc->CreateNewGenericMail( &pGeneric);
if (NS_SUCCEEDED( rv)) {
pGeneric->SetData( "mailInterface", pMail);
nsString name;
nsOEStringBundle::GetStringByID( OEIMPORT_NAME, name);
pGeneric->SetData( "name", (nsISupports *) name.GetUnicode());
rv = pGeneric->QueryInterface( kISupportsIID, (void **)ppInterface);
}
}
@ -342,18 +350,66 @@ NS_IMETHODIMP ImportMailImpl::FindMailboxes( nsIFileSpec *pLoc, nsISupportsArray
return( NS_OK);
}
void ImportMailImpl::AddLinebreak( nsString *pStream)
{
if (pStream)
pStream->Append( NS_LINEBREAK);
}
void ImportMailImpl::ReportSuccess( nsString& name, PRInt32 count, nsString *pStream)
{
if (!pStream)
return;
// load the success string
PRUnichar *pFmt = nsOEStringBundle::GetStringByID( OEIMPORT_MAILBOX_SUCCESS);
PRUnichar *pText = nsTextFormater::smprintf( pFmt, name.GetUnicode(), count);
pStream->Append( pText);
nsTextFormater::smprintf_free( pText);
nsOEStringBundle::FreeString( pFmt);
AddLinebreak( pStream);
}
void ImportMailImpl::ReportError( PRInt32 errorNum, nsString& name, nsString *pStream)
{
if (!pStream)
return;
// load the error string
PRUnichar *pFmt = nsOEStringBundle::GetStringByID( errorNum);
PRUnichar *pText = nsTextFormater::smprintf( pFmt, name.GetUnicode());
pStream->Append( pText);
nsTextFormater::smprintf_free( pText);
nsOEStringBundle::FreeString( pFmt);
AddLinebreak( pStream);
}
void ImportMailImpl::SetLogs( nsString& success, nsString& error, PRUnichar **pError, PRUnichar **pSuccess)
{
if (pError)
*pError = error.ToNewUnicode();
if (pSuccess)
*pSuccess = success.ToNewUnicode();
}
NS_IMETHODIMP ImportMailImpl::ImportMailbox( nsIImportMailboxDescriptor *pSource,
nsIFileSpec *pDestination,
nsIOutputStream *pErrorLog,
nsIOutputStream *pSuccessLog,
PRUnichar **pErrorLog,
PRUnichar **pSuccessLog,
PRBool *fatalError)
{
NS_PRECONDITION(pSource != nsnull, "null ptr");
NS_PRECONDITION(pDestination != nsnull, "null ptr");
NS_PRECONDITION(fatalError != nsnull, "null ptr");
if (!pSource || !pDestination || !fatalError)
return NS_ERROR_NULL_POINTER;
nsString success;
nsString error;
if (!pSource || !pDestination || !fatalError) {
nsOEStringBundle::GetStringByID( OEIMPORT_MAILBOX_BADPARAM, error);
if (fatalError)
*fatalError = PR_TRUE;
SetLogs( success, error, pErrorLog, pSuccessLog);
return NS_ERROR_NULL_POINTER;
}
PRBool abort = PR_FALSE;
nsString name;
@ -366,11 +422,15 @@ NS_IMETHODIMP ImportMailImpl::ImportMailbox( nsIImportMailboxDescriptor *pSource
PRUint32 mailSize = 0;
pSource->GetSize( &mailSize);
if (mailSize == 0) {
ReportSuccess( name, 0, &success);
SetLogs( success, error, pErrorLog, pSuccessLog);
return( NS_OK);
}
nsIFileSpec * inFile;
if (NS_FAILED( pSource->GetFileSpec( &inFile))) {
ReportError( OEIMPORT_MAILBOX_BADSOURCEFILE, name, &error);
SetLogs( success, error, pErrorLog, pSuccessLog);
return( NS_ERROR_FAILURE);
}
@ -381,13 +441,14 @@ NS_IMETHODIMP ImportMailImpl::ImportMailbox( nsIImportMailboxDescriptor *pSource
nsCRT::free( pPath);
#endif
PRInt32 msgCount = 0;
nsresult rv;
if (nsOE5File::IsLocalMailFile( inFile)) {
IMPORT_LOG1( "Importing OE5 mailbox: %S!\n", name.GetUnicode());
rv = nsOE5File::ImportMailbox( &abort, name, inFile, pDestination);
rv = nsOE5File::ImportMailbox( &abort, name, inFile, pDestination, &msgCount);
}
else {
if (CImportMailbox::ImportMailbox( &abort, name, inFile, pDestination)) {
if (CImportMailbox::ImportMailbox( &abort, name, inFile, pDestination, &msgCount)) {
rv = NS_OK;
}
else {
@ -397,6 +458,15 @@ NS_IMETHODIMP ImportMailImpl::ImportMailbox( nsIImportMailboxDescriptor *pSource
inFile->Release();
if (NS_SUCCEEDED( rv)) {
ReportSuccess( name, msgCount, &success);
}
else {
ReportError( OEIMPORT_MAILBOX_CONVERTERROR, name, &error);
}
SetLogs( success, error, pErrorLog, pSuccessLog);
return( rv);
}
@ -413,16 +483,6 @@ NS_IMETHODIMP ImportMailImpl::GetImportProgress( PRUint32 *pDoneSoFar)
return( NS_OK);
}
NS_IMETHODIMP ImportMailImpl::GetErrorString( PRUnichar **pDisplayError)
{
NS_PRECONDITION(pDisplayError != nsnull, "null ptr");
if (! pDisplayError)
return NS_ERROR_NULL_POINTER;
*pDisplayError = nsnull;
return( NS_ERROR_FAILURE);
}
nsresult ImportAddressImpl::Create(nsIImportAddressBooks** aImport)
@ -527,8 +587,8 @@ NS_IMETHODIMP ImportAddressImpl::FindAddressBooks(nsIFileSpec *location, nsISupp
NS_IMETHODIMP ImportAddressImpl::ImportAddressBook( nsIImportABDescriptor *source,
nsIAddrDatabase * destination,
nsISupports * fieldMap,
nsIOutputStream * errorLog,
nsIOutputStream * successLog,
PRUnichar ** errorLog,
PRUnichar ** successLog,
PRBool * fatalError)
{
NS_PRECONDITION(source != nsnull, "null ptr");

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

@ -42,6 +42,8 @@ private:
PRBool CopyMbxFileBytes( PRUint32 numBytes);
PRBool IsFromLineKey( PRUint8 *pBuf, PRUint32 max);
public:
PRInt32 m_msgCount;
protected:
nsString m_name;
@ -84,7 +86,7 @@ private:
};
PRBool CImportMailbox::ImportMailbox( PRBool *pAbort, nsString& name, nsIFileSpec * inFile, nsIFileSpec * outFile)
PRBool CImportMailbox::ImportMailbox( PRBool *pAbort, nsString& name, nsIFileSpec * inFile, nsIFileSpec * outFile, PRInt32 *pCount)
{
PRBool done = PR_FALSE;
nsIFileSpec *idxFile;
@ -100,8 +102,11 @@ PRBool CImportMailbox::ImportMailbox( PRBool *pAbort, nsString& name, nsIFileSpe
CIndexScanner *pIdxScanner = new CIndexScanner( name, idxFile, inFile, outFile);
if (pIdxScanner->Initialize()) {
if (pIdxScanner->DoWork( pAbort))
if (pIdxScanner->DoWork( pAbort)) {
done = PR_TRUE;
if (pCount)
*pCount = pIdxScanner->m_msgCount;
}
else {
IMPORT_LOG0( "CIndexScanner::DoWork() failed\n");
}
@ -117,15 +122,18 @@ PRBool CImportMailbox::ImportMailbox( PRBool *pAbort, nsString& name, nsIFileSpe
if (done)
return( done);
/*
something went wrong with the index file, just scan the mailbox
file itself.
*/
CMbxScanner *pMbx = new CMbxScanner( name, inFile, outFile);
if (pMbx->Initialize()) {
if (pMbx->DoWork( pAbort))
if (pMbx->DoWork( pAbort)) {
done = PR_TRUE;
if (pCount)
*pCount = pMbx->m_msgCount;
}
else {
IMPORT_LOG0( "CMbxScanner::DoWork() failed\n");
}
@ -170,164 +178,6 @@ PRBool CImportMailbox::GetIndexFile( nsIFileSpec* file)
return( PR_FALSE);
}
/* Find out if there is a matching index file.
BOOL CImportMail::GetIndexFile( UFileLocation& mbxToIdx)
{
CString ext;
ext.LoadString( IDS_OUTLOOK_IDX_EXTENSION);
mbxToIdx.ReplaceExtension( ext);
return( mbxToIdx.FileExists());
}
*/
/*
How to drive the scanners, special note that
if the idx scanner fails, we can try the mbx scanner
to see if it works.
BOOL CImportMail::DoIdleWork( BOOL *pDone)
{
BOOL result;
*pDone = FALSE;
switch( m_state) {
case kStartState:
CalculateSizes();
m_state = kDoMailbox;
break;
case kDoMailbox:
if (!PrepMailboxImport( TRUE)) {
m_state = kMbxErrorState;
}
break;
case kScanIdx:
if (m_pIdxScanner) {
if (!m_pIdxScanner->DoWork( pDone)) {
// if the error was fatal then abort
*pDone = FALSE;
if (m_pIdxScanner->WasErrorFatal())
m_state = kMbxErrorState;
else
m_state = kPrepScanMbx;
delete m_pIdxScanner;
m_pIdxScanner = NULL;
}
else
m_bytesDone += m_pIdxScanner->BytesProcessed();
if (*pDone) {
delete m_pIdxScanner;
m_pIdxScanner = NULL;
m_state = kNextMailbox;
*pDone = FALSE;
}
}
else // should never get here
m_state = kAllDone;
break;
case kPrepScanMbx:
if (!PrepMailboxImport( FALSE))
m_state = kMbxErrorState;
break;
case kScanMbx:
if (m_pMbxScanner) {
result = m_pMbxScanner->DoWork( pDone);
m_bytesDone += m_pMbxScanner->BytesProcessed();
if (!result || *pDone) {
*pDone = FALSE;
delete m_pMbxScanner;
m_pMbxScanner = NULL;
if (!result)
m_state = kMbxErrorState;
else
m_state = kNextMailbox;
}
}
else // should never get here
m_state = kAllDone;
break;
case kNextMailbox:
m_bytesDone += kProgressBytesPerFile;
m_curFileIndex++;
if (m_curFileIndex >= m_pDst->GetSize()) {
// successful completion...
m_bDeleteWork = FALSE;
m_bytesDone = m_totalBytes;
m_state = kAllDone;
}
else
m_state = kDoMailbox;
break;
case kMbxErrorState:
if (ReportMbxError())
m_state = kNextMailbox;
else
return( FALSE);
break;
default:
*pDone = TRUE;
}
return( TRUE);
}
*/
/*
The basic scheme is to prep, the either do the idxscanner or mbxscanner
depending upon which was available. All fo this can be moved into a routine
that just does it sequentially since our new concept is threads!
BOOL CImportMail::PrepMailboxImport( BOOL prepIdx)
{
// given the current source index
// set up to scan either the idx file or the mbx file...
UFileLocation src;
UFileLocation srcIdx;
UFileLocation dst;
CString name;
m_pSrc->GetAt( m_curFileIndex, src);
m_pDst->GetAt( m_curFileIndex, dst);
name = m_pNames->GetAt( m_curFileIndex);
srcIdx = src;
BOOL doIdx = FALSE;
if (prepIdx && GetIndexFile( srcIdx)) {
m_pIdxScanner = new CIndexScanner( name, srcIdx, src, dst);
if (m_pIdxScanner->Initialize()) {
doIdx = TRUE;
m_state = kScanIdx;
}
else {
delete m_pIdxScanner;
m_pIdxScanner = NULL;
}
}
if (!doIdx) {
// blow off the index and go straight to the mbx file...
m_pMbxScanner = new CMbxScanner( name, src, dst);
if (m_pMbxScanner->Initialize()) {
m_state = kScanMbx;
}
else {
delete m_pMbxScanner;
m_pMbxScanner = NULL;
m_state = kMbxErrorState;
}
}
return( TRUE);
}
*/
const char *CMbxScanner::m_pFromLine = "From ????@???? 1 Jan 1965 00:00:00\x0D\x0A";
// let's try a 16K buffer and see how well that works?
@ -336,6 +186,7 @@ const char *CMbxScanner::m_pFromLine = "From ????@???? 1 Jan 1965 00:00:00\x0D\x
CMbxScanner::CMbxScanner( nsString& name, nsIFileSpec* mbxFile, nsIFileSpec* dstFile)
{
m_msgCount = 0;
m_name = name;
m_mbxFile = mbxFile;
m_mbxFile->AddRef();
@ -362,23 +213,11 @@ CMbxScanner::~CMbxScanner()
void CMbxScanner::ReportWriteError( nsIFileSpec * file, PRBool fatal)
{
m_fatalError = fatal;
/*
CString path;
file.GetTextPath( path);
UDialogs::ErrMessage1( IDS_FILE_WRITE_ERROR, path);
*/
// FIXME: We should log errors of this kind?
}
void CMbxScanner::ReportReadError( nsIFileSpec * file, PRBool fatal)
{
m_fatalError = fatal;
/*
CString path;
file.GetTextPath( path);
UDialogs::ErrMessage1( IDS_FILE_READ_ERROR, path);
*/
// FIXME: We should log errors of this kind?
}
PRBool CMbxScanner::Initialize( void)
@ -387,21 +226,17 @@ PRBool CMbxScanner::Initialize( void)
m_pInBuffer = new PRUint8[m_bufSz];
m_pOutBuffer = new PRUint8[m_bufSz];
if (!m_pInBuffer || !m_pOutBuffer) {
// UDialogs::ErrMessage0( IDS_NO_MEMORY);
// FIXME: Log the error message?
return( PR_FALSE);
}
m_mbxFile->GetFileSize( &m_mbxFileSize);
// open the mailbox file...
if (NS_FAILED( m_mbxFile->OpenStreamForReading())) {
// FIXME: Log the error?
CleanUp();
return( PR_FALSE);
}
if (NS_FAILED( m_dstFile->OpenStreamForWriting())) {
// FIXME: Log the error?
CleanUp();
return( PR_FALSE);
}
@ -427,6 +262,7 @@ PRBool CMbxScanner::DoWork( PRBool *pAbort)
}
m_mbxOffset += msgSz;
m_didBytes += msgSz;
m_msgCount++;
}
CleanUp();
@ -467,24 +303,20 @@ PRBool CMbxScanner::WriteMailItem( PRUint32 flags, PRUint32 offset, PRUint32 siz
m_mbxFile->Failed( &failed);
if (NS_FAILED( rv) || failed) {
// FIXME: Log errors?
// TRACE1( "Mbx seek error: 0x%lx\n", offset);
IMPORT_LOG1( "Mbx seek error: 0x%lx\n", offset);
return( PR_FALSE);
}
rv = m_mbxFile->Read( (char **) &pChar, cnt, &cntRead);
if (NS_FAILED( rv) || (cntRead != cnt)) {
// FIXME: Log errors?
// TRACE1( "Mbx read error at: 0x%lx\n", offset);
IMPORT_LOG1( "Mbx read error at: 0x%lx\n", offset);
return( PR_FALSE);
}
if (values[0] != 0x7F007F00) {
// FIXME: Log errors?
// TRACE2( "Mbx tag field doesn't match: 0x%lx, at offset: 0x%lx\n", values[0], offset);
IMPORT_LOG2( "Mbx tag field doesn't match: 0x%lx, at offset: 0x%lx\n", values[0], offset);
return( PR_FALSE);
}
if (size && (values[2] != size)) {
// FIXME: Log errors?
// TRACE3( "Mbx size doesn't match idx, mbx: %ld, idx: %ld, at offset: 0x%lx\n", values[2], size, offset);
IMPORT_LOG3( "Mbx size doesn't match idx, mbx: %ld, idx: %ld, at offset: 0x%lx\n", values[2], size, offset);
return( PR_FALSE);
}
@ -665,7 +497,6 @@ PRBool CIndexScanner::Initialize( void)
nsresult rv = m_idxFile->OpenStreamForReading();
if (NS_FAILED( rv)) {
// FIXME: Log the error?
CleanUp();
return( PR_FALSE);
}
@ -694,7 +525,7 @@ PRBool CIndexScanner::ValidateIdxFile( void)
if (NS_FAILED( rv) || (cntRead != cnt))
return( PR_FALSE);
if (subId != 0x00010004) {
// TRACE1( "Idx file subid doesn't match: 0x%lx\n", subId);
IMPORT_LOG1( "Idx file subid doesn't match: 0x%lx\n", subId);
return( PR_FALSE);
}
@ -703,7 +534,7 @@ PRBool CIndexScanner::ValidateIdxFile( void)
if (NS_FAILED( rv) || (cntRead != cnt))
return( PR_FALSE);
// TRACE1( "Idx file num messages: %ld\n", m_numMessages);
IMPORT_LOG1( "Idx file num messages: %ld\n", m_numMessages);
m_didBytes += 80;
m_idxOffset = 80;
@ -745,7 +576,7 @@ PRBool CIndexScanner::GetMailItem( PRUint32 *pFlags, PRUint32 *pOffset, PRUint32
return( PR_FALSE);
if (values[3] != m_idxOffset) {
// TRACE2( "Self pointer invalid: m_idxOffset=0x%lx, self=0x%lx\n", m_idxOffset, values[3]);
IMPORT_LOG2( "Self pointer invalid: m_idxOffset=0x%lx, self=0x%lx\n", m_idxOffset, values[3]);
return( PR_FALSE);
}
@ -792,12 +623,14 @@ PRBool CIndexScanner::DoWork( PRBool *pAbort)
return( PR_FALSE);
}
m_curItemIndex++;
if (!(flags & kOEDeletedFlag))
if (!(flags & kOEDeletedFlag)) {
if (!WriteMailItem( flags, offset, size))
failed = PR_TRUE;
else {
m_didBytes += size;
else {
m_msgCount++;
}
}
m_didBytes += size;
}
CleanUp();

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

@ -26,7 +26,7 @@
class CImportMailbox {
public:
static PRBool ImportMailbox( PRBool *pAbort, nsString& name, nsIFileSpec * inFile, nsIFileSpec * outFile);
static PRBool ImportMailbox( PRBool *pAbort, nsString& name, nsIFileSpec * inFile, nsIFileSpec * outFile, PRInt32 *pCount);
private:
static PRBool GetIndexFile( nsIFileSpec* mbxFile);

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

@ -38,7 +38,7 @@
#include "nsMsgCompCID.h"
#include "nsISmtpService.h"
#include "nsISmtpServer.h"
#include "nsOEStringBundle.h"
#include "OEDebugLog.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -99,8 +99,7 @@ NS_IMETHODIMP nsOESettings::AutoLocate(PRUnichar **description, nsIFileSpec **lo
if (!description || !_retval)
return( NS_ERROR_NULL_POINTER);
nsString desc = "Outlook Express";
*description = nsCRT::strdup( desc.GetUnicode());
*description = nsOEStringBundle::GetStringByID( OEIMPORT_NAME);
*_retval = PR_FALSE;
if (location)
@ -326,8 +325,12 @@ PRBool OESettings::DoIMAPServer( nsIMsgAccountManager *pMgr, HKEY hKey, char *pS
// Create the incoming server and an account for it?
rv = pMgr->CreateIncomingServer( "imap", getter_AddRefs( in));
if (NS_SUCCEEDED( rv) && in) {
rv = in->SetType( "imap");
rv = in->SetHostName( pServerName);
rv = in->SetUsername( (char *)pBytes);
IMPORT_LOG2( "Created IMAP server named: %s, userName: %s\n", pServerName, (char *)pBytes);
BYTE *pAccName = nsOERegUtil::GetValueBytes( hKey, "Account Name");
nsString prettyName;
if (pAccName) {
@ -338,6 +341,9 @@ PRBool OESettings::DoIMAPServer( nsIMsgAccountManager *pMgr, HKEY hKey, char *pS
prettyName = (const char *)pServerName;
PRUnichar *pretty = prettyName.ToNewUnicode();
IMPORT_LOG1( "\tSet pretty name to: %S\n", pretty);
rv = in->SetPrettyName( pretty);
nsCRT::free( pretty);
@ -346,6 +352,9 @@ PRBool OESettings::DoIMAPServer( nsIMsgAccountManager *pMgr, HKEY hKey, char *pS
rv = pMgr->CreateAccount( getter_AddRefs( account));
if (NS_SUCCEEDED( rv) && account) {
rv = account->SetIncomingServer( in);
IMPORT_LOG0( "Created an account and set the IMAP server as the incoming server\n");
// Fiddle with the identities
SetIdentities( pMgr, account, hKey);
result = PR_TRUE;
@ -381,8 +390,12 @@ PRBool OESettings::DoPOP3Server( nsIMsgAccountManager *pMgr, HKEY hKey, char *pS
// Create the incoming server and an account for it?
rv = pMgr->CreateIncomingServer( "pop3", getter_AddRefs( in));
if (NS_SUCCEEDED( rv) && in) {
rv = in->SetType( "pop3");
rv = in->SetHostName( pServerName);
rv = in->SetUsername( (char *)pBytes);
IMPORT_LOG2( "Created POP3 server named: %s, userName: %s\n", pServerName, (char *)pBytes);
BYTE *pAccName = nsOERegUtil::GetValueBytes( hKey, "Account Name");
nsString prettyName;
if (pAccName) {
@ -393,6 +406,9 @@ PRBool OESettings::DoPOP3Server( nsIMsgAccountManager *pMgr, HKEY hKey, char *pS
prettyName = (const char *)pServerName;
PRUnichar *pretty = prettyName.ToNewUnicode();
IMPORT_LOG1( "\tSet pretty name to: %S\n", pretty);
rv = in->SetPrettyName( pretty);
nsCRT::free( pretty);
@ -400,7 +416,10 @@ PRBool OESettings::DoPOP3Server( nsIMsgAccountManager *pMgr, HKEY hKey, char *pS
nsCOMPtr<nsIMsgAccount> account;
rv = pMgr->CreateAccount( getter_AddRefs( account));
if (NS_SUCCEEDED( rv) && account) {
rv = account->SetIncomingServer( in);
rv = account->SetIncomingServer( in);
IMPORT_LOG0( "Created a new account and set the incoming server to the POP3 server.\n");
// Fiddle with the identities
SetIdentities( pMgr, account, hKey);
result = PR_TRUE;
@ -479,6 +498,10 @@ void OESettings::SetIdentities( nsIMsgAccountManager *pMgr, nsIMsgAccount *pAcc,
if (pReply)
id->SetReplyTo( pReply);
pAcc->AddIdentity( id);
IMPORT_LOG0( "Created identity and added to the account\n");
IMPORT_LOG1( "\tname: %s\n", pName);
IMPORT_LOG1( "\temail: %s\n", pEmail);
}
}
@ -495,18 +518,28 @@ void OESettings::SetSmtpServer( nsIMsgAccountManager *pMgr, nsIMsgAccount *pAcc,
{
nsresult rv;
/*
NS_WITH_SERVICE(nsISmtpService, smtpService, kSmtpServiceCID, &rv);
if (NS_SUCCEEDED(rv) && smtpService) {
nsCOMPtr<nsISmtpServer> smtpServer;
nsCOMPtr<nsISmtpServer> foundServer;
rv = smtpService->FindServer( pServer, getter_AddRefs( foundServer));
if (NS_SUCCEEDED( rv) && foundServer) {
IMPORT_LOG1( "SMTP server already exists: %s\n", pServer);
return;
}
nsCOMPtr<nsISmtpServer> smtpServer;
rv = smtpService->CreateSmtpServer( getter_AddRefs( smtpServer));
if (NS_SUCCEEDED( rv) && smtpServer) {
smtpServer->SetHostname( pServer);
smtpServer->SetUsername( pUser);
if (pUser)
smtpServer->SetUsername( pUser);
IMPORT_LOG1( "Created new SMTP server: %s\n", pServer);
}
}
*/
/*
nsXPIDLCString hostName;
nsXPIDLCString senderName;

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

@ -0,0 +1,81 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "prprf.h"
#include "prmem.h"
#include "nsCOMPtr.h"
#include "nsIStringBundle.h"
#include "nsOEStringBundle.h"
#include "nsIServiceManager.h"
#include "nsIURI.h"
/* This is the next generation string retrieval call */
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
#define OE_MSGS_URL "chrome://messenger/locale/oeImportMsgs.properties"
nsIStringBundle *nsOEStringBundle::GetStringBundle( void)
{
nsresult rv;
char* propertyURL = OE_MSGS_URL;
nsIStringBundle* sBundle = nsnull;
NS_WITH_SERVICE(nsIStringBundleService, sBundleService, kStringBundleServiceCID, &rv);
if (NS_SUCCEEDED(rv) && (nsnull != sBundleService)) {
nsILocale * locale = nsnull;
rv = sBundleService->CreateBundle(propertyURL, locale, &sBundle);
}
return( sBundle);
}
void nsOEStringBundle::GetStringByID( PRInt32 stringID, nsString& result, nsIStringBundle *pBundle)
{
PRUnichar *ptrv = GetStringByID( stringID, pBundle);
result = ptrv;
FreeString( ptrv);
}
PRUnichar *nsOEStringBundle::GetStringByID(PRInt32 stringID, nsIStringBundle *pBundle)
{
PRBool mine = PR_FALSE;
if (!pBundle) {
mine = PR_TRUE;
pBundle = GetStringBundle();
}
if (pBundle) {
PRUnichar *ptrv = nsnull;
nsresult rv = pBundle->GetStringFromID(stringID, &ptrv);
if (mine) {
NS_RELEASE(pBundle);
}
if (NS_SUCCEEDED( rv) && ptrv)
return( ptrv);
}
nsString resultString( "[StringID ");
resultString.Append(stringID, 10);
resultString += "?]";
return( resultString.ToNewUnicode());
}

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

@ -0,0 +1,46 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _nsOEStringBundle_H__
#define _nsOEStringBundle_H__
#include "nsCRT.h"
#include "nsString.h"
class nsIStringBundle;
class nsOEStringBundle {
public:
static PRUnichar * GetStringByID(PRInt32 stringID, nsIStringBundle *pBundle = nsnull);
static void GetStringByID(PRInt32 stringID, nsString& result, nsIStringBundle *pBundle = nsnull);
// GetStringBundle creates a new one every time!
static nsIStringBundle * GetStringBundle( void);
static void FreeString( PRUnichar *pStr) { nsCRT::free( pStr);}
};
#define OEIMPORT_NAME 2000
#define OEIMPORT_DESCRIPTION 2001
#define OEIMPORT_MAILBOX_SUCCESS 2002
#define OEIMPORT_MAILBOX_BADPARAM 2003
#define OEIMPORT_MAILBOX_BADSOURCEFILE 2004
#define OEIMPORT_MAILBOX_CONVERTERROR 2005
#endif /* _nsOEStringBundle_H__ */

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

@ -0,0 +1,27 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1999 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..\..\..
include <$(DEPTH)\config\rules.mak>
install::
$(MAKE_INSTALL) oeImportMsgs.properties $(DIST)\bin\chrome\messenger\locale\en-US
clobber::
rm -f $(DIST)bin\chrome\messenger\locale\en-US\oeImportMsgs.properties

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

@ -0,0 +1,56 @@
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# The following are used by the outlook express import code to display status/error
# and informational messages
#
# Short name of import module
## @name OEIMPORT_NAME
## @loc None
2000=Outlook Express
# Description of import module
## @name OEIMPORT_DESCRIPTION
## @loc None
2001=Outlook Express mail and address books
# Success message
## @name OEIMPORT_MAILBOX_SUCCESS
## @loc None
2002=Mailbox %S, imported %d messages
# Error message
## @name OEIMPORT_MAILBOX_BADPARAM
## @loc None
2003=Bad parameter passed to import mailbox.
# Error message
## @name OEIMPORT_MAILBOX_BADSOURCEFILE
## @loc None
2004=Error accessing file for mailbox %S.
# Error message
## @name OEIMPORT_MAILBOX_CONVERTERROR
## @loc None
2005=Error importing mailbox %S, all messages may not be imported from this mailbox.

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

@ -0,0 +1,22 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1999 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..\..
DIRS= en-US
include <$(DEPTH)\config\rules.mak>

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

@ -0,0 +1,22 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1999 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..
DIRS= locale
include <$(DEPTH)\config\rules.mak>

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

@ -121,8 +121,8 @@ interface nsIImportAddressBooks : nsISupports
void ImportAddressBook( in nsIImportABDescriptor source,
in nsIAddrDatabase destination,
in nsISupports fieldMap,
in nsIOutputStream errorLog,
in nsIOutputStream successLog,
out wstring errorLog,
out wstring successLog,
out boolean fatalError);
/*

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

@ -26,7 +26,7 @@
interface nsIImportDriver;
interface nsIDOMWindow;
interface nsIOutputStream;
interface nsISupportsWString;
[scriptable, uuid(9b5c20c0-2348-11d3-a206-00a0cc26da63)]
interface nsIImportGeneric : nsISupports
@ -83,7 +83,7 @@ interface nsIImportGeneric : nsISupports
failure of the import. Failure can be reported even if WantsProgress
returned TRUE.
*/
boolean BeginImport( in nsIOutputStream successLog, in nsIOutputStream errorLog);
boolean BeginImport( in nsISupportsWString successLog, in nsISupportsWString errorLog);
/*
If WantsProgress returned TRUE then this will indicate if the import should
continue. If this returns FALSE then no other methods should be called

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

@ -80,8 +80,8 @@ interface nsIImportMail : nsISupports
*/
void ImportMailbox( in nsIImportMailboxDescriptor source,
in nsIFileSpec destination,
in nsIOutputStream errorLog,
in nsIOutputStream successLog,
out wstring errorLog,
out wstring successLog,
out boolean fatalError);
/*

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

@ -2,7 +2,30 @@
<body>
<script language="javascript">
var intervalState = null;
var importMailInterface = null;
function ContinueMailImport() {
clear = true;
if (importMailInterface) {
if (importMailInterface.ContinueImport() && (importMailInterface.GetProgress() < 100)) {
clear = false;
dump( ".");
}
}
if (clear == true) {
clearInterval( intervalState);
intervalState = null;
importMailInterface = null;
}
}
function test1() {
if (importMailInterface || intervalState) {
dump( "Already importing mail, wait till this one is done!\n");
return;
}
dump( "test1\n");
dump( "Loading outlook express component\n");
var module = Components.classes["component://mozilla/import/import-oe"].createInstance();
@ -25,14 +48,10 @@ function test1() {
if (mailInterface.BeginImport( null, null)) {
var count = 0;
dump( "Importing ");
while (mailInterface.ContinueImport() && (mailInterface.GetProgress() < 100)) {
count = count + 1;
if (count > 100) {
dump( ".");
count = 0;
}
}
dump( "\nImport finished\n");
importMailInterface = mailInterface;
intervalState = setInterval( "ContinueMailImport()", 100);
dump( "\nWaiting for import to finish.....\n");
}
else {
dump( "BeginImport returned failure\n");

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

@ -0,0 +1,83 @@
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# The following are used by the outlook express import code to display status/error
# and informational messages
#
# Success message when no address books are found to import
## @name IMPORT_NO_ADDRBOOKS
## @loc None
2000=No address books were found to import
# Error: Address book import not intialized
## @name IMPORT_ERROR_AB_NOTINITIALIZED
## @loc None
2001=Unable to import address books, initialization error
# Error: Unable to create the import thread
## @name IMPORT_ERROR_AB_NOTHREAD
## @loc None
2002=Unable to import address books, cannot create import thread
# Error: Unable to create the import thread
## @name IMPORT_ERROR_GETABOOK
## @loc None
2003=Error importing %S, unable to create address book
# Success message when no mailboxes are found to import
## @name IMPORT_NO_MAILBOXES
## @loc None
2004=No mailboxes were found to import
# Error: Mailbox import not intialized
## @name IMPORT_ERROR_MB_NOTINITIALIZED
## @loc None
2005=Unable to import mailboxes, initialization error
# Error: Unable to create the import thread
## @name IMPORT_ERROR_MB_NOTHREAD
## @loc None
2006=Unable to import mailboxes, cannot create import thread
# Error: Unable to create the proxy object for importing mailboxes
## @name IMPORT_ERROR_MB_NOPROXY
## @loc None
2007=Unable to import mailboxes, cannot create proxy object for destination mailboxes
# Error: Error creating destination mailboxes
## @name IMPORT_ERROR_MB_FINDCHILD
## @loc None
2008=Error creating destination mailboxes, cannot find mailbox %S
# Error: Error creating destination mailboxes
## @name IMPORT_ERROR_MB_CREATE
## @loc None
2009=Error importing mailbox %S, unable to create destination mailbox
# Error: No destination account to import mailboxes
## @name IMPORT_ERROR_MB_NODESTFOLDER
## @loc None
2010=Unable to create an account to import mail into

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

@ -0,0 +1,27 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1999 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..\..
include <$(DEPTH)\config\rules.mak>
install::
$(MAKE_INSTALL) importMsgs.properties $(DIST)\bin\chrome\messenger\locale\en-US
clobber::
rm -f $(DIST)bin\chrome\messenger\locale\en-US\importMsgs.properties

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

@ -0,0 +1,22 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1999 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..
DIRS= en-US
include <$(DEPTH)\config\rules.mak>

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

@ -17,6 +17,6 @@
DEPTH=..\..\..
DIRS= content
DIRS= content locale
include <$(DEPTH)\config\rules.mak>

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

@ -30,6 +30,7 @@ CPP_OBJS=\
.\$(OBJDIR)\nsImportMailboxDescriptor.obj \
.\$(OBJDIR)\nsImportABDescriptor.obj \
.\$(OBJDIR)\nsImportAddressBooks.obj \
.\$(OBJDIR)\nsImportStringBundle.obj \
$(NULL)
LLIBS=\

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

@ -23,7 +23,7 @@
#include "nsISupportsArray.h"
#include "nsIImportAddressBooks.h"
#include "nsIImportGeneric.h"
#include "nsIOutputStream.h"
#include "nsISupportsPrimitives.h"
#include "nsIImportABDescriptor.h"
#include "nsCRT.h"
#include "nsString.h"
@ -39,6 +39,8 @@
#include "nsRDFCID.h"
#include "nsAbBaseCID.h"
#include "nsIAbDirectory.h"
#include "nsImportStringBundle.h"
#include "nsTextFormater.h"
#include "ImportDebug.h"
static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRESSBOOKDB_CID);
@ -82,7 +84,7 @@ public:
NS_IMETHOD WantsProgress(PRBool *_retval);
/* boolean BeginImport (in nsIOutputStream successLog, in nsIOutputStream errorLog); */
NS_IMETHOD BeginImport(nsIOutputStream *successLog, nsIOutputStream *errorLog, PRBool *_retval);
NS_IMETHOD BeginImport(nsISupportsWString *successLog, nsISupportsWString *errorLog, PRBool *_retval);
/* boolean ContinueImport (); */
NS_IMETHOD ContinueImport(PRBool *_retval);
@ -97,6 +99,10 @@ private:
void GetDefaultLocation( void);
void GetDefaultBooks( void);
public:
static void SetLogs( nsString& success, nsString& error, nsISupportsWString *pSuccess, nsISupportsWString *pError);
static void ReportError( PRUnichar *pName, nsString *pStream);
private:
nsIImportAddressBooks * m_pInterface;
nsISupportsArray * m_pBooks;
@ -106,8 +112,8 @@ private:
PRBool m_gotLocation;
PRBool m_found;
PRBool m_userVerify;
nsIOutputStream * m_pSuccessLog;
nsIOutputStream * m_pErrorLog;
nsISupportsWString * m_pSuccessLog;
nsISupportsWString * m_pErrorLog;
PRUint32 m_totalSize;
PRBool m_doImport;
AddressThreadData * m_pThreadData;
@ -124,8 +130,8 @@ public:
PRUint32 currentSize;
nsISupportsArray * books;
nsIImportAddressBooks * addressImport;
nsIOutputStream * successLog;
nsIOutputStream * errorLog;
nsISupportsWString * successLog;
nsISupportsWString * errorLog;
char * pDestinationUri;
AddressThreadData();
@ -437,19 +443,56 @@ NS_IMETHODIMP nsImportGenericAddressBooks::WantsProgress(PRBool *_retval)
return( NS_OK);
}
void nsImportGenericAddressBooks::SetLogs( nsString& success, nsString& error, nsISupportsWString *pSuccess, nsISupportsWString *pError)
{
nsString str;
PRUnichar * pStr = nsnull;
if (pSuccess) {
pSuccess->GetData( &pStr);
if (pStr) {
str = pStr;
nsCRT::free( pStr);
pStr = nsnull;
str.Append( success);
pSuccess->SetData( str.GetUnicode());
}
else {
pSuccess->SetData( success.GetUnicode());
}
}
if (pError) {
pError->GetData( &pStr);
if (pStr) {
str = pStr;
nsCRT::free( pStr);
str.Append( error);
pError->SetData( str.GetUnicode());
}
else {
pError->SetData( error.GetUnicode());
}
}
}
NS_IMETHODIMP nsImportGenericAddressBooks::BeginImport(nsIOutputStream *successLog, nsIOutputStream *errorLog, PRBool *_retval)
NS_IMETHODIMP nsImportGenericAddressBooks::BeginImport(nsISupportsWString *successLog, nsISupportsWString *errorLog, PRBool *_retval)
{
NS_PRECONDITION(_retval != nsnull, "null ptr");
if (!_retval)
return NS_ERROR_NULL_POINTER;
nsString success;
nsString error;
if (!m_doImport) {
*_retval = PR_TRUE;
nsImportStringBundle::GetStringByID( IMPORT_NO_ADDRBOOKS, success);
SetLogs( success, error, successLog, errorLog);
return( NS_OK);
}
if (!m_pInterface || !m_pBooks) {
nsImportStringBundle::GetStringByID( IMPORT_ERROR_AB_NOTINITIALIZED, error);
SetLogs( success, error, successLog, errorLog);
*_retval = PR_FALSE;
return( NS_OK);
}
@ -490,6 +533,8 @@ NS_IMETHODIMP nsImportGenericAddressBooks::BeginImport(nsIOutputStream *successL
m_pThreadData->DriverDelete();
m_pThreadData = nsnull;
*_retval = PR_FALSE;
nsImportStringBundle::GetStringByID( IMPORT_ERROR_AB_NOTHREAD, error);
SetLogs( success, error, successLog, errorLog);
}
else
*_retval = PR_TRUE;
@ -727,6 +772,19 @@ nsIAddrDatabase *GetAddressBook( const PRUnichar *name, PRBool makeNew)
*/
}
void nsImportGenericAddressBooks::ReportError( PRUnichar *pName, nsString *pStream)
{
if (!pStream)
return;
// load the error string
PRUnichar *pFmt = nsImportStringBundle::GetStringByID( IMPORT_ERROR_GETABOOK);
PRUnichar *pText = nsTextFormater::smprintf( pFmt, pName);
pStream->Append( pText);
nsTextFormater::smprintf_free( pText);
nsImportStringBundle::FreeString( pFmt);
pStream->Append( NS_LINEBREAK);
}
PR_STATIC_CALLBACK( void) ImportAddressThread( void *stuff)
{
IMPORT_LOG0( "In Begin ImportAddressThread\n");
@ -741,6 +799,9 @@ PR_STATIC_CALLBACK( void) ImportAddressThread( void *stuff)
PRUint32 size;
nsCOMPtr<nsIAddrDatabase> destDB( getter_AddRefs( GetAddressBookFromUri( pData->pDestinationUri)));
nsIAddrDatabase * pDestDB = nsnull;
nsString success;
nsString error;
for (i = 0; (i < count) && !(pData->abort); i++) {
pSupports = pData->books->ElementAt( i);
@ -764,18 +825,32 @@ PR_STATIC_CALLBACK( void) ImportAddressThread( void *stuff)
pDestDB = GetAddressBook( pName, PR_TRUE);
}
nsCRT::free( pName);
PRBool fatalError = PR_FALSE;
pData->currentSize = size;
if (pDestDB) {
PRUnichar *pSuccess = nsnull;
PRUnichar *pError = nsnull;
rv = pData->addressImport->ImportAddressBook( book,
pDestDB, // destination
nsnull, // fieldmap
pData->errorLog,
pData->successLog,
&pError,
&pSuccess,
&fatalError);
if (pSuccess) {
success.Append( pSuccess);
nsCRT::free( pSuccess);
}
if (pError) {
error.Append( pError);
nsCRT::free( pError);
}
}
else {
nsImportGenericAddressBooks::ReportError( pName, &error);
}
nsCRT::free( pName);
pData->currentSize = 0;
pData->currentTotal += size;
@ -790,7 +865,10 @@ PR_STATIC_CALLBACK( void) ImportAddressThread( void *stuff)
}
}
}
nsImportGenericAddressBooks::SetLogs( success, error, pData->successLog, pData->errorLog);
if (pData->abort || pData->fatalError) {
// FIXME: do what is necessary to get rid of what has been imported so far.
// Nothing if we went into an existing address book! Otherwise, delete

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

@ -46,10 +46,12 @@
#include "nsISupportsArray.h"
#include "nsIImportMail.h"
#include "nsIImportGeneric.h"
#include "nsIOutputStream.h"
#include "nsISupportsPrimitives.h"
#include "nsIImportMailboxDescriptor.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsProxyObjectManager.h"
#include "nsXPIDLString.h"
#include "nsIFileSpec.h"
#include "nsIFileLocator.h"
@ -61,6 +63,8 @@
#include "nsPOP3IncomingServer.h"
#include "nsIProfile.h"
#include "nsIMsgFolder.h"
#include "nsImportStringBundle.h"
#include "nsTextFormater.h"
#include "ImportDebug.h"
@ -70,6 +74,7 @@ static NS_DEFINE_CID(kMsgAccountCID, NS_MSGACCOUNT_CID);
static NS_DEFINE_CID(kMsgIdentityCID, NS_MSGIDENTITY_CID);
static NS_DEFINE_CID(kMsgBiffManagerCID, NS_MSGBIFFMANAGER_CID);
static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID);
static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
////////////////////////////////////////////////////////////////////////
@ -101,7 +106,7 @@ public:
NS_IMETHOD WantsProgress(PRBool *_retval);
/* boolean BeginImport (in nsIOutputStream successLog, in nsIOutputStream errorLog); */
NS_IMETHOD BeginImport(nsIOutputStream *successLog, nsIOutputStream *errorLog, PRBool *_retval);
NS_IMETHOD BeginImport(nsISupportsWString *successLog, nsISupportsWString *errorLog, PRBool *_retval);
/* boolean ContinueImport (); */
NS_IMETHOD ContinueImport(PRBool *_retval);
@ -118,6 +123,11 @@ private:
void GetDefaultMailboxes( void);
void GetDefaultLocation( void);
void GetDefaultDestination( void);
void GetUniquePrettyName( nsIMsgAccountManager *pMgr, nsString& name);
public:
static void SetLogs( nsString& success, nsString& error, nsISupportsWString *pSuccess, nsISupportsWString *pError);
static void ReportError( PRInt32 id, const PRUnichar *pName, nsString *pStream);
private:
PRUnichar * m_pName; // module name that created this interface
@ -130,8 +140,8 @@ private:
PRBool m_userVerify;
nsIImportMail * m_pInterface;
nsISupportsArray * m_pMailboxes;
nsIOutputStream * m_pSuccessLog;
nsIOutputStream * m_pErrorLog;
nsISupportsWString *m_pSuccessLog;
nsISupportsWString *m_pErrorLog;
PRUint32 m_totalSize;
PRBool m_doImport;
ImportThreadData * m_pThreadData;
@ -150,8 +160,8 @@ public:
PRBool ownsAccount;
nsISupportsArray * boxes;
nsIImportMail * mailImport;
nsIOutputStream * successLog;
nsIOutputStream * errorLog;
nsISupportsWString * successLog;
nsISupportsWString * errorLog;
ImportThreadData();
~ImportThreadData();
@ -480,19 +490,34 @@ NS_IMETHODIMP nsImportGenericMail::WantsProgress(PRBool *_retval)
}
NS_IMETHODIMP nsImportGenericMail::BeginImport(nsIOutputStream *successLog, nsIOutputStream *errorLog, PRBool *_retval)
NS_IMETHODIMP nsImportGenericMail::BeginImport(nsISupportsWString *successLog, nsISupportsWString *errorLog, PRBool *_retval)
{
NS_PRECONDITION(_retval != nsnull, "null ptr");
if (!_retval)
return NS_ERROR_NULL_POINTER;
nsString success;
nsString error;
if (!m_doImport) {
nsImportStringBundle::GetStringByID( IMPORT_NO_MAILBOXES, success);
SetLogs( success, error, successLog, errorLog);
*_retval = PR_TRUE;
return( NS_OK);
}
if (!m_pInterface || !m_pMailboxes || !m_pDestFolder) {
if (!m_pInterface || !m_pMailboxes) {
IMPORT_LOG0( "*** Something is not set properly, interface, mailboxes, or destination.\n");
nsImportStringBundle::GetStringByID( IMPORT_ERROR_MB_NOTINITIALIZED, error);
SetLogs( success, error, successLog, errorLog);
*_retval = PR_FALSE;
return( NS_OK);
}
if (!m_pDestFolder) {
IMPORT_LOG0( "*** No import destination.\n");
nsImportStringBundle::GetStringByID( IMPORT_ERROR_MB_NODESTFOLDER, error);
SetLogs( success, error, successLog, errorLog);
*_retval = PR_FALSE;
return( NS_OK);
}
@ -537,6 +562,8 @@ NS_IMETHODIMP nsImportGenericMail::BeginImport(nsIOutputStream *successLog, nsIO
m_pThreadData->DriverAbort();
m_pThreadData = nsnull;
*_retval = PR_FALSE;
nsImportStringBundle::GetStringByID( IMPORT_ERROR_MB_NOTHREAD, error);
SetLogs( success, error, successLog, errorLog);
}
else
*_retval = PR_TRUE;
@ -589,6 +616,50 @@ NS_IMETHODIMP nsImportGenericMail::GetProgress(PRInt32 *_retval)
return( NS_OK);
}
void nsImportGenericMail::ReportError( PRInt32 id, const PRUnichar *pName, nsString *pStream)
{
if (!pStream)
return;
// load the error string
PRUnichar *pFmt = nsImportStringBundle::GetStringByID( id);
PRUnichar *pText = nsTextFormater::smprintf( pFmt, pName);
pStream->Append( pText);
nsTextFormater::smprintf_free( pText);
nsImportStringBundle::FreeString( pFmt);
pStream->Append( NS_LINEBREAK);
}
void nsImportGenericMail::SetLogs( nsString& success, nsString& error, nsISupportsWString *pSuccess, nsISupportsWString *pError)
{
nsString str;
PRUnichar * pStr = nsnull;
if (pSuccess) {
pSuccess->GetData( &pStr);
if (pStr) {
str = pStr;
nsCRT::free( pStr);
pStr = nsnull;
str.Append( success);
pSuccess->SetData( str.GetUnicode());
}
else {
pSuccess->SetData( success.GetUnicode());
}
}
if (pError) {
pError->GetData( &pStr);
if (pStr) {
str = pStr;
nsCRT::free( pStr);
str.Append( error);
pError->SetData( str.GetUnicode());
}
else {
pError->SetData( error.GetUnicode());
}
}
}
NS_IMETHODIMP nsImportGenericMail::CancelImport(void)
{
@ -686,11 +757,29 @@ ImportMailThread( void *stuff)
char * pStr;
nsCOMPtr<nsIMsgFolder> curFolder( destRoot);
nsCOMPtr<nsIMsgFolder> curProxy;
nsCOMPtr<nsIMsgFolder> newFolder;
nsCOMPtr<nsIFileSpec> outBox;
nsCOMPtr<nsISupports> subFolder;
PRBool exists;
nsString success;
nsString error;
// Initialize the curFolder proxy object
NS_WITH_SERVICE( nsIProxyObjectManager, proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = proxyMgr->GetProxyObject( nsnull, nsIMsgFolder::GetIID(),
curFolder, PROXY_SYNC, getter_AddRefs( curProxy));
IMPORT_LOG1( "Proxy result for curFolder: 0x%lx\n", rv);
}
else {
IMPORT_LOG0( "Unable to obtain proxy service to do import\n");
nsImportStringBundle::GetStringByID( IMPORT_ERROR_MB_NOPROXY, error);
pData->abort = PR_TRUE;
}
for (i = 0; (i < count) && !(pData->abort); i++) {
pSupports = pData->boxes->ElementAt( i);
@ -707,17 +796,38 @@ ImportMailThread( void *stuff)
if (newDepth > depth) {
char * pStr = lastName.ToNewCString();
IMPORT_LOG1( "* Finding folder for child named: %s\n", pStr);
rv = curFolder->GetChildNamed( pStr, getter_AddRefs( subFolder));
rv = curProxy->GetChildNamed( pStr, getter_AddRefs( subFolder));
nsCRT::free( pStr);
curFolder = do_QueryInterface( subFolder);
if (NS_FAILED( rv)) {
nsImportGenericMail::ReportError( IMPORT_ERROR_MB_FINDCHILD, lastName.GetUnicode(), &error);
pData->fatalError = PR_TRUE;
break;
}
rv = proxyMgr->GetProxyObject( nsnull, nsIMsgFolder::GetIID(),
subFolder, PROXY_SYNC, getter_AddRefs( curProxy));
if (NS_FAILED( rv)) {
nsImportStringBundle::GetStringByID( IMPORT_ERROR_MB_NOPROXY, error);
pData->fatalError = PR_TRUE;
break;
}
IMPORT_LOG1( "Created proxy for new subFolder: 0x%lx\n", rv);
}
else if (newDepth < depth) {
while (newDepth < depth) {
rv = NS_OK;
while ((newDepth < depth) && NS_SUCCEEDED( rv)) {
nsCOMPtr<nsIFolder> parFolder;
curFolder->GetParent( getter_AddRefs( parFolder));
curFolder = do_QueryInterface( parFolder);
curProxy->GetParent( getter_AddRefs( parFolder));
rv = proxyMgr->GetProxyObject( nsnull, nsIMsgFolder::GetIID(),
parFolder, PROXY_SYNC, getter_AddRefs( curProxy));
depth--;
}
if (NS_FAILED( rv)) {
nsImportStringBundle::GetStringByID( IMPORT_ERROR_MB_NOPROXY, error);
pData->fatalError = PR_TRUE;
break;
}
}
depth = newDepth;
pName = nsnull;
@ -731,10 +841,10 @@ ImportMailThread( void *stuff)
pStr = lastName.ToNewCString();
exists = PR_FALSE;
rv = curFolder->ContainsChildNamed( pStr, &exists);
rv = curProxy->ContainsChildNamed( pStr, &exists);
if (exists) {
char *pName = nsnull;
curFolder->GenerateUniqueSubfolderName( pStr, nsnull, &pName);
curProxy->GenerateUniqueSubfolderName( pStr, nsnull, &pName);
if (pName) {
nsCRT::free( pStr);
pStr = pName;
@ -743,19 +853,46 @@ ImportMailThread( void *stuff)
lastName = pStr;
IMPORT_LOG1( "* Creating new import folder: %s\n", pStr);
rv = curFolder->CreateSubfolder( pStr);
rv = curFolder->GetChildNamed( pStr, getter_AddRefs( subFolder));
newFolder = do_QueryInterface( subFolder);
if (newFolder)
newFolder->GetPath( getter_AddRefs( outBox));
rv = curProxy->CreateSubfolder( pStr);
IMPORT_LOG1( "New folder created, rv: 0x%lx\n", rv);
if (NS_SUCCEEDED( rv)) {
rv = curProxy->GetChildNamed( pStr, getter_AddRefs( subFolder));
IMPORT_LOG1( "GetChildNamed for new folder returned rv: 0x%lx\n", rv);
if (NS_SUCCEEDED( rv)) {
newFolder = do_QueryInterface( subFolder);
if (newFolder) {
newFolder->GetPath( getter_AddRefs( outBox));
IMPORT_LOG0( "Got path for newly created folder\n");
}
else {
IMPORT_LOG0( "Newly created folder not found\n");
}
}
}
if (NS_FAILED( rv)) {
nsImportGenericMail::ReportError( IMPORT_ERROR_MB_CREATE, lastName.GetUnicode(), &error);
}
nsCRT::free( pStr);
if (size && import && newFolder && outBox) {
if (size && import && newFolder && outBox && NS_SUCCEEDED( rv)) {
PRBool fatalError = PR_FALSE;
pData->currentSize = size;
rv = pData->mailImport->ImportMailbox( box, outBox, pData->errorLog, pData->successLog, &fatalError);
PRUnichar *pSuccess = nsnull;
PRUnichar *pError = nsnull;
rv = pData->mailImport->ImportMailbox( box, outBox, &pError, &pSuccess, &fatalError);
if (pError) {
error.Append( pError);
nsCRT::free( pError);
}
if (pSuccess) {
success.Append( pSuccess);
nsCRT::free( pSuccess);
}
pData->currentSize = 0;
pData->currentTotal += size;
if (fatalError) {
@ -767,6 +904,8 @@ ImportMailThread( void *stuff)
}
}
nsImportGenericMail::SetLogs( success, error, pData->successLog, pData->errorLog);
if (pData->abort || pData->fatalError) {
if (pData->ownsDestRoot) {
destRoot->RecursiveDelete( PR_TRUE);
@ -801,33 +940,50 @@ PRBool nsImportGenericMail::GetAccount( nsIMsgFolder **ppFolder)
return( PR_FALSE);
}
nsCOMPtr<nsIMsgIdentity> identity;
rv = mailSession->GetCurrentIdentity( getter_AddRefs( identity));
if (NS_FAILED( rv)) {
IMPORT_LOG0( "*** Failed to get current identity\n");
return( PR_FALSE);
}
// Create a new account for the import
nsCOMPtr<nsIMsgIncomingServer> server;
rv = accMgr->CreateIncomingServer( "none", getter_AddRefs( server));
// TODO: Ensure that the named used for this server is unique.
// Get the default name from the import module.
nsString prettyName;
if (m_pName)
prettyName = m_pName;
else
prettyName = "Imported Mail";
char *pName = prettyName.ToNewCString();
server->SetPrettyName( (PRUnichar *) prettyName.GetUnicode());
server->SetHostName( "imported.mail");
server->SetUsername( "nobody");
nsCOMPtr<nsIMsgIncomingServer> server;
// Let's find a host name we're not using yet for a new "none" server
int count = 1;
char hostName[30];
PR_snprintf( hostName, 30, "%s", "imported.mail");
while (count < 1000) {
rv = accMgr->FindServer( "import", hostName, "none", getter_AddRefs( server));
if (NS_SUCCEEDED( rv)) {
PR_snprintf( hostName, 30, "imported%d.mail", count);
count++;
}
else
break;
}
if (NS_SUCCEEDED( rv)) {
IMPORT_LOG0( "*** Failed to find a unique 'none' server to create for importing\n");
return( PR_FALSE);
}
rv = accMgr->CreateIncomingServer( "none", getter_AddRefs( server));
if (NS_FAILED( rv)) {
IMPORT_LOG0( "*** Failed to create a 'none' incoming server\n");
return( PR_FALSE);
}
server->SetType( "none");
// Let's get a reasonable "pretty name" that doesn't exist yet?
GetUniquePrettyName( accMgr, prettyName);
server->SetPrettyName( (PRUnichar *) prettyName.GetUnicode());
server->SetHostName( hostName);
server->SetUsername( "import");
nsCRT::free( pName);
// create a new account with the server and identity.
nsCOMPtr<nsIMsgAccount> account;
@ -842,17 +998,6 @@ PRBool nsImportGenericMail::GetAccount( nsIMsgFolder **ppFolder)
if (NS_FAILED( rv)) {
IMPORT_LOG0( "*** Error setting incoming server on account\n");
}
if (identity) {
rv = account->AddIdentity( identity);
if (NS_FAILED( rv)) {
IMPORT_LOG0( "*** Error adding identity to account\n");
}
rv = account->SetDefaultIdentity( identity);
if (NS_FAILED( rv)) {
IMPORT_LOG0( "*** Error setting default identity for account\n");
}
}
nsCOMPtr<nsIFolder> rootFolder;
rv = server->GetRootFolder( getter_AddRefs( rootFolder));
@ -869,6 +1014,55 @@ PRBool nsImportGenericMail::GetAccount( nsIMsgFolder **ppFolder)
return( PR_FALSE);
}
void nsImportGenericMail::GetUniquePrettyName( nsIMsgAccountManager *pMgr, nsString& name)
{
nsString newName = name;
nsString num;
int count = 1;
nsCOMPtr<nsISupportsArray> array;
nsresult rv = pMgr->GetAllServers( getter_AddRefs( array));
if (NS_FAILED( rv))
return;
PRBool found;
PRUint32 sz = 0;
rv = array->Count( &sz);
if (!sz)
return;
nsCOMPtr<nsISupports> sup;
nsCOMPtr<nsIMsgIncomingServer> server;
do {
found = PR_FALSE;
for (int i = 0; (i < (int) sz) && !found; i++) {
rv = array->GetElementAt( i, getter_AddRefs( sup));
if (NS_SUCCEEDED( rv) && sup) {
server = do_QueryInterface( sup);
if (server) {
nsXPIDLString prettyName;
rv = server->GetPrettyName( getter_Copies( prettyName));
if (NS_SUCCEEDED( rv)) {
if (!newName.Compare( prettyName, PR_TRUE))
found = PR_TRUE;
}
}
}
}
if (found) {
newName = name;
newName.Append( " ");
newName.Append( count);
count++;
}
} while (found == PR_TRUE);
name = newName;
}
PRBool nsImportGenericMail::FindAccount( nsIMsgFolder **ppFolder)
{
nsresult rv;

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

@ -0,0 +1,81 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "prprf.h"
#include "prmem.h"
#include "nsCOMPtr.h"
#include "nsIStringBundle.h"
#include "nsImportStringBundle.h"
#include "nsIServiceManager.h"
#include "nsIURI.h"
/* This is the next generation string retrieval call */
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
#define IMPORT_MSGS_URL "chrome://messenger/locale/importMsgs.properties"
nsIStringBundle *nsImportStringBundle::GetStringBundle( void)
{
nsresult rv;
char* propertyURL = IMPORT_MSGS_URL;
nsIStringBundle* sBundle = nsnull;
NS_WITH_SERVICE(nsIStringBundleService, sBundleService, kStringBundleServiceCID, &rv);
if (NS_SUCCEEDED(rv) && (nsnull != sBundleService)) {
nsILocale * locale = nsnull;
rv = sBundleService->CreateBundle(propertyURL, locale, &sBundle);
}
return( sBundle);
}
void nsImportStringBundle::GetStringByID( PRInt32 stringID, nsString& result, nsIStringBundle *pBundle)
{
PRUnichar *ptrv = GetStringByID( stringID, pBundle);
result = ptrv;
FreeString( ptrv);
}
PRUnichar *nsImportStringBundle::GetStringByID(PRInt32 stringID, nsIStringBundle *pBundle)
{
PRBool mine = PR_FALSE;
if (!pBundle) {
mine = PR_TRUE;
pBundle = GetStringBundle();
}
if (pBundle) {
PRUnichar *ptrv = nsnull;
nsresult rv = pBundle->GetStringFromID(stringID, &ptrv);
if (mine) {
NS_RELEASE(pBundle);
}
if (NS_SUCCEEDED( rv) && ptrv)
return( ptrv);
}
nsString resultString( "[StringID ");
resultString.Append(stringID, 10);
resultString += "?]";
return( resultString.ToNewUnicode());
}

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

@ -0,0 +1,50 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _nsImportStringBundle_H__
#define _nsImportStringBundle_H__
#include "nsCRT.h"
#include "nsString.h"
class nsIStringBundle;
class nsImportStringBundle {
public:
static PRUnichar * GetStringByID(PRInt32 stringID, nsIStringBundle *pBundle = nsnull);
static void GetStringByID(PRInt32 stringID, nsString& result, nsIStringBundle *pBundle = nsnull);
// GetStringBundle creates a new one every time!
static nsIStringBundle * GetStringBundle( void);
static void FreeString( PRUnichar *pStr) { nsCRT::free( pStr);}
};
#define IMPORT_NO_ADDRBOOKS 2000
#define IMPORT_ERROR_AB_NOTINITIALIZED 2001
#define IMPORT_ERROR_AB_NOTHREAD 2002
#define IMPORT_ERROR_GETABOOK 2003
#define IMPORT_NO_MAILBOXES 2004
#define IMPORT_ERROR_MB_NOTINITIALIZED 2005
#define IMPORT_ERROR_MB_NOTHREAD 2006
#define IMPORT_ERROR_MB_NOPROXY 2007
#define IMPORT_ERROR_MB_FINDCHILD 2008
#define IMPORT_ERROR_MB_CREATE 2009
#define IMPORT_ERROR_MB_NODESTFOLDER 2010
#endif /* _nsImportStringBundle_H__ */

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

@ -0,0 +1,83 @@
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# The following are used by the outlook express import code to display status/error
# and informational messages
#
# Success message when no address books are found to import
## @name IMPORT_NO_ADDRBOOKS
## @loc None
2000=No address books were found to import
# Error: Address book import not intialized
## @name IMPORT_ERROR_AB_NOTINITIALIZED
## @loc None
2001=Unable to import address books, initialization error
# Error: Unable to create the import thread
## @name IMPORT_ERROR_AB_NOTHREAD
## @loc None
2002=Unable to import address books, cannot create import thread
# Error: Unable to create the import thread
## @name IMPORT_ERROR_GETABOOK
## @loc None
2003=Error importing %S, unable to create address book
# Success message when no mailboxes are found to import
## @name IMPORT_NO_MAILBOXES
## @loc None
2004=No mailboxes were found to import
# Error: Mailbox import not intialized
## @name IMPORT_ERROR_MB_NOTINITIALIZED
## @loc None
2005=Unable to import mailboxes, initialization error
# Error: Unable to create the import thread
## @name IMPORT_ERROR_MB_NOTHREAD
## @loc None
2006=Unable to import mailboxes, cannot create import thread
# Error: Unable to create the proxy object for importing mailboxes
## @name IMPORT_ERROR_MB_NOPROXY
## @loc None
2007=Unable to import mailboxes, cannot create proxy object for destination mailboxes
# Error: Error creating destination mailboxes
## @name IMPORT_ERROR_MB_FINDCHILD
## @loc None
2008=Error creating destination mailboxes, cannot find mailbox %S
# Error: Error creating destination mailboxes
## @name IMPORT_ERROR_MB_CREATE
## @loc None
2009=Error importing mailbox %S, unable to create destination mailbox
# Error: No destination account to import mailboxes
## @name IMPORT_ERROR_MB_NODESTFOLDER
## @loc None
2010=Unable to create an account to import mail into

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

@ -0,0 +1,56 @@
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
#
# The following are used by the outlook express import code to display status/error
# and informational messages
#
# Short name of import module
## @name OEIMPORT_NAME
## @loc None
2000=Outlook Express
# Description of import module
## @name OEIMPORT_DESCRIPTION
## @loc None
2001=Outlook Express mail and address books
# Success message
## @name OEIMPORT_MAILBOX_SUCCESS
## @loc None
2002=Mailbox %S, imported %d messages
# Error message
## @name OEIMPORT_MAILBOX_BADPARAM
## @loc None
2003=Bad parameter passed to import mailbox.
# Error message
## @name OEIMPORT_MAILBOX_BADSOURCEFILE
## @loc None
2004=Error accessing file for mailbox %S.
# Error message
## @name OEIMPORT_MAILBOX_CONVERTERROR
## @loc None
2005=Error importing mailbox %S, all messages may not be imported from this mailbox.