Beispiel #1
0
NS_IMETHODIMP ImportOutlookAddressImpl::FindAddressBooks(nsIFile *location, nsISupportsArray **_retval)
{
  NS_PRECONDITION(_retval != nsnull, "null ptr");
  if (!_retval)
    return NS_ERROR_NULL_POINTER;

  return m_address.GetAddressBooks(_retval);
}
Beispiel #2
0
NS_IMETHODIMP ImportOutlookMailImpl::FindMailboxes(nsIFile *pLoc, nsISupportsArray **ppArray)
{
  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);
}
Beispiel #3
0
NS_IMETHODIMP ImportOutlookMailImpl::ImportMailbox(  nsIImportMailboxDescriptor *pSource,
        nsIFile *pDestination,
        PRUnichar **pErrorLog,
        PRUnichar **pSuccessLog,
        PRBool *fatalError)
{
    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;
        NS_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);
}
Beispiel #4
0
NS_IMETHODIMP ImportOutlookAddressImpl::ImportAddressBook(nsIImportABDescriptor *source,
        nsIAddrDatabase *destination,
        nsIImportFieldMap *fieldMap,
        nsISupports *aSupportService,
        PRBool isAddrLocHome,
        PRUnichar **pErrorLog,
        PRUnichar **pSuccessLog,
        PRBool *fatalError)
{
    m_msgCount = 0;
    m_msgTotal = 0;
    NS_PRECONDITION(source != nsnull, "null ptr");
    NS_PRECONDITION(destination != nsnull, "null ptr");
    NS_PRECONDITION(fatalError != nsnull, "null ptr");

    nsCOMPtr<nsIStringBundle> bundle( dont_AddRef( nsOutlookStringBundle::GetStringBundleProxy()));

    nsString  success;
    nsString  error;
    if (!source || !destination || !fatalError) {
        IMPORT_LOG0( "*** Bad param passed to outlook address import\n");
        nsOutlookStringBundle::GetStringByID( OUTLOOKIMPORT_ADDRESS_BADPARAM, error, bundle);
        if (fatalError)
            *fatalError = PR_TRUE;
        ImportOutlookMailImpl::SetLogs( success, error, pErrorLog, pSuccessLog);
        return NS_ERROR_NULL_POINTER;
    }

    nsString name;
    source->GetPreferredName(name);

    PRUint32  id;
    if (NS_FAILED( source->GetIdentifier( &id))) {
        ImportOutlookMailImpl::ReportError( OUTLOOKIMPORT_ADDRESS_BADSOURCEFILE, name, &error);
        ImportOutlookMailImpl::SetLogs( success, error, pErrorLog, pSuccessLog);
        return( NS_ERROR_FAILURE);
    }

    nsresult rv = NS_OK;
    rv = m_address.ImportAddresses( &m_msgCount, &m_msgTotal, name.get(), id, destination, error);
    if (NS_SUCCEEDED( rv) && error.IsEmpty())
        ReportSuccess( name, &success);
    else
        ImportOutlookMailImpl::ReportError( OUTLOOKIMPORT_ADDRESS_CONVERTERROR, name, &error);

    ImportOutlookMailImpl::SetLogs( success, error, pErrorLog, pSuccessLog);
    IMPORT_LOG0( "*** Returning from outlook address import\n");
    return destination->Commit(nsAddrDBCommitType::kLargeCommit);
}
Beispiel #5
0
NS_IMETHODIMP
ImportOutlookMailImpl::ImportMailbox(nsIImportMailboxDescriptor *pSource,
                                     nsIMsgFolder *dstFolder,
                                     PRUnichar **pErrorLog,
                                     PRUnichar **pSuccessLog,
                                     bool *fatalError)
{
  NS_ENSURE_ARG_POINTER(pSource);
  NS_ENSURE_ARG_POINTER(dstFolder);
  NS_ENSURE_ARG_POINTER(fatalError);

  nsString  success;
  nsString  error;
  bool abort = false;
  nsString name;
  PRUnichar *pName;
  if (NS_SUCCEEDED( pSource->GetDisplayName( &pName))) {
    name = pName;
    NS_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(),
                            dstFolder, &msgCount);

  if (NS_SUCCEEDED(rv))
    ReportSuccess(name, msgCount, &success);
  else
    ReportError(OUTLOOKIMPORT_MAILBOX_CONVERTERROR, name, &error);

  SetLogs(success, error, pErrorLog, pSuccessLog);

  return rv;
}