зеркало из https://github.com/mozilla/pjs.git
Fix for bug 158367. Replaced macro IMPORT_LOGx() with PR_LOG() for ns logging and cleaned up some logging info at the top level driver function in nsImportMail.cpp. r=ducarroz, sr=sspitzer.
This commit is contained in:
Родитель
31a014a252
Коммит
333191f475
|
@ -38,27 +38,13 @@
|
|||
#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
|
||||
|
||||
// Use PR_LOG for logging.
|
||||
#include "prlog.h"
|
||||
extern PRLogModuleInfo *COMM4XLOGMODULE;
|
||||
|
||||
#define IMPORT_LOG0(x) PR_LOG(COMM4XLOGMODULE, PR_LOG_DEBUG, (x))
|
||||
#define IMPORT_LOG1(x, y) PR_LOG(COMM4XLOGMODULE, PR_LOG_DEBUG, (x, y))
|
||||
#define IMPORT_LOG2(x, y, z) PR_LOG(COMM4XLOGMODULE, PR_LOG_DEBUG, (x, y, z))
|
||||
#define IMPORT_LOG3(a, b, c, d) PR_LOG(COMM4XLOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
|
||||
|
||||
#endif /* Comm4xMailDebugLog_h___ */
|
||||
|
|
|
@ -207,18 +207,12 @@ nsresult nsComm4xMail::FoundMailbox(nsIFileSpec *mailFile, nsAutoString *pName,
|
|||
{
|
||||
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
|
||||
nsXPIDLCString pPath;
|
||||
mailFile->GetNativePath(getter_Copies(pPath));
|
||||
if (!pPath.IsEmpty())
|
||||
IMPORT_LOG2("Found comm4x mailbox: %s, m_depth = %d\n", pPath.get(), m_depth);
|
||||
else
|
||||
IMPORT_LOG2("Can't get native path but found comm4x mailbox: %s, m_depth = %d\n", NS_ConvertUCS2toUTF8(*pName).get(), m_depth);
|
||||
|
||||
nsresult rv = pImport->CreateNewMailboxDescriptor(getter_AddRefs(desc));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
|
|
@ -41,6 +41,10 @@
|
|||
Comm4xMail import mail interface
|
||||
|
||||
*/
|
||||
#ifdef MOZ_LOGGING
|
||||
// sorry, this has to be before the pre-compiled header
|
||||
#define FORCE_PR_LOG /* Allow logging in the release build */
|
||||
#endif
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsCRT.h"
|
||||
|
@ -74,6 +78,7 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
|||
|
||||
#define COMM4XMAIL_MSGS_URL "chrome://messenger/locale/comm4xMailImportMsgs.properties"
|
||||
|
||||
PRLogModuleInfo *COMM4XLOGMODULE = nsnull;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -83,6 +88,10 @@ nsComm4xMailImport::nsComm4xMailImport()
|
|||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
// Init logging module.
|
||||
if (!COMM4XLOGMODULE)
|
||||
COMM4XLOGMODULE = PR_NewLogModule("IMPORT");
|
||||
|
||||
IMPORT_LOG0("nsComm4xMailImport Module Created\n");
|
||||
|
||||
nsCOMPtr <nsIStringBundleService> pBundleService;
|
||||
|
@ -314,12 +323,10 @@ NS_IMETHODIMP ImportComm4xMailImpl::ImportMailbox(nsIImportMailboxDescriptor *pS
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef IMPORT_DEBUG
|
||||
char *pPath;
|
||||
inFile->GetNativePath(&pPath);
|
||||
IMPORT_LOG1("Import mailbox: %s\n", pPath);
|
||||
nsCRT::free(pPath);
|
||||
#endif
|
||||
nsXPIDLCString pSrcPath, pDestPath;;
|
||||
inFile->GetNativePath(getter_Copies(pSrcPath));
|
||||
pDestination ->GetNativePath(getter_Copies(pDestPath));
|
||||
IMPORT_LOG2("ImportComm4xMailImpl::ImportMailbox: Copying folder from '%s' to '%s'.", pSrcPath.get(), pDestPath.get());
|
||||
|
||||
nsCOMPtr <nsIFileSpec> parent;
|
||||
if (NS_FAILED (pDestination->GetParent(getter_AddRefs(parent))))
|
||||
|
|
|
@ -23,22 +23,14 @@
|
|||
#define IMPORT_DEBUG 1
|
||||
#endif
|
||||
|
||||
#ifdef IMPORT_DEBUG
|
||||
#include <stdio.h>
|
||||
// Use PR_LOG for logging.
|
||||
#include "prlog.h"
|
||||
extern PRLogModuleInfo *EUDORALOGMODULE; // Logging module
|
||||
|
||||
#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
|
||||
#define IMPORT_LOG0(x) PR_LOG(EUDORALOGMODULE, PR_LOG_DEBUG, (x))
|
||||
#define IMPORT_LOG1(x, y) PR_LOG(EUDORALOGMODULE, PR_LOG_DEBUG, (x, y))
|
||||
#define IMPORT_LOG2(x, y, z) PR_LOG(EUDORALOGMODULE, PR_LOG_DEBUG, (x, y, z))
|
||||
#define IMPORT_LOG3(a, b, c, d) PR_LOG(EUDORALOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -25,6 +25,11 @@
|
|||
Eudora import mail and addressbook interfaces
|
||||
|
||||
*/
|
||||
#ifdef MOZ_LOGGING
|
||||
// sorry, this has to be before the pre-compiled header
|
||||
#define FORCE_PR_LOG /* Allow logging in the release build */
|
||||
#endif
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsString.h"
|
||||
|
@ -62,6 +67,7 @@
|
|||
#include "EudoraDebugLog.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
PRLogModuleInfo *EUDORALOGMODULE = nsnull;
|
||||
|
||||
class ImportEudoraMailImpl : public nsIImportMail
|
||||
{
|
||||
|
@ -199,6 +205,9 @@ nsEudoraImport::nsEudoraImport()
|
|||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
// Init logging module.
|
||||
if (!EUDORALOGMODULE)
|
||||
EUDORALOGMODULE = PR_NewLogModule("IMPORT");
|
||||
IMPORT_LOG0( "nsEudoraImport Module Created\n");
|
||||
|
||||
nsEudoraStringBundle::GetStringBundle();
|
||||
|
|
|
@ -351,6 +351,7 @@ nsresult nsEudoraMailbox::CompactMailbox( PRUint32 *pBytes, PRBool *pAbort, nsIF
|
|||
{
|
||||
PRUint32 mailSize = m_mailSize;
|
||||
PRUint32 tocSize = 0;
|
||||
PRUint32 msgCount = 0;
|
||||
nsresult rv;
|
||||
|
||||
rv = pToc->GetFileSize( &tocSize);
|
||||
|
@ -416,7 +417,7 @@ nsresult nsEudoraMailbox::CompactMailbox( PRUint32 *pBytes, PRBool *pAbort, nsIF
|
|||
return( rv);
|
||||
}
|
||||
|
||||
IMPORT_LOG0( ".");
|
||||
IMPORT_LOG1( " Message #%d processed.", ++msgCount);
|
||||
|
||||
tocOffset += kMsgHeaderSize;
|
||||
}
|
||||
|
|
|
@ -38,28 +38,14 @@
|
|||
#ifndef OEDebugLog_h___
|
||||
#define OEDebugLog_h___
|
||||
|
||||
/*
|
||||
#ifdef NS_DEBUG
|
||||
#define IMPORT_DEBUG 1
|
||||
#endif
|
||||
*/
|
||||
// Use PR_LOG for logging.
|
||||
#include "prlog.h"
|
||||
extern PRLogModuleInfo *OELOGMODULE; // Logging module
|
||||
|
||||
#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
|
||||
#define IMPORT_LOG0(x) PR_LOG(OELOGMODULE, PR_LOG_DEBUG, (x))
|
||||
#define IMPORT_LOG1(x, y) PR_LOG(OELOGMODULE, PR_LOG_DEBUG, (x, y))
|
||||
#define IMPORT_LOG2(x, y, z) PR_LOG(OELOGMODULE, PR_LOG_DEBUG, (x, y, z))
|
||||
#define IMPORT_LOG3(a, b, c, d) PR_LOG(OELOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
Outlook Express (Win32) import mail and addressbook interfaces
|
||||
|
||||
*/
|
||||
#ifdef MOZ_LOGGING
|
||||
// sorry, this has to be before the pre-compiled header
|
||||
#define FORCE_PR_LOG /* Allow logging in the release build */
|
||||
#endif
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsString.h"
|
||||
|
@ -74,6 +79,7 @@
|
|||
#include "OEDebugLog.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
PRLogModuleInfo *OELOGMODULE = nsnull;
|
||||
|
||||
class ImportOEMailImpl : public nsIImportMail
|
||||
{
|
||||
|
@ -179,6 +185,9 @@ nsOEImport::nsOEImport()
|
|||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
// Init logging module.
|
||||
if (!OELOGMODULE)
|
||||
OELOGMODULE = PR_NewLogModule("IMPORT");
|
||||
IMPORT_LOG0( "nsOEImport Module Created\n");
|
||||
|
||||
nsOEStringBundle::GetStringBundle();
|
||||
|
@ -481,12 +490,9 @@ NS_IMETHODIMP ImportOEMailImpl::ImportMailbox( nsIImportMailboxDescriptor *pSour
|
|||
return( NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
#ifdef IMPORT_DEBUG
|
||||
char *pPath;
|
||||
inFile->GetNativePath( &pPath);
|
||||
IMPORT_LOG1( "Impot mailbox: %s\n", pPath);
|
||||
nsCRT::free( pPath);
|
||||
#endif
|
||||
nsXPIDLCString pPath;
|
||||
inFile->GetNativePath(getter_Copies(pPath));
|
||||
IMPORT_LOG1( "Importing Outlook Express mailbox: %s\n", pPath.get());
|
||||
|
||||
m_bytesDone = 0;
|
||||
PRUint32 msgCount = 0;
|
||||
|
|
|
@ -42,22 +42,14 @@
|
|||
#define IMPORT_DEBUG 1
|
||||
#endif
|
||||
|
||||
#ifdef IMPORT_DEBUG
|
||||
#include <stdio.h>
|
||||
// Use PR_LOG for logging.
|
||||
#include "prlog.h"
|
||||
extern PRLogModuleInfo *OUTLOOKLOGMODULE; // Logging module
|
||||
|
||||
#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
|
||||
#define IMPORT_LOG0(x) PR_LOG(OUTLOOKLOGMODULE, PR_LOG_DEBUG, (x))
|
||||
#define IMPORT_LOG1(x, y) PR_LOG(OUTLOOKLOGMODULE, PR_LOG_DEBUG, (x, y))
|
||||
#define IMPORT_LOG2(x, y, z) PR_LOG(OUTLOOKLOGMODULE, PR_LOG_DEBUG, (x, y, z))
|
||||
#define IMPORT_LOG3(a, b, c, d) PR_LOG(OUTLOOKLOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
Outlook Express (Win32) import mail and addressbook interfaces
|
||||
|
||||
*/
|
||||
#ifdef MOZ_LOGGING
|
||||
// sorry, this has to be before the pre-compiled header
|
||||
#define FORCE_PR_LOG /* Allow logging in the release build */
|
||||
#endif
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsString.h"
|
||||
|
@ -73,6 +78,7 @@
|
|||
#include "MapiApi.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
PRLogModuleInfo *OUTLOOKLOGMODULE = nsnull;
|
||||
|
||||
class ImportOutlookMailImpl : public nsIImportMail
|
||||
{
|
||||
|
@ -178,7 +184,11 @@ private:
|
|||
|
||||
nsOutlookImport::nsOutlookImport()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
// Init logging module.
|
||||
if (!OUTLOOKLOGMODULE)
|
||||
OUTLOOKLOGMODULE = PR_NewLogModule("IMPORT");
|
||||
|
||||
IMPORT_LOG0( "nsOutlookImport Module Created\n");
|
||||
|
||||
|
|
|
@ -42,21 +42,14 @@
|
|||
#define IMPORT_DEBUG 1
|
||||
#endif
|
||||
|
||||
#ifdef IMPORT_DEBUG
|
||||
#include <stdio.h>
|
||||
// Use PR_LOG for logging.
|
||||
#include "prlog.h"
|
||||
extern PRLogModuleInfo *IMPORTLOGMODULE; // Logging module
|
||||
|
||||
#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)
|
||||
#define IMPORT_LOG0(x) PR_LOG(IMPORTLOGMODULE, PR_LOG_DEBUG, (x))
|
||||
#define IMPORT_LOG1(x, y) PR_LOG(IMPORTLOGMODULE, PR_LOG_DEBUG, (x, y))
|
||||
#define IMPORT_LOG2(x, y, z) PR_LOG(IMPORTLOGMODULE, PR_LOG_DEBUG, (x, y, z))
|
||||
#define IMPORT_LOG3(a, b, c, d) PR_LOG(IMPORTLOGMODULE, PR_LOG_DEBUG, (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
|
||||
|
|
|
@ -39,6 +39,10 @@
|
|||
/*
|
||||
*/
|
||||
|
||||
#ifdef MOZ_LOGGING
|
||||
// sorry, this has to be before the pre-compiled header
|
||||
#define FORCE_PR_LOG /* Allow logging in the release build */
|
||||
#endif
|
||||
|
||||
#include "prthread.h"
|
||||
#include "prprf.h"
|
||||
|
@ -209,6 +213,9 @@ nsImportGenericMail::nsImportGenericMail()
|
|||
m_deleteDestFolder = PR_FALSE;
|
||||
m_createdFolder = PR_FALSE;
|
||||
|
||||
// Init logging module.
|
||||
if (!IMPORTLOGMODULE)
|
||||
IMPORTLOGMODULE = PR_NewLogModule("IMPORT");
|
||||
}
|
||||
|
||||
|
||||
|
@ -393,7 +400,7 @@ void nsImportGenericMail::GetDefaultDestination( void)
|
|||
m_createdFolder = PR_TRUE;
|
||||
return;
|
||||
}
|
||||
IMPORT_LOG0( "*** FAILED to create a default import destination\n");
|
||||
IMPORT_LOG0("*** GetDefaultDestination: Failed to create a default import destination folder.");
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImportGenericMail::WantsProgress(PRBool *_retval)
|
||||
|
@ -484,7 +491,7 @@ NS_IMETHODIMP nsImportGenericMail::BeginImport(nsISupportsString *successLog, ns
|
|||
}
|
||||
|
||||
if (!m_pInterface || !m_pMailboxes) {
|
||||
IMPORT_LOG0( "*** Something is not set properly, interface, mailboxes, or destination.\n");
|
||||
IMPORT_LOG0( "*** BeginImport: Either the interface or source mailbox is not set properly.");
|
||||
nsImportStringBundle::GetStringByID( IMPORT_ERROR_MB_NOTINITIALIZED, error);
|
||||
SetLogs( success, error, successLog, errorLog);
|
||||
*_retval = PR_FALSE;
|
||||
|
@ -492,7 +499,7 @@ NS_IMETHODIMP nsImportGenericMail::BeginImport(nsISupportsString *successLog, ns
|
|||
}
|
||||
|
||||
if (!m_pDestFolder) {
|
||||
IMPORT_LOG0( "*** No import destination.\n");
|
||||
IMPORT_LOG0( "*** BeginImport: The destination mailbox is not set properly.");
|
||||
nsImportStringBundle::GetStringByID( IMPORT_ERROR_MB_NODESTFOLDER, error);
|
||||
SetLogs( success, error, successLog, errorLog);
|
||||
*_retval = PR_FALSE;
|
||||
|
@ -710,11 +717,9 @@ void ImportThreadData::DriverAbort()
|
|||
PR_STATIC_CALLBACK( void)
|
||||
ImportMailThread( void *stuff)
|
||||
{
|
||||
IMPORT_LOG0( "In Begin ImporMailThread\n");
|
||||
|
||||
ImportThreadData *pData = (ImportThreadData *)stuff;
|
||||
|
||||
IMPORT_LOG0( "In ImportMailThread!!!!!!!\n");
|
||||
IMPORT_LOG0("ImportMailThread: Starting...");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -753,18 +758,20 @@ ImportMailThread( void *stuff)
|
|||
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIMsgFolder),
|
||||
curFolder, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs( curProxy));
|
||||
|
||||
IMPORT_LOG1( "Proxy result for curFolder: 0x%lx\n", (long) rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
// GetSubfolders() will initialize folders if they are not already initialized.
|
||||
curProxy->GetSubFolders(getter_AddRefs(enumerator));
|
||||
else
|
||||
IMPORT_LOG1( "*** ImportMailThread: Can't get the destination root folder proxy. rv=(0x%lx)", (long) rv);
|
||||
}
|
||||
else {
|
||||
IMPORT_LOG0( "Unable to obtain proxy service to do import\n");
|
||||
IMPORT_LOG0("*** ImportMailThread: Unable to obtain proxy service to do the import.");
|
||||
nsImportStringBundle::GetStringByID( IMPORT_ERROR_MB_NOPROXY, error, bundle);
|
||||
pData->abort = PR_TRUE;
|
||||
}
|
||||
|
||||
IMPORT_LOG1( "Total number of mailboxes: %d\n", (int) count);
|
||||
|
||||
IMPORT_LOG1("ImportMailThread: Total number of folders to import = %d.", count);
|
||||
|
||||
// Note that the front-end js script only displays one import result string so
|
||||
// we combine both good and bad import status into one string (in var 'success').
|
||||
|
@ -784,9 +791,10 @@ ImportMailThread( void *stuff)
|
|||
if (newDepth > depth) {
|
||||
// OK, we are going to add a subfolder under the last/previous folder we processed, so
|
||||
// find this folder (stored in 'lastName') who is going to be the new parent folder.
|
||||
IMPORT_LOG1( "* Finding folder for child named: %s\n", lastName.get());
|
||||
IMPORT_LOG1("ImportMailThread: Processing child folder '%s'.", NS_ConvertUCS2toUTF8(lastName).get());
|
||||
rv = curProxy->GetChildNamed( lastName.get(), getter_AddRefs( subFolder));
|
||||
if (NS_FAILED( rv)) {
|
||||
IMPORT_LOG1("*** ImportMailThread: Failed to get the interface for child folder '%s'.", NS_ConvertUCS2toUTF8(lastName).get());
|
||||
nsImportGenericMail::ReportError( IMPORT_ERROR_MB_FINDCHILD, lastName.get(), &success);
|
||||
pData->fatalError = PR_TRUE;
|
||||
break;
|
||||
|
@ -795,6 +803,7 @@ ImportMailThread( void *stuff)
|
|||
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIMsgFolder),
|
||||
subFolder, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs( curProxy));
|
||||
if (NS_FAILED( rv)) {
|
||||
IMPORT_LOG1("*** ImportMailThread: Failed to get the proxy interface for child folder '%s'.", NS_ConvertUCS2toUTF8(lastName).get());
|
||||
nsImportStringBundle::GetStringByID( IMPORT_ERROR_MB_NOPROXY, error, bundle);
|
||||
pData->fatalError = PR_TRUE;
|
||||
break;
|
||||
|
@ -802,19 +811,25 @@ ImportMailThread( void *stuff)
|
|||
|
||||
// Make sure this new parent folder obj has the correct subfolder list so far.
|
||||
rv = curProxy->GetSubFolders(getter_AddRefs(enumerator));
|
||||
|
||||
IMPORT_LOG1( "Created proxy for new subFolder: 0x%lx\n", (long) rv);
|
||||
}
|
||||
else if (newDepth < depth) {
|
||||
rv = NS_OK;
|
||||
while ((newDepth < depth) && NS_SUCCEEDED( rv)) {
|
||||
nsCOMPtr<nsIFolder> parFolder;
|
||||
curProxy->GetParent( getter_AddRefs( parFolder));
|
||||
rv = curProxy->GetParent( getter_AddRefs( parFolder));
|
||||
if (NS_FAILED( rv)) {
|
||||
IMPORT_LOG1("*** ImportMailThread: Failed to get the interface for parent folder '%s'.", lastName.get());
|
||||
nsImportGenericMail::ReportError( IMPORT_ERROR_MB_FINDCHILD, lastName.get(), &success);
|
||||
pData->fatalError = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIMsgFolder),
|
||||
parFolder, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs( curProxy));
|
||||
depth--;
|
||||
}
|
||||
if (NS_FAILED( rv)) {
|
||||
IMPORT_LOG1("*** ImportMailThread: Failed to get the proxy interface for parent folder '%s'.", lastName.get());
|
||||
nsImportStringBundle::GetStringByID( IMPORT_ERROR_MB_NOPROXY, error, bundle);
|
||||
pData->fatalError = PR_TRUE;
|
||||
break;
|
||||
|
@ -839,25 +854,26 @@ ImportMailThread( void *stuff)
|
|||
lastName.Assign(subName);
|
||||
}
|
||||
|
||||
IMPORT_LOG1( "* Creating new import folder: %s\n", lastName.get());
|
||||
IMPORT_LOG1("ImportMailThread: Creating new import folder '%s'.", NS_ConvertUCS2toUTF8(lastName).get());
|
||||
|
||||
rv = curProxy->CreateSubfolder( lastName.get(),nsnull);
|
||||
|
||||
IMPORT_LOG1( "New folder created, rv: 0x%lx\n", (long) rv);
|
||||
if (NS_SUCCEEDED( rv)) {
|
||||
rv = curProxy->GetChildNamed( lastName.get(), getter_AddRefs( subFolder));
|
||||
IMPORT_LOG1( "GetChildNamed for new folder returned rv: 0x%lx\n", (long) 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");
|
||||
IMPORT_LOG1("*** ImportMailThread: Failed to locate subfolder interface '%s'.", lastName.get());
|
||||
}
|
||||
}
|
||||
else
|
||||
IMPORT_LOG1("*** ImportMailThread: Failed to locate subfolder '%s' after it's been created.", lastName.get());
|
||||
}
|
||||
else
|
||||
IMPORT_LOG1("*** ImportMailThread: Failed to create subfolder '%s'.", lastName.get());
|
||||
|
||||
if (NS_FAILED( rv)) {
|
||||
nsImportGenericMail::ReportError( IMPORT_ERROR_MB_CREATE, lastName.get(), &success);
|
||||
|
@ -890,7 +906,7 @@ ImportMailThread( void *stuff)
|
|||
newFolder->ForceDBClosed();
|
||||
|
||||
if (fatalError) {
|
||||
IMPORT_LOG1( "*** ImportMailbox returned fatalError, mailbox #%d\n", (int) i);
|
||||
IMPORT_LOG1( "*** ImportMailThread: ImportMailbox returned fatalError, mailbox #%d\n", (int) i);
|
||||
pData->fatalError = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
|
@ -908,7 +924,7 @@ ImportMailThread( void *stuff)
|
|||
nsImportGenericMail::SetLogs( success, error, pData->successLog, pData->errorLog);
|
||||
|
||||
if (pData->abort || pData->fatalError) {
|
||||
IMPORT_LOG0( "Abort or fatalError set\n");
|
||||
IMPORT_LOG0( "*** ImportMailThread: Abort or fatalError flag was set\n");
|
||||
if (pData->ownsDestRoot) {
|
||||
IMPORT_LOG0( "Calling destRoot->RecursiveDelete\n");
|
||||
|
||||
|
@ -1000,7 +1016,7 @@ PRBool nsImportGenericMail::CreateFolder( nsIMsgFolder **ppFolder)
|
|||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
IMPORT_LOG1( "* Creating folder for importing mail: %s\n", folderName.get());
|
||||
IMPORT_LOG1( "Creating folder for importing mail: '%s'\n", NS_ConvertUCS2toUTF8(folderName).get());
|
||||
rv = localRootFolder->CreateSubfolder(folderName.get(), nsnull);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsISupports> subFolder;
|
||||
|
@ -1008,7 +1024,7 @@ PRBool nsImportGenericMail::CreateFolder( nsIMsgFolder **ppFolder)
|
|||
if (subFolder) {
|
||||
subFolder->QueryInterface(NS_GET_IID(nsIMsgFolder), (void **) ppFolder);
|
||||
if (*ppFolder) {
|
||||
IMPORT_LOG0("****** CREATED NEW FOLDER FOR IMPORT\n");
|
||||
IMPORT_LOG1("Folder '%s' created successfully\n", NS_ConvertUCS2toUTF8(folderName).get());
|
||||
return PR_TRUE;
|
||||
}
|
||||
} // if subFolder
|
||||
|
|
|
@ -36,6 +36,10 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef MOZ_LOGGING
|
||||
// sorry, this has to be before the pre-compiled header
|
||||
#define FORCE_PR_LOG /* Allow logging in the release build */
|
||||
#endif
|
||||
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsICharsetAlias.h"
|
||||
|
@ -63,6 +67,7 @@
|
|||
#include "prmem.h"
|
||||
#include "ImportDebug.h"
|
||||
|
||||
PRLogModuleInfo *IMPORTLOGMODULE = nsnull;
|
||||
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
|
@ -188,7 +193,10 @@ nsImportService::nsImportService() : m_pModules( nsnull)
|
|||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
IMPORT_LOG0( "* nsImport Service Created\n");
|
||||
// Init logging module.
|
||||
if (!IMPORTLOGMODULE)
|
||||
IMPORTLOGMODULE = PR_NewLogModule("IMPORT");
|
||||
IMPORT_LOG0( "* nsImport Service Created\n");
|
||||
|
||||
m_didDiscovery = PR_FALSE;
|
||||
m_pDecoder = nsnull;
|
||||
|
|
|
@ -19,26 +19,14 @@
|
|||
#ifndef TextDebugLog_h___
|
||||
#define TextDebugLog_h___
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
#define IMPORT_DEBUG 1
|
||||
#endif
|
||||
// Use PR_LOG for logging.
|
||||
#include "prlog.h"
|
||||
extern PRLogModuleInfo *TEXTIMPORTLOGMODULE; // Logging module
|
||||
|
||||
#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
|
||||
#define IMPORT_LOG0(x) PR_LOG(TEXTIMPORTLOGMODULE, PR_LOG_DEBUG, (x))
|
||||
#define IMPORT_LOG1(x, y) PR_LOG(TEXTIMPORTLOGMODULE, PR_LOG_DEBUG, (x, y))
|
||||
#define IMPORT_LOG2(x, y, z) PR_LOG(TEXTIMPORTLOGMODULE, PR_LOG_DEBUG, (x, y, z))
|
||||
#define IMPORT_LOG3(a, b, c, d) PR_LOG(TEXTIMPORTLOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -25,6 +25,11 @@
|
|||
Text import addressbook interfaces
|
||||
|
||||
*/
|
||||
#ifdef MOZ_LOGGING
|
||||
// sorry, this has to be before the pre-compiled header
|
||||
#define FORCE_PR_LOG /* Allow logging in the release build */
|
||||
#endif
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsString.h"
|
||||
|
@ -50,8 +55,7 @@
|
|||
#include "TextDebugLog.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
||||
|
||||
PRLogModuleInfo* TEXTIMPORTLOGMODULE;
|
||||
|
||||
class ImportAddressImpl : public nsIImportAddressBooks
|
||||
{
|
||||
|
@ -126,6 +130,9 @@ nsTextImport::nsTextImport()
|
|||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
// Init logging module.
|
||||
if (!TEXTIMPORTLOGMODULE)
|
||||
TEXTIMPORTLOGMODULE = PR_NewLogModule("IMPORT");
|
||||
IMPORT_LOG0( "nsTextImport Module Created\n");
|
||||
|
||||
nsTextStringBundle::GetStringBundle();
|
||||
|
@ -489,12 +496,9 @@ NS_IMETHODIMP ImportAddressImpl::ImportAddressBook( nsIImportABDescriptor *pSour
|
|||
return( NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
#ifdef IMPORT_DEBUG
|
||||
char *pPath;
|
||||
inFile->GetNativePath( &pPath);
|
||||
IMPORT_LOG1( "Import address book: %s\n", pPath);
|
||||
nsCRT::free( pPath);
|
||||
#endif
|
||||
nsXPIDLCString pPath;
|
||||
inFile->GetNativePath(getter_Copies(pPath));
|
||||
IMPORT_LOG1( "Importing address book: %s\n", pPath.get());
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
PRBool isLDIF = PR_FALSE;
|
||||
|
@ -695,7 +699,7 @@ NS_IMETHODIMP ImportAddressImpl::InitFieldMap(nsIFileSpec *location, nsIImportFi
|
|||
// from the same file format.
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &rv));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED( rv)) {
|
||||
nsXPIDLCString prefStr;
|
||||
rv = prefs->CopyCharPref( "mailnews.import.text.fieldmap", getter_Copies(prefStr));
|
||||
|
@ -774,7 +778,7 @@ void ImportAddressImpl::SaveFieldMap( nsIImportFieldMap *pMap)
|
|||
PRBool done = PR_FALSE;
|
||||
nsresult rv;
|
||||
// NS_WITH_PROXIED_SERVICE( nsIPref, prefs, kPrefServiceCID, NS_UI_THREAD_EVENTQ, &rv);
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &rv));
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
|
||||
if (NS_SUCCEEDED( rv)) {
|
||||
nsXPIDLCString prefStr;
|
||||
|
|
Загрузка…
Ссылка в новой задаче