Back to index

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

List of all members.

Public Member Functions

 ImportOutlookMailImpl ()
virtual ~ImportOutlookMailImpl ()
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 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)

Private Attributes

nsOutlookMail m_mail
PRUint32 m_bytesDone

Detailed Description

Definition at line 84 of file nsOutlookImport.cpp.


Constructor & Destructor Documentation

Definition at line 344 of file nsOutlookImport.cpp.

{
}

Here is the caller graph for this function:

Definition at line 349 of file nsOutlookImport.cpp.

{
}

Member Function Documentation

Definition at line 408 of file nsOutlookImport.cpp.

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

Here is the caller graph for this function:

Definition at line 330 of file nsOutlookImport.cpp.

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

    *aImport = new ImportOutlookMailImpl();
    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 398 of file nsOutlookImport.cpp.

{
    NS_PRECONDITION(pLoc != nsnull, "null ptr");
    NS_PRECONDITION(ppArray != nsnull, "null ptr");
    if (!pLoc || !ppArray)
        return NS_ERROR_NULL_POINTER;
       
       return( m_mail.GetMailFolders( ppArray));
}

Here is the call graph for this function:

void nsIImportMail::GetDefaultLocation ( out nsIFileSpec  location,
out boolean  found,
out boolean  userVerify 
) [inherited]

Here is the caller graph for this function:

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

Definition at line 357 of file nsOutlookImport.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;
       

       *found = PR_FALSE;
       *ppLoc = nsnull;
       *userVerify = PR_FALSE;
       // We need to verify here that we can get the mail, if true then
       // return a dummy location, otherwise return no location
       CMapiApi      mapi;
       if (!mapi.Initialize())
              return( NS_OK);
       if (!mapi.LogOn())
              return( NS_OK);

       CMapiFolderList      store;
       if (!mapi.IterateStores( store))
              return( NS_OK);

       if (store.GetSize() == 0)
              return( NS_OK);


       nsresult      rv;
       nsIFileSpec * spec;
       if (NS_FAILED( rv = NS_NewFileSpec( &spec)))
              return( rv);
       
       *found = PR_TRUE;
       *ppLoc = spec;
       *userVerify = PR_FALSE;

       return( NS_OK);
}

Here is the call graph for this function:

Definition at line 513 of file nsOutlookImport.cpp.

{ 
    NS_PRECONDITION(pDoneSoFar != nsnull, "null ptr");
    if (! pDoneSoFar)
        return NS_ERROR_NULL_POINTER;
       
       *pDoneSoFar = m_bytesDone;
       return( NS_OK);
}
unsigned long nsIImportMail::GetImportProgress ( ) [inherited]

Here is the caller graph for this function:

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 ImportOutlookMailImpl::ImportMailbox ( nsIImportMailboxDescriptor source,
nsIFileSpec destination,
PRUnichar **  pErrorLog,
PRUnichar **  pSuccessLog,
PRBool fatalError 
)

Definition at line 453 of file nsOutlookImport.cpp.

{
    NS_PRECONDITION(pSource != nsnull, "null ptr");
    NS_PRECONDITION(pDestination != nsnull, "null ptr");
    NS_PRECONDITION(fatalError != nsnull, "null ptr");
       
       nsCOMPtr<nsIStringBundle>   bundle( dont_AddRef( nsOutlookStringBundle::GetStringBundleProxy()));

       nsString      success;
       nsString      error;
    if (!pSource || !pDestination || !fatalError) {
              nsOutlookStringBundle::GetStringByID( OUTLOOKIMPORT_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) {
              ReportSuccess( name, 0, &success);
              SetLogs( success, error, pErrorLog, pSuccessLog);
              return( NS_OK);
       }
       
       PRUint32 index = 0;
       pSource->GetIdentifier( &index);
       PRInt32       msgCount = 0;
    nsresult rv = NS_OK;

       m_bytesDone = 0;

       rv = m_mail.ImportMailbox( &m_bytesDone, &abort, (PRInt32)index, name.get(), pDestination, &msgCount);
    
       if (NS_SUCCEEDED( rv)) {
              ReportSuccess( name, msgCount, &success);
       }
       else {
              ReportError( OUTLOOKIMPORT_MAILBOX_CONVERTERROR, name, &error);
       }

       SetLogs( success, error, pErrorLog, pSuccessLog);

    return( rv);
}

Here is the call graph for this function:

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

Definition at line 429 of file nsOutlookImport.cpp.

{
       if (!pStream)
              return;
       // load the error string
       nsIStringBundle *pBundle = nsOutlookStringBundle::GetStringBundleProxy();
       PRUnichar *pFmt = nsOutlookStringBundle::GetStringByID( errorNum);
       PRUnichar *pText = nsTextFormatter::smprintf( pFmt, name.get());
       pStream->Append( pText);
       nsTextFormatter::smprintf_free( pText);
       nsOutlookStringBundle::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 ImportOutlookMailImpl::ReportSuccess ( nsString name,
PRInt32  count,
nsString pStream 
) [static]

Definition at line 414 of file nsOutlookImport.cpp.

{
       if (!pStream)
              return;
       // load the success string
       nsIStringBundle *pBundle = nsOutlookStringBundle::GetStringBundleProxy();
       PRUnichar *pFmt = nsOutlookStringBundle::GetStringByID( OUTLOOKIMPORT_MAILBOX_SUCCESS, pBundle);
       PRUnichar *pText = nsTextFormatter::smprintf( pFmt, name.get(), count);
       pStream->Append( pText);
       nsTextFormatter::smprintf_free( pText);
       nsOutlookStringBundle::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 ImportOutlookMailImpl::SetLogs ( nsString success,
nsString error,
PRUnichar **  pError,
PRUnichar **  pSuccess 
) [static]

Definition at line 445 of file nsOutlookImport.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 ImportOutlookMailImpl::TranslateFolderName ( const nsAString &  aFolderName,
nsAString &  _retval 
)

Definition at line 523 of file nsOutlookImport.cpp.

{
    if (aFolderName.Equals(NS_LITERAL_STRING("Deleted Items"), nsCaseInsensitiveStringComparator()))
        _retval = NS_LITERAL_STRING(kDestTrashFolderName);
    else if (aFolderName.Equals(NS_LITERAL_STRING("Sent Items"), nsCaseInsensitiveStringComparator()))
        _retval = NS_LITERAL_STRING(kDestSentFolderName);
    else if (aFolderName.Equals(NS_LITERAL_STRING("Outbox"), nsCaseInsensitiveStringComparator()))
        _retval = NS_LITERAL_STRING(kDestUnsentMessagesFolderName);
    else
  _retval = aFolderName; 
  return NS_OK;
}
AString nsIImportMail::translateFolderName ( in AString  aFolderName) [inherited]

Member Data Documentation

Definition at line 120 of file nsOutlookImport.cpp.

Definition at line 119 of file nsOutlookImport.cpp.


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