本文整理汇总了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;
}
示例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);
}