本文整理汇总了C++中IMPORT_LOG1函数的典型用法代码示例。如果您正苦于以下问题:C++ IMPORT_LOG1函数的具体用法?C++ IMPORT_LOG1怎么用?C++ IMPORT_LOG1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IMPORT_LOG1函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: smtpService
void nsEudoraWin32::SetSmtpServer( nsIMsgAccountManager *pMgr, nsIMsgAccount *pAcc, const char *pServer, const char *pUser)
{
nsresult rv;
nsCOMPtr<nsISmtpService> smtpService(do_GetService(NS_SMTPSERVICE_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv) && smtpService)
{
nsCOMPtr<nsISmtpServer> foundServer;
rv = smtpService->FindServer( pUser, pServer, getter_AddRefs( foundServer));
if (NS_SUCCEEDED( rv) && foundServer)
{
IMPORT_LOG1( "SMTP server already exists: %s\n", pServer);
return;
}
nsCOMPtr<nsISmtpServer> smtpServer;
rv = smtpService->CreateSmtpServer( getter_AddRefs( smtpServer));
if (NS_SUCCEEDED( rv) && smtpServer)
{
smtpServer->SetHostname( pServer);
if (pUser)
smtpServer->SetUsername( pUser);
IMPORT_LOG1( "Created new SMTP server: %s\n", pServer);
}
}
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:28,代码来源:nsEudoraWin32.cpp
示例2: DumpAliasArray
void DumpAliasArray( nsVoidArray& a)
{
CAliasEntry *pEntry;
CAliasData *pData;
PRInt32 cnt = a.Count();
IMPORT_LOG1( "Alias list size: %ld\n", cnt);
for (PRInt32 i = 0; i < cnt; i++) {
pEntry = (CAliasEntry *)a.ElementAt( i);
IMPORT_LOG1( "\tAlias: %s\n", pEntry->m_name.get());
if (pEntry->m_list.Count() > 1) {
IMPORT_LOG1( "\tList count #%ld\n", pEntry->m_list.Count());
for (PRInt32 j = 0; j < pEntry->m_list.Count(); j++) {
pData = (CAliasData *) pEntry->m_list.ElementAt( j);
IMPORT_LOG0( "\t\t--------\n");
IMPORT_LOG1( "\t\temail: %s\n", pData->m_email.get());
IMPORT_LOG1( "\t\trealName: %s\n", pData->m_realName.get());
IMPORT_LOG1( "\t\tnickName: %s\n", pData->m_nickName.get());
}
}
else if (pEntry->m_list.Count()) {
pData = (CAliasData *) pEntry->m_list.ElementAt( 0);
IMPORT_LOG1( "\t\temail: %s\n", pData->m_email.get());
IMPORT_LOG1( "\t\trealName: %s\n", pData->m_realName.get());
IMPORT_LOG1( "\t\tnickName: %s\n", pData->m_nickName.get());
}
}
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:28,代码来源:nsEudoraAddress.cpp
示例3: IMPORT_LOG0
void WMSettings::SetIdentities(nsIMsgAccountManager *pMgr, nsIMsgAccount *pAcc,
nsIDOMDocument *xmlDoc, nsAutoString &inUserName,
int32_t authMethodIncoming, bool isNNTP)
{
// Get the relevant information for an identity
// BUG 470587. Don't set this: id->SetIdentityName(fullName);
nsresult rv;
nsAutoString value;
nsCOMPtr<nsIMsgIdentity> id;
rv = pMgr->CreateIdentity(getter_AddRefs(id));
if (id) {
IMPORT_LOG0("Created identity and added to the account\n");
if (NS_SUCCEEDED(nsWMUtils::GetValueForTag(xmlDoc,
isNNTP ?
"NNTP_Display_Name" :
"SMTP_Display_Name",
value))) {
id->SetFullName(value);
IMPORT_LOG1("\tname: %S\n", value.get());
}
if (NS_SUCCEEDED(nsWMUtils::GetValueForTag(xmlDoc,
isNNTP ?
"NNTP_Organization_Name" :
"SMTP_Organization_Name",
value))) {
id->SetOrganization(value);
}
if (NS_SUCCEEDED(nsWMUtils::GetValueForTag(xmlDoc,
isNNTP ?
"NNTP_Email_Address" :
"SMTP_Email_Address",
value))) {
id->SetEmail(NS_ConvertUTF16toUTF8(value));
IMPORT_LOG1("\temail: %S\n", value.get());
}
if (NS_SUCCEEDED(nsWMUtils::GetValueForTag(xmlDoc,
isNNTP ?
"NNTP_Reply_To_Email_Address" :
"SMTP_Reply_To_Email_Address",
value))) {
id->SetReplyTo(NS_ConvertUTF16toUTF8(value));
}
// Windows users are used to top style quoting.
id->SetReplyOnTop(isNNTP ? 0 : 1);
pAcc->AddIdentity(id);
}
if (!isNNTP) // NNTP does not use SMTP in OE or TB
SetSmtpServer(xmlDoc, id, inUserName, authMethodIncoming);
}
开发者ID:MoonchildProductions,项目名称:FossaMail,代码行数:55,代码来源:nsWMSettings.cpp
示例4: do_QueryInterface
PRBool nsOEScanBoxes::Find50Mail( nsIFile *pWhere)
{
nsresult rv;
PRBool success = PR_FALSE;
HKEY sKey;
nsCOMPtr <nsILocalFile> localWhere = do_QueryInterface(pWhere);
if (::RegOpenKeyEx( HKEY_CURRENT_USER, "Identities", 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS) {
BYTE * pBytes = nsOERegUtil::GetValueBytes( sKey, "Default User ID");
::RegCloseKey( sKey);
if (pBytes) {
nsCString key( "Identities\\");
key += (const char *)pBytes;
nsOERegUtil::FreeValueBytes( pBytes);
key += "\\Software\\Microsoft\\Outlook Express\\5.0";
if (::RegOpenKeyEx( HKEY_CURRENT_USER, key.get(), 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS) {
pBytes = nsOERegUtil::GetValueBytes( sKey, "Store Root");
if (pBytes) {
localWhere->InitWithNativePath(nsDependentCString((const char *)pBytes));
IMPORT_LOG1( "Setting native path: %s\n", pBytes);
nsOERegUtil::FreeValueBytes( pBytes);
PRBool isDir = PR_FALSE;
rv = pWhere->IsDirectory( &isDir);
if (isDir && NS_SUCCEEDED( rv))
success = PR_TRUE;
}
::RegCloseKey( sKey);
}
}
}
return( success);
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:35,代码来源:nsOEScanBoxes.cpp
示例5: IMPORT_LOG1
nsresult nsOEAddressIterator::EnumUser(const char16_t * pName, LPENTRYID pEid, ULONG cbEid)
{
IMPORT_LOG1("User: %S\n", pName);
nsresult rv = NS_OK;
if (m_database) {
LPMAILUSER pUser = m_pWab->GetUser(cbEid, pEid);
if (pUser) {
// Get a new row from the database!
nsCOMPtr <nsIMdbRow> newRow;
rv = m_database->GetNewRow(getter_AddRefs(newRow));
NS_ENSURE_SUCCESS(rv, rv);
if (newRow && BuildCard(pName, newRow, pUser))
{
rv = m_database->AddCardRowToDB(newRow);
NS_ENSURE_SUCCESS(rv, rv);
IMPORT_LOG0("* Added entry to address book database\n");
nsString eMail;
LPSPropValue pProp = m_pWab->GetUserProperty(pUser, PR_EMAIL_ADDRESS);
if (pProp)
{
m_pWab->GetValueString(pProp, eMail);
SanitizeValue(eMail);
m_pWab->FreeProperty(pProp);
m_listRows.Put(eMail, newRow);
}
}
m_pWab->ReleaseUser(pUser);
}
}
return rv;
}
开发者ID:MoonchildProductions,项目名称:FossaMail,代码行数:34,代码来源:nsOEAddressIterator.cpp
示例6: return
PRBool CImportMailbox::GetIndexFile( nsIFileSpec* file)
{
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);
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:30,代码来源:nsOEMailbox.cpp
示例7: IMPORT_LOG1
PRBool nsOEScanBoxes::GetMailboxes( nsIFile *pWhere, nsISupportsArray **pArray)
{
nsCString path;
pWhere->GetNativePath(path);
if (!path.IsEmpty()) {
IMPORT_LOG1( "Looking for mail in: %s\n", path.get());
}
else {
pWhere->GetNativeLeafName(path);
if (!path.IsEmpty())
IMPORT_LOG1( "Looking for mail in: %s\n", path.get());
else
IMPORT_LOG0( "Unable to get info about where to look for mail\n");
}
nsCOMPtr <nsIFile> location;
pWhere->Clone(getter_AddRefs(location));
// 1. Look for 5.0 folders.dbx
// 2. Look for 3.x & 4.x folders.nch
// 3. Look for 5.0 *.dbx mailboxes
// 4. Look for 3.x & 4.x *.mbx mailboxes
PRBool result;
location->AppendNative(NS_LITERAL_CSTRING("folders.dbx"));
if (Find50MailBoxes(location)) {
result = GetMailboxList( location, pArray);
}
else {
// 2. Look for 4.x mailboxes
location->AppendNative(NS_LITERAL_CSTRING("folders.nch"));
if (FindMailBoxes(location)) {
result = GetMailboxList( location, pArray);
}
else {
// 3 & 4, look for the specific mailbox files.
pWhere->Clone(getter_AddRefs(location));
ScanMailboxDir( location);
result = GetMailboxList( location, pArray);
}
}
return( result);
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:45,代码来源:nsOEScanBoxes.cpp
示例8: IMPORT_LOG0
PRBool CImportMailbox::ImportMailbox( PRUint32 *pDone, PRBool *pAbort, nsString& name, nsIFileSpec * inFile, nsIFileSpec * outFile, PRUint32 *pCount)
{
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);
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:55,代码来源:nsOEMailbox.cpp
示例9: GetServerAndUserName
PRBool nsEudoraWin32::BuildIMAPAccount( nsIMsgAccountManager *accMgr, const char *pSection, const char *pIni, nsIMsgAccount **ppAccount)
{
char valBuff[kIniValueSize];
nsCString serverName;
nsCString userName;
GetServerAndUserName( pSection, pIni, serverName, userName, valBuff);
if (serverName.IsEmpty() || userName.IsEmpty())
return( PR_FALSE);
PRBool result = PR_FALSE;
nsCOMPtr<nsIMsgIncomingServer> in;
nsresult rv = accMgr->FindServer( userName, serverName, NS_LITERAL_CSTRING("imap"), getter_AddRefs(in));
if (NS_FAILED( rv) || (in == nsnull))
{
// Create the incoming server and an account for it?
rv = accMgr->CreateIncomingServer( userName, serverName, NS_LITERAL_CSTRING("imap"), getter_AddRefs(in));
if (NS_SUCCEEDED( rv) && in)
{
rv = in->SetType(NS_LITERAL_CSTRING("imap"));
// rv = in->SetHostName( serverName);
// rv = in->SetUsername( userName);
IMPORT_LOG2( "Created IMAP server named: %s, userName: %s\n", serverName.get(), userName.get());
nsString prettyName;
GetAccountName( pSection, prettyName);
IMPORT_LOG1( "\tSet pretty name to: %S\n", prettyName.get());
rv = in->SetPrettyName(prettyName);
// We have a server, create an account.
nsCOMPtr<nsIMsgAccount> account;
rv = accMgr->CreateAccount( getter_AddRefs( account));
if (NS_SUCCEEDED( rv) && account)
{
rv = account->SetIncomingServer(in);
IMPORT_LOG0( "Created an account and set the IMAP server as the incoming server\n");
// Fiddle with the identities
SetIdentities(accMgr, account, pSection, pIni, userName.get(), serverName.get(), valBuff);
result = PR_TRUE;
if (ppAccount)
account->QueryInterface( NS_GET_IID(nsIMsgAccount), (void **)ppAccount);
}
}
}
else
result = PR_TRUE;
return( result);
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:54,代码来源:nsEudoraWin32.cpp
示例10: getter_AddRefs
void nsEudoraWin32::SetIdentities(nsIMsgAccountManager *accMgr, nsIMsgAccount *acc, const char *pSection, const char *pIniFile, const char *userName, const char *serverName, char *pBuff)
{
nsCAutoString realName;
nsCAutoString email;
nsCAutoString server;
DWORD valSize;
nsresult rv;
valSize = ::GetPrivateProfileString( pSection, "RealName", "", pBuff, kIniValueSize, pIniFile);
if (valSize)
realName = pBuff;
valSize = ::GetPrivateProfileString( pSection, "SMTPServer", "", pBuff, kIniValueSize, pIniFile);
if (valSize)
server = pBuff;
valSize = ::GetPrivateProfileString( pSection, "ReturnAddress", "", pBuff, kIniValueSize, pIniFile);
if (valSize)
email = pBuff;
nsCOMPtr<nsIMsgIdentity> id;
rv = accMgr->CreateIdentity( getter_AddRefs( id));
if (id)
{
nsAutoString fullName;
fullName.Assign(NS_ConvertASCIItoUTF16(realName));
id->SetFullName(fullName);
id->SetIdentityName(fullName);
if (email.IsEmpty())
{
email = userName;
email += "@";
email += serverName;
}
id->SetEmail(email);
acc->AddIdentity( id);
IMPORT_LOG0( "Created identity and added to the account\n");
IMPORT_LOG1( "\tname: %s\n", realName.get());
IMPORT_LOG1( "\temail: %s\n", email.get());
}
SetSmtpServer( accMgr, acc, server.get(), userName);
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:41,代码来源:nsEudoraWin32.cpp
示例11: DUMP_FILENAME
void DUMP_FILENAME(nsIFile *pFile, bool endLine)
{
nsCString pPath;
if (pFile)
pFile->GetNativePath(pPath);
if (!pPath.IsEmpty())
IMPORT_LOG1("%s", pPath.get());
else
IMPORT_LOG0("Unknown");
if (endLine)
IMPORT_LOG0("\n");
}
开发者ID:hsinyi,项目名称:releases-comm-central,代码行数:12,代码来源:nsEudoraMailbox.cpp
示例12: NS_CopyNativeToUnicode
nsresult nsEudoraWin32::FoundMailbox( nsIFile *mailFile, const char *pName, nsISupportsArray *pArray, nsIImportService *pImport)
{
nsString displayName;
nsCOMPtr<nsIImportMailboxDescriptor> desc;
nsISupports * pInterface;
NS_CopyNativeToUnicode(nsDependentCString(pName), displayName);
#ifdef IMPORT_DEBUG
nsCAutoString path;
mailFile->GetNativePath(path);
if (!path.IsEmpty())
IMPORT_LOG2( "Found eudora mailbox, %s: %s\n", path.get(), pName);
else
IMPORT_LOG1( "Found eudora mailbox, %s\n", pName);
IMPORT_LOG1( "\tm_depth = %d\n", (int)m_depth);
#endif
nsresult rv = pImport->CreateNewMailboxDescriptor( getter_AddRefs( desc));
if (NS_SUCCEEDED( rv))
{
PRInt64 sz = 0;
mailFile->GetFileSize( &sz);
desc->SetDisplayName( displayName.get());
desc->SetDepth( m_depth);
desc->SetSize( sz);
nsCOMPtr <nsILocalFile> pFile = nsnull;
desc->GetFile(getter_AddRefs(pFile));
if (pFile)
{
nsCOMPtr <nsILocalFile> localMailFile = do_QueryInterface(mailFile);
pFile->InitWithFile( localMailFile);
}
rv = desc->QueryInterface( kISupportsIID, (void **) &pInterface);
pArray->AppendElement( pInterface);
pInterface->Release();
}
return( NS_OK);
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:40,代码来源:nsEudoraWin32.cpp
示例13: sizeof
PRBool CMbxScanner::WriteMailItem( PRUint32 flags, PRUint32 offset, PRUint32 size, PRUint32 *pTotalMsgSize)
{
PRUint32 values[kNumMbxLongsToRead];
PRInt32 cnt = kNumMbxLongsToRead * sizeof( PRUint32);
nsresult rv;
PRBool failed = PR_FALSE;
PRInt32 cntRead;
PRInt8 * pChar = (PRInt8 *) values;
rv = m_mbxFile->Seek( offset);
m_mbxFile->Failed( &failed);
if (NS_FAILED( rv) || failed) {
IMPORT_LOG1( "Mbx seek error: 0x%lx\n", offset);
return( PR_FALSE);
}
rv = m_mbxFile->Read( (char **) &pChar, cnt, &cntRead);
if (NS_FAILED( rv) || (cntRead != cnt)) {
IMPORT_LOG1( "Mbx read error at: 0x%lx\n", offset);
return( PR_FALSE);
}
if (values[0] != 0x7F007F00) {
IMPORT_LOG2( "Mbx tag field doesn't match: 0x%lx, at offset: 0x%lx\n", values[0], offset);
return( PR_FALSE);
}
if (size && (values[2] != size)) {
IMPORT_LOG3( "Mbx size doesn't match idx, mbx: %ld, idx: %ld, at offset: 0x%lx\n", values[2], size, offset);
return( PR_FALSE);
}
if (pTotalMsgSize != nsnull)
*pTotalMsgSize = values[2];
// everything looks kosher...
// the actual message text follows and is values[3] bytes long...
return( CopyMbxFileBytes(flags, values[3]));
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:37,代码来源:nsOEMailbox.cpp
示例14: IMPORT_LOG0
/*
This is where the real work happens!
Go through the field map and set the data in a new database row
*/
nsresult nsTextAddress::ProcessLine(const nsAString &aLine, nsString& errors)
{
if (!m_fieldMap) {
IMPORT_LOG0("*** Error, text import needs a field map\n");
return NS_ERROR_FAILURE;
}
nsresult rv;
// Wait until we get our first non-empty field, then create a new row,
// fill in the data, then add the row to the database.
nsCOMPtr<nsIMdbRow> newRow;
nsAutoString fieldVal;
int32_t fieldNum;
int32_t numFields = 0;
bool active;
rv = m_fieldMap->GetMapSize(&numFields);
for (int32_t i = 0; (i < numFields) && NS_SUCCEEDED(rv); i++) {
active = false;
rv = m_fieldMap->GetFieldMap(i, &fieldNum);
if (NS_SUCCEEDED(rv))
rv = m_fieldMap->GetFieldActive(i, &active);
if (NS_SUCCEEDED(rv) && active) {
if (GetField(aLine, i, fieldVal, m_delim)) {
if (!fieldVal.IsEmpty()) {
if (!newRow) {
rv = m_database->GetNewRow(getter_AddRefs(newRow));
if (NS_FAILED(rv)) {
IMPORT_LOG0("*** Error getting new address database row\n");
}
}
if (newRow) {
rv = m_fieldMap->SetFieldValue(m_database, newRow, fieldNum, fieldVal.get());
}
}
}
else
break;
}
else if (active) {
IMPORT_LOG1("*** Error getting field map for index %ld\n", (long) i);
}
}
if (NS_SUCCEEDED(rv) && newRow)
rv = m_database->AddCardRowToDB(newRow);
return rv;
}
开发者ID:MoonchildProductions,项目名称:FossaMail,代码行数:53,代码来源:nsTextAddress.cpp
示例15: IMPORT_LOG1
bool nsEudoraMailbox::AddAttachment(nsCString& fileName)
{
IMPORT_LOG1("Found attachment: %s\n", fileName.get());
nsresult rv;
nsCOMPtr <nsIFile> pFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
if (NS_FAILED(rv))
return false;
nsCString mimeType;
nsCString attachmentName;
if (NS_FAILED(GetAttachmentInfo(fileName.get(), pFile, mimeType, attachmentName)))
return false;
ImportAttachment *a = new ImportAttachment;
a->mimeType = ToNewCString(mimeType);
a->description = !attachmentName.IsEmpty() ? ToNewCString(attachmentName) : strdup("Attached File");
a->pAttachment = pFile;
m_attachments.AppendElement(a);
return true;
}
开发者ID:hsinyi,项目名称:releases-comm-central,代码行数:23,代码来源:nsEudoraMailbox.cpp
示例16: NS_NewLocalFileInputStream
nsresult nsOE5File::ImportMailbox( PRUint32 *pBytesDone, PRBool *pAbort, nsString& name, nsIFile *inFile, nsIFile *pDestination, PRUint32 *pCount)
{
nsresult rv;
PRInt32 msgCount = 0;
if (pCount)
*pCount = 0;
nsCOMPtr <nsIInputStream> inputStream;
rv = NS_NewLocalFileInputStream(getter_AddRefs(inputStream), inFile);
if (NS_FAILED( rv)) return( rv);
nsCOMPtr <nsIOutputStream> outputStream;
rv = NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), pDestination, -1, 0600);
if (NS_FAILED( rv))
return( rv);
PRUint32 * pIndex;
PRUint32 indexSize;
if (!ReadIndex( inputStream, &pIndex, &indexSize)) {
IMPORT_LOG1( "No messages found in mailbox: %S\n", name.get());
return( NS_OK);
}
char * pBuffer = new char[kMailboxBufferSize];
if (!(*pAbort))
ConvertIndex( inputStream, pBuffer, pIndex, indexSize);
PRUint32 block[4];
PRInt32 sepLen = (PRInt32) strlen( m_pFromLineSep);
PRUint32 written;
/*
Each block is:
marker - matches file offset
block length
text length in block
pointer to next block. (0 if end)
Each message is made up of a linked list of block data.
So what we do for each message is:
1. Read the first block data.
2. Write out the From message separator if the message doesn't already
start with one.
3. If the block of data doesn't end with CRLF then a line is broken into two blocks,
so save the incomplete line for later process when we read the next block. Then
write out the block excluding the partial line at the end of the block (if exists).
4. If there's next block of data then read next data block. Otherwise we're done.
If we found a partial line in step #3 then find the rest of the line from the
current block and write out this line separately.
5. Reset some of the control variables and repeat step #3.
*/
PRUint32 didBytes = 0;
PRUint32 next, size;
char *pStart, *pEnd, *partialLineStart;
nsCAutoString partialLine, tempLine;
rv = NS_OK;
for (PRUint32 i = 0; (i < indexSize) && !(*pAbort); i++)
{
if (! pIndex[i])
continue;
if (ReadBytes( inputStream, block, pIndex[i], 16) && (block[0] == pIndex[i]) &&
(block[2] < kMailboxBufferSize) && (ReadBytes( inputStream, pBuffer, kDontSeek, block[2])))
{
// block[2] contains the chars in the buffer (ie, buf content size).
// block[3] contains offset to the next block of data (0 means no more data).
size = block[2];
pStart = pBuffer;
pEnd = pStart + size;
// write out the from separator.
if (IsFromLine( pBuffer, size))
{
char *pChar = pStart;
while ((pChar < pEnd) && (*pChar != '\r') && (*(pChar+1) != '\n'))
pChar++;
if (pChar < pEnd)
{
// Get the "From " line so write it out.
rv = outputStream->Write(pStart, pChar-pStart+2, &written);
NS_ENSURE_SUCCESS(rv,rv);
// Now buffer starts from the 2nd line.
pStart = pChar + 2;
}
}
else
{
// Write out the default from line since there is none in the msg.
rv = outputStream->Write( m_pFromLineSep, sepLen, &written);
// FIXME: Do I need to check the return value of written???
if (NS_FAILED( rv))
break;
}
char statusLine[50];
PRUint32 msgFlags = 0; // need to convert from OE flags to mozilla flags
PR_snprintf(statusLine, sizeof(statusLine), X_MOZILLA_STATUS_FORMAT MSG_LINEBREAK, msgFlags & 0xFFFF);
//.........这里部分代码省略.........
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:101,代码来源:nsOE5File.cpp
示例17: getter_AddRefs
// Creates a folder in Local Folders with the module name + mail
// for e.g: Outlook Mail
bool nsImportGenericMail::CreateFolder(nsIMsgFolder **ppFolder)
{
nsresult rv;
*ppFolder = nullptr;
nsCOMPtr<nsIStringBundle> bundle;
nsCOMPtr<nsIStringBundleService> bundleService =
mozilla::services::GetStringBundleService();
if (!bundleService)
return false;
rv = bundleService->CreateBundle(IMPORT_MSGS_URL, getter_AddRefs(bundle));
if (NS_FAILED(rv))
return false;
nsString folderName;
if (!m_pName.IsEmpty()) {
const PRUnichar *moduleName[] = { m_pName.get() };
rv = bundle->FormatStringFromName(NS_LITERAL_STRING("ImportModuleFolderName").get(),
moduleName, 1,
getter_Copies(folderName));
}
else {
rv = bundle->GetStringFromName(NS_LITERAL_STRING("DefaultFolderName").get(),
getter_Copies(folderName));
}
if (NS_FAILED(rv)) {
IMPORT_LOG0("*** Failed to get Folder Name!\n");
return false;
}
nsCOMPtr <nsIMsgAccountManager> accMgr = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
IMPORT_LOG0("*** Failed to create account manager!\n");
return false;
}
nsCOMPtr <nsIMsgIncomingServer> server;
rv = accMgr->GetLocalFoldersServer(getter_AddRefs(server));
// if Local Folders does not exist already, create it
if (NS_FAILED(rv) || !server)
{
rv = accMgr->CreateLocalMailAccount();
if (NS_FAILED(rv)) {
IMPORT_LOG0("*** Failed to create Local Folders!\n");
return false;
}
rv = accMgr->GetLocalFoldersServer(getter_AddRefs(server));
}
if (NS_SUCCEEDED(rv) && server) {
nsCOMPtr <nsIMsgFolder> localRootFolder;
rv = server->GetRootMsgFolder(getter_AddRefs(localRootFolder));
if (localRootFolder) {
// we need to call GetSubFolders() so that the folders get initialized
// if they are not initialized yet.
nsCOMPtr<nsISimpleEnumerator> aEnumerator;
rv = localRootFolder->GetSubFolders(getter_AddRefs(aEnumerator));
if (NS_SUCCEEDED(rv)) {
// check if the folder name we picked already exists.
bool exists = false;
rv = localRootFolder->ContainsChildNamed(folderName, &exists);
if (exists) {
nsString name;
localRootFolder->GenerateUniqueSubfolderName(folderName, nullptr, name);
if (!name.IsEmpty())
folderName.Assign(name);
else {
IMPORT_LOG0("*** Failed to find a unique folder name!\n");
return false;
}
}
IMPORT_LOG1("Creating folder for importing mail: '%s'\n", NS_ConvertUTF16toUTF8(folderName).get());
// Bug 564162 identifies a dataloss design flaw.
// A working Thunderbird client can have mail in Local Folders and a
// subsequent import 'Everything' will trigger a migration which
// overwrites existing mailboxes with the imported mailboxes.
rv = localRootFolder->CreateSubfolder(folderName, nullptr);
if (NS_SUCCEEDED(rv)) {
rv = localRootFolder->GetChildNamed(folderName, ppFolder);
if (*ppFolder) {
IMPORT_LOG1("Folder '%s' created successfully\n", NS_ConvertUTF16toUTF8(folderName).get());
return true;
}
}
}
} // if localRootFolder
} // if server
IMPORT_LOG0("****** FAILED TO CREATE FOLDER FOR IMPORT\n");
return false;
}
开发者ID:Type-of-Tool,项目名称:ExMail,代码行数:92,代码来源:nsImportMail.cpp
示例18: ImportMailThread
static void
ImportMailThread(void *stuff)
{
ImportThreadData *pData = (ImportThreadData *)stuff;
IMPORT_LOG0("ImportMailThread: Starting...");
nsresult rv = NS_OK;
nsCOMPtr<nsIMsgFolder> destRoot(pData->destRoot);
uint32_t count = 0;
rv = pData->boxes->Count(&count);
uint32_t i;
bool import;
uint32_t size;
uint32_t depth = 1;
uint32_t newDepth;
nsString lastName;
PRUnichar * pName;
nsCOMPtr<nsIMsgFolder> curFolder(destRoot);
nsCOMPtr<nsIMsgFolder> newFolder;
nsCOMPtr<nsIMsgFolder> subFolder;
nsCOMPtr<nsISimpleEnumerator> enumerator;
bool exists;
nsString success;
nsString error;
// GetSubFolders() will initialize folders if they are not already initialized.
ProxyGetSubFolders(curFolder, getter_AddRefs(enumerator));
IMPORT_LOG1("ImportMailThread: Total number of folders to import = %d.", count);
// Note that the front-end js script only displays one import result string so
// we combine both good and bad import status into one string (in var 'success').
for (i = 0; (i < count) && !(pData->abort); i++) {
nsCOMPtr<nsIImportMailboxDescriptor> box =
do_QueryElementAt(pData->boxes, i);
if (box) {
pData->currentMailbox = i;
import = false;
size = 0;
rv = box->GetImport(&import);
if (import)
rv = box->GetSize(&size);
rv = box->GetDepth(&newDepth);
if (newDepth > depth) {
// OK, we are going to add a subfolder under the last/previous folder we processed, so
// find this folder (stored in 'lastName') who is going to be the new parent folder.
IMPORT_LOG1("ImportMailThread: Processing child folder '%s'.", NS_ConvertUTF16toUTF8(lastName).get());
rv = ProxyGetChildNamed(curFolder, lastName, getter_AddRefs(subFolder));
if (NS_FAILED(rv)) {
IMPORT_LOG1("*** ImportMailThread: Failed to get the interface for child folder '%s'.", NS_ConvertUTF16toUTF8(lastName).get());
nsImportGenericMail::ReportError(IMPORT_ERROR_MB_FINDCHILD,
lastName.get(),
&error, pData->stringBundle);
pData->fatalError = true;
break;
}
curFolder = subFolder;
// Make sure this new parent folder obj has the correct subfolder list so far.
rv = ProxyGetSubFolders(curFolder, getter_AddRefs(enumerator));
}
else if (newDepth < depth) {
rv = NS_OK;
while ((newDepth < depth) && NS_SUCCEEDED(rv)) {
rv = curFolder->GetParent(getter_AddRefs(curFolder));
if (NS_FAILED(rv)) {
IMPORT_LOG1("*** ImportMailThread: Failed to get the interface for parent folder '%s'.", lastName.get());
nsImportGenericMail::ReportError(IMPORT_ERROR_MB_FINDCHILD,
lastName.get(), &error,
pData->stringBundle);
pData->fatalError = true;
break;
}
depth--;
}
if (NS_FAILED(rv)) {
IMPORT_LOG1("*** ImportMailThread: Failed to get the proxy interface for parent folder '%s'.", lastName.get());
nsImportStringBundle::GetStringByID(IMPORT_ERROR_MB_NOPROXY,
pData->stringBundle, error);
pData->fatalError = true;
break;
}
}
depth = newDepth;
pName = nullptr;
box->GetDisplayName(&pName);
if (pName) {
lastName = pName;
NS_Free(pName);
}
else
//.........这里部分代码省略.........
开发者ID:Type-of-Tool,项目名称:ExMail,代码行数:101,代码来源:nsImportMail.cpp
注:本文中的IMPORT_LOG1函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论