当前位置: 首页>>代码示例>>C++>>正文


C++ nsEudoraWin32::ImportMailbox方法代码示例

本文整理汇总了C++中nsEudoraWin32::ImportMailbox方法的典型用法代码示例。如果您正苦于以下问题:C++ nsEudoraWin32::ImportMailbox方法的具体用法?C++ nsEudoraWin32::ImportMailbox怎么用?C++ nsEudoraWin32::ImportMailbox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nsEudoraWin32的用法示例。


在下文中一共展示了nsEudoraWin32::ImportMailbox方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ReportSuccess

NS_IMETHODIMP
ImportEudoraMailImpl::ImportMailbox(nsIImportMailboxDescriptor *pSource,
                                    nsIMsgFolder *pDstFolder,
                                    PRUnichar **pErrorLog,
                                    PRUnichar **pSuccessLog,
                                    bool *fatalError)
{
  NS_ENSURE_ARG_POINTER(pSource);
  NS_ENSURE_ARG_POINTER(pDstFolder);
  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)
  {
    IMPORT_LOG0("Mailbox size is 0, skipping mailbox.\n");
    ReportSuccess(name, 0, &success);
    SetLogs(success, error, pErrorLog, pSuccessLog);
    return NS_OK;
  }


  nsCOMPtr <nsIFile>  inFile;
  if (NS_FAILED(pSource->GetFile(getter_AddRefs(inFile))))
  {
    ReportError(EUDORAIMPORT_MAILBOX_BADSOURCEFILE, name, &error);
    SetLogs(success, error, pErrorLog, pSuccessLog);
    return NS_ERROR_FAILURE;
  }

#ifdef IMPORT_DEBUG
  nsCString pPath;
  inFile->GetNativePath(pPath);
  IMPORT_LOG1("Import mailbox: %s\n", pPath.get());
#endif


  PRInt32  msgCount = 0;
  nsresult rv = NS_OK;

  m_bytes = 0;
  rv = m_eudora.ImportMailbox( &m_bytes, &abort, name.get(), inFile, pDstFolder, &msgCount);
  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;
}
开发者ID:,项目名称:,代码行数:64,代码来源:

示例2: ImportMailbox

NS_IMETHODIMP ImportEudoraMailImpl::ImportMailbox(nsIImportMailboxDescriptor *pSource,
            nsIFile *pDestination,
            PRUnichar **pErrorLog,
            PRUnichar **pSuccessLog,
            bool *fatalError)
{
  NS_PRECONDITION(pSource != nsnull, "null ptr");
  NS_PRECONDITION(pDestination != nsnull, "null ptr");
  NS_PRECONDITION(fatalError != nsnull, "null ptr");

  nsString  success;
  nsString  error;
  if (!pSource || !pDestination || !fatalError)
  {
    IMPORT_LOG0( "*** Bad param passed to eudora mailbox import\n");
    nsEudoraStringBundle::GetStringByID( EUDORAIMPORT_MAILBOX_BADPARAM, error);
    if (fatalError)
      *fatalError = true;
    SetLogs( success, error, pErrorLog, pSuccessLog);
    return NS_ERROR_NULL_POINTER;
  }

  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)
  {
    IMPORT_LOG0( "Mailbox size is 0, skipping mailbox.\n");
    ReportSuccess( name, 0, &success);
    SetLogs( success, error, pErrorLog, pSuccessLog);
    return( NS_OK);
  }


  nsCOMPtr <nsILocalFile>  inFile;
  if (NS_FAILED(pSource->GetFile( getter_AddRefs(inFile))))
  {
    ReportError( EUDORAIMPORT_MAILBOX_BADSOURCEFILE, name, &error);
    SetLogs( success, error, pErrorLog, pSuccessLog);
    return( NS_ERROR_FAILURE);
  }

#ifdef IMPORT_DEBUG
  nsCString pPath;
  inFile->GetNativePath(pPath);
  IMPORT_LOG1( "Import mailbox: %s\n", pPath.get());
#endif


  PRInt32  msgCount = 0;
  nsresult rv = NS_OK;

  m_bytes = 0;
  rv = m_eudora.ImportMailbox( &m_bytes, &abort, name.get(), inFile, pDestination, &msgCount);
  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);
}
开发者ID:vanto,项目名称:comm-central,代码行数:73,代码来源:nsEudoraImport.cpp


注:本文中的nsEudoraWin32::ImportMailbox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。