Back to index

lightning-sunbird  0.9+nobinonly
Static Public Member Functions | Static Private Member Functions
CImportMailbox Class Reference

#include <nsOEMailbox.h>

List of all members.

Static Public Member Functions

static PRBool ImportMailbox (PRUint32 *pDone, PRBool *pAbort, nsString &name, nsIFileSpec *inFile, nsIFileSpec *outFile, PRUint32 *pCount)

Static Private Member Functions

static PRBool GetIndexFile (nsIFileSpec *mbxFile)

Detailed Description

Definition at line 46 of file nsOEMailbox.h.


Member Function Documentation

PRBool CImportMailbox::GetIndexFile ( nsIFileSpec mbxFile) [static, private]

Definition at line 169 of file nsOEMailbox.cpp.

{
  char *pLeaf = nsnull;
  if (NS_FAILED( file->GetLeafName( &pLeaf)))
    return( PR_FALSE);
  PRInt32     len = strlen( pLeaf);
  if (len < 5) {
    nsCRT::free( pLeaf);
    return( PR_FALSE);
  }
  pLeaf[len - 1] = 'x';
  pLeaf[len - 2] = 'd';
  pLeaf[len - 3] = 'i';
  
  IMPORT_LOG1( "Looking for index leaf name: %s\n", pLeaf);
  
  nsresult    rv;
  rv = file->SetLeafName( pLeaf);
  nsCRT::free( pLeaf);
  
  PRBool      isFile = PR_FALSE;
  PRBool      exists = PR_FALSE;
  if (NS_SUCCEEDED( rv)) rv = file->IsFile( &isFile);
  if (NS_SUCCEEDED( rv)) rv = file->Exists( &exists);
              
  if (isFile && exists)
    return( PR_TRUE);
  else
    return( PR_FALSE);
}

Here is the caller graph for this function:

PRBool CImportMailbox::ImportMailbox ( PRUint32 pDone,
PRBool pAbort,
nsString name,
nsIFileSpec inFile,
nsIFileSpec outFile,
PRUint32 pCount 
) [static]

Definition at line 112 of file nsOEMailbox.cpp.

{
  PRBool  done = PR_FALSE;
  nsIFileSpec *idxFile;
  if (NS_FAILED( NS_NewFileSpec( &idxFile))) {
    IMPORT_LOG0( "New file spec failed!\n");
    return( PR_FALSE);
  }
  
  idxFile->FromFileSpec( inFile);
  if (GetIndexFile( idxFile)) {
    
    IMPORT_LOG1( "Using index file for: %S\n", name.get());
                            
    CIndexScanner *pIdxScanner = new CIndexScanner( name, idxFile, inFile, outFile);
    if (pIdxScanner->Initialize()) {
      if (pIdxScanner->DoWork( pAbort, pDone, pCount)) {
        done = PR_TRUE;
      }
      else {
        IMPORT_LOG0( "CIndexScanner::DoWork() failed\n");
      }
    }
    else {
      IMPORT_LOG0( "CIndexScanner::Initialize() failed\n");
    }
    
    delete pIdxScanner;
  }
  
  idxFile->Release();
  
  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, pDone, pCount)) {
      done = PR_TRUE;
    }
    else {
      IMPORT_LOG0( "CMbxScanner::DoWork() failed\n");
    }
  }
  else {
    IMPORT_LOG0( "CMbxScanner::Initialize() failed\n");
  }
  
  delete pMbx;
  return( done);            
}

Here is the call graph for this function:

Here is the caller graph for this function:


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