Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes
ImportEudoraMailImpl Class Reference
Inheritance diagram for ImportEudoraMailImpl:
Inheritance graph
[legend]
Collaboration diagram for ImportEudoraMailImpl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ImportEudoraMailImpl ()
virtual ~ImportEudoraMailImpl ()
NS_DECL_ISUPPORTS NS_IMETHOD GetDefaultLocation (nsIFileSpec **location, PRBool *found, PRBool *userVerify)
NS_IMETHOD FindMailboxes (nsIFileSpec *location, nsISupportsArray **_retval)
NS_IMETHOD ImportMailbox (nsIImportMailboxDescriptor *source, nsIFileSpec *destination, PRUnichar **pErrorLog, PRUnichar **pSuccessLog, PRBool *fatalError)
NS_IMETHOD GetImportProgress (PRUint32 *_retval)
NS_IMETHOD TranslateFolderName (const nsAString &aFolderName, nsAString &_retval)
void GetDefaultLocation (out nsIFileSpec location, out boolean found, out boolean userVerify)
nsISupportsArray FindMailboxes (in nsIFileSpec location)
void ImportMailbox (in nsIImportMailboxDescriptor source, in nsIFileSpec destination, out wstring errorLog, out wstring successLog, out boolean fatalError)
unsigned long GetImportProgress ()
AString translateFolderName (in AString aFolderName)

Static Public Member Functions

static nsresult Create (nsIImportMail **aImport)
static void AddLinebreak (nsString *pStream)
static void SetLogs (nsString &success, nsString &error, PRUnichar **pError, PRUnichar **pSuccess)
static void ReportError (PRInt32 errorNum, nsString &name, nsString *pStream)

Static Private Member Functions

static void ReportSuccess (nsString &name, PRInt32 count, nsString *pStream)

Private Attributes

PRUint32 m_bytes

Detailed Description

Definition at line 90 of file nsEudoraImport.cpp.


Constructor & Destructor Documentation

Definition at line 360 of file nsEudoraImport.cpp.

{
}

Here is the caller graph for this function:

Definition at line 365 of file nsEudoraImport.cpp.

{
}

Member Function Documentation

Definition at line 424 of file nsEudoraImport.cpp.

{
       if (pStream)
              pStream->Append( PRUnichar(nsCRT::LF));
}

Here is the caller graph for this function:

Definition at line 346 of file nsEudoraImport.cpp.

{
    NS_PRECONDITION(aImport != nsnull, "null ptr");
    if (! aImport)
        return NS_ERROR_NULL_POINTER;

    *aImport = new ImportEudoraMailImpl();
    if (! *aImport)
        return NS_ERROR_OUT_OF_MEMORY;

    NS_ADDREF(*aImport);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 403 of file nsEudoraImport.cpp.

{
    NS_PRECONDITION(pLoc != nsnull, "null ptr");
    NS_PRECONDITION(ppArray != nsnull, "null ptr");
    if (!pLoc || !ppArray)
        return NS_ERROR_NULL_POINTER;
       
       PRBool exists = PR_FALSE;
       nsresult rv = pLoc->Exists( &exists);
       if (NS_FAILED( rv) || !exists)
              return( NS_ERROR_FAILURE);

       rv = m_eudora.FindMailboxes( pLoc, ppArray);
       if (NS_FAILED( rv) && *ppArray) {
              NS_RELEASE( *ppArray);
              *ppArray = nsnull;
       }
       
       return( rv);
}
void nsIImportMail::GetDefaultLocation ( out nsIFileSpec  location,
out boolean  found,
out boolean  userVerify 
) [inherited]

Here is the caller graph for this function:

NS_IMETHODIMP ImportEudoraMailImpl::GetDefaultLocation ( nsIFileSpec **  location,
PRBool found,
PRBool userVerify 
)

Definition at line 373 of file nsEudoraImport.cpp.

{
    NS_PRECONDITION(ppLoc != nsnull, "null ptr");
    NS_PRECONDITION(found != nsnull, "null ptr");
    NS_PRECONDITION(userVerify != nsnull, "null ptr");
    if (!ppLoc || !found || !userVerify)
        return NS_ERROR_NULL_POINTER;
       
       *ppLoc = nsnull;

       nsresult      rv;
       nsIFileSpec * spec;
       if (NS_FAILED( rv = NS_NewFileSpec( &spec)))
              return( rv);
       
       *found = m_eudora.FindMailFolder( spec);
       
       if (!*found) {
              NS_RELEASE( spec);
       }
       else {
              *ppLoc = spec;
       }

       *userVerify = PR_TRUE;

       return( NS_OK);
}

Here is the call graph for this function:

unsigned long nsIImportMail::GetImportProgress ( ) [inherited]

Here is the caller graph for this function:

Definition at line 551 of file nsEudoraImport.cpp.

{ 
    NS_PRECONDITION(pDoneSoFar != nsnull, "null ptr");
    if (! pDoneSoFar)
        return NS_ERROR_NULL_POINTER;
       
       *pDoneSoFar = m_bytes;
       return( NS_OK);
}
void nsIImportMail::ImportMailbox ( in nsIImportMailboxDescriptor  source,
in nsIFileSpec  destination,
out wstring  errorLog,
out wstring  successLog,
out boolean  fatalError 
) [inherited]

Here is the caller graph for this function:

NS_IMETHODIMP ImportEudoraMailImpl::ImportMailbox ( nsIImportMailboxDescriptor source,
nsIFileSpec destination,
PRUnichar **  pErrorLog,
PRUnichar **  pSuccessLog,
PRBool fatalError 
)

Definition at line 469 of file nsEudoraImport.cpp.

{
    NS_PRECONDITION(pSource != nsnull, "null ptr");
    NS_PRECONDITION(pDestination != nsnull, "null ptr");
    NS_PRECONDITION(fatalError != nsnull, "null ptr");


       nsCOMPtr<nsIStringBundle> bundle( dont_AddRef( nsEudoraStringBundle::GetStringBundleProxy()));
       
       nsString      success;
       nsString      error;
    if (!pSource || !pDestination || !fatalError) {
              IMPORT_LOG0( "*** Bad param passed to eudora mailbox import\n");
              nsEudoraStringBundle::GetStringByID( EUDORAIMPORT_MAILBOX_BADPARAM, error, bundle);
              if (fatalError)
                     *fatalError = PR_TRUE;
              SetLogs( success, error, pErrorLog, pSuccessLog);
           return NS_ERROR_NULL_POINTER;
       }
      
    PRBool           abort = PR_FALSE;
    nsString  name;
    PRUnichar *      pName;
    if (NS_SUCCEEDED( pSource->GetDisplayName( &pName))) {
       name = pName;
       nsCRT::free( pName);
    }
    
       PRUint32 mailSize = 0;
       pSource->GetSize( &mailSize);
       if (mailSize == 0) {
              IMPORT_LOG0( "Mailbox size is 0, skipping mailbox.\n");
              ReportSuccess( name, 0, &success);
              SetLogs( success, error, pErrorLog, pSuccessLog);
              return( NS_OK);
       }

    
       nsIFileSpec   *      inFile;
    if (NS_FAILED( pSource->GetFileSpec( &inFile))) {
              ReportError( EUDORAIMPORT_MAILBOX_BADSOURCEFILE, 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
       
           
       PRInt32       msgCount = 0;
    nsresult rv = NS_OK;
       
       m_bytes = 0;
       rv = m_eudora.ImportMailbox( &m_bytes, &abort, name.get(), inFile, pDestination, &msgCount);

    inFile->Release();

           
    
       if (NS_SUCCEEDED( rv)) {
              ReportSuccess( name, msgCount, &success);
       }
       else {
              ReportError( EUDORAIMPORT_MAILBOX_CONVERTERROR, name, &error);
       }

       SetLogs( success, error, pErrorLog, pSuccessLog);

       IMPORT_LOG0( "*** Returning from eudora mailbox import\n");

    return( rv);
}

Here is the call graph for this function:

void ImportEudoraMailImpl::ReportError ( PRInt32  errorNum,
nsString name,
nsString pStream 
) [static]

Definition at line 445 of file nsEudoraImport.cpp.

{
       if (!pStream)
              return;
       // load the error string
       nsIStringBundle *pBundle = nsEudoraStringBundle::GetStringBundleProxy();
       PRUnichar *pFmt = nsEudoraStringBundle::GetStringByID( errorNum);
       PRUnichar *pText = nsTextFormatter::smprintf( pFmt, name.get());
       pStream->Append( pText);
       nsTextFormatter::smprintf_free( pText);
       nsEudoraStringBundle::FreeString( pFmt);
       AddLinebreak( pStream);
       NS_IF_RELEASE( pBundle);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ImportEudoraMailImpl::ReportSuccess ( nsString name,
PRInt32  count,
nsString pStream 
) [static, private]

Definition at line 430 of file nsEudoraImport.cpp.

{
       if (!pStream)
              return;
       // load the success string
       nsIStringBundle *pBundle = nsEudoraStringBundle::GetStringBundleProxy();
       PRUnichar *pFmt = nsEudoraStringBundle::GetStringByID( EUDORAIMPORT_MAILBOX_SUCCESS, pBundle);
       PRUnichar *pText = nsTextFormatter::smprintf( pFmt, name.get(), count);
       pStream->Append( pText);
       nsTextFormatter::smprintf_free( pText);
       nsEudoraStringBundle::FreeString( pFmt);
       AddLinebreak( pStream);
       NS_IF_RELEASE( pBundle);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ImportEudoraMailImpl::SetLogs ( nsString success,
nsString error,
PRUnichar **  pError,
PRUnichar **  pSuccess 
) [static]

Definition at line 461 of file nsEudoraImport.cpp.

{
       if (pError)
              *pError = ToNewUnicode(error);
       if (pSuccess)
              *pSuccess = ToNewUnicode(success);
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP ImportEudoraMailImpl::TranslateFolderName ( const nsAString &  aFolderName,
nsAString &  _retval 
)

Definition at line 562 of file nsEudoraImport.cpp.

{
    if (aFolderName.Equals(NS_LITERAL_STRING("Out"), nsCaseInsensitiveStringComparator()))
        _retval = NS_LITERAL_STRING(kDestUnsentMessagesFolderName);
    else if (aFolderName.Equals(NS_LITERAL_STRING("In"), nsCaseInsensitiveStringComparator()))
        _retval = NS_LITERAL_STRING(kDestInboxFolderName);
    else
    _retval = aFolderName; 
    return NS_OK;
}
AString nsIImportMail::translateFolderName ( in AString  aFolderName) [inherited]

Member Data Documentation

Definition at line 134 of file nsEudoraImport.cpp.


The documentation for this class was generated from the following file: