Beispiel #1
0
void CMsgImOutboxSend::RestoreBccRecipientsToHeaderL()
	{
	if (!iServerEntry.HasStoreL() || !iBccRcptArray || iBccRcptArray->Count()==0)
		return; // no recipients to restore.

	CMsvStore* store = iServerEntry.EditStoreL();
	CleanupStack::PushL(store);
	
	// Must have an rfc822 header.
	CImHeader* header = CImHeader::NewLC();
	if (store->IsPresentL( KUidMsgFileIMailHeader) )
		{
		header->RestoreL(*store);
		header->BccRecipients().Reset();

		TInt ii = iBccRcptArray->Count(); 
		while (ii-- > 0)
			header->BccRecipients().InsertL(0, (*iBccRcptArray)[ii]);
		header->StoreL(*store);	
		store->CommitL();
		}

	// To stop the array growing, delete and recreate.
	iBccRcptArray->Reset();
	delete iBccRcptArray;
	iBccRcptArray=0;
	iBccRcptArray = new (ELeave) CDesCArrayFlat(KBccArraySegment);

	CleanupStack::PopAndDestroy(header);
	CleanupStack::PopAndDestroy(store); 
	}
Beispiel #2
0
EXPORT_C void CImOffLineArrayStore::RestoreL(const CMsvStore& aMessageStore )
	{
	if (aMessageStore.IsPresentL(KUidImQueuedOperationList))
		{
		RMsvReadStream in;
		in.OpenLC( aMessageStore, KUidImQueuedOperationList ); // pushes 'in' to the stack
		InternalizeL(in);
		CleanupStack::PopAndDestroy();
		}
	}
TBool CT_MsgVerifyHeaders::VerifyMimeHeaderPartsL(CMsvEntrySelection* aEntrySelection)
	{
	TBool status = EPass;
	for(int index = 0; index < aEntrySelection->Count(); ++index)
		{
		CMsvEntry* entry = iSharedDataPOP.iSession->GetEntryL(aEntrySelection->At(index));
		CleanupStack::PushL(entry);
		CMsvStore* store = entry->ReadStoreL();
		CleanupStack::PushL(store);
		if (store->IsPresentL(KUidMsgFileMimeHeader))
			{
			CImMimeHeader* mimeHeader = CImMimeHeader::NewLC();
			mimeHeader->RestoreL(*store);
	
			TBuf<256> param;
			TPtrC contentType;
			param.Format(KContentType, index);
			if(GetStringFromConfig( ConfigSection(), param, contentType))
				{
				TPtrC8 content8 = mimeHeader->ContentType();
				HBufC* content16 = HBufC::NewLC(content8.Length());
				content16->Des().Copy(content8);
				if(contentType.Compare(content16->Des()))
					{
					ERR_PRINTF1(_L("Content Type is not matched"));
					status = EFail;
					}
				CleanupStack::PopAndDestroy(content16);
				}
			TPtrC contentSubType;
			param.Format(KContentSubType, index);
			if(GetStringFromConfig( ConfigSection(), param, contentSubType))
				{
				TPtrC8 content8 = mimeHeader->ContentSubType();
				HBufC* content16 = HBufC::NewLC(content8.Length());
				content16->Des().Copy(content8);
				if(contentSubType.Compare(content16->Des()))
					{
					ERR_PRINTF1(_L("Content Sub Type is not matched"));
					status = EFail;
					}
				CleanupStack::PopAndDestroy(content16);
				}
			CleanupStack::PopAndDestroy(mimeHeader);
			}
		CleanupStack::PopAndDestroy(store);
		CleanupStack::PopAndDestroy(entry);
		}
	return status;
	}
// ----------------------------------------------------------------------------
// CIpsPlgNewChildPartFromFileOperation::PrepareStoreL
// ----------------------------------------------------------------------------
//
void CIpsPlgNewChildPartFromFileOperation::PrepareStoreL()
    {
    CMsvEntry* cAtta = iMsvSession.GetEntryL( iNewAttachmentId );
    CleanupStack::PushL( cAtta );
    TBool parentToMultipartAlternative( EFalse );
    if( cAtta->HasStoreL() )
        {
        CMsvStore* store = cAtta->EditStoreL();
        CleanupStack::PushL( store );
        CImMimeHeader* mimeHeader = CImMimeHeader::NewLC();
        
        if( store->IsPresentL( KUidMsgFileMimeHeader ) )
            {
            mimeHeader->RestoreL( *store );
            CDesC8Array& array = mimeHeader->ContentTypeParams();
            array.AppendL( KMethod );
            parentToMultipartAlternative = ETrue;
            
            if( iContentType->Des().Find( KMimeTextCalRequest ) != KErrNotFound )
                {    
                array.AppendL( KRequest );
                }
            else if( iContentType->Des().Find( KMimeTextCalResponse ) != KErrNotFound )
                {
                array.AppendL( KResponse );
                }
            else if( iContentType->Des().Find( KMimeTextCalCancel ) != KErrNotFound ) 
                {
                array.AppendL( KCancel );
                }
            else
                {
                parentToMultipartAlternative = EFalse;
                }
            mimeHeader->StoreWithoutCommitL( *store );
            store->CommitL();
            }
        
        CleanupStack::PopAndDestroy( 2, store );
        }

    if( parentToMultipartAlternative &&
        iFilePath->Find( KFileExtensionICS ) != KErrNotFound )
        {        
        TMsvEntry tAttaEntry = cAtta->Entry();
        TMsvId id = tAttaEntry.Parent();
        CMsvEntry* cParent = iMsvSession.GetEntryL( id );
        CleanupStack::PushL( cParent );
        
        TMsvEmailEntry tEntry = cParent->Entry();
        tEntry.SetMessageFolderType( EFolderTypeAlternative );
        
        // Do async again if needed

        iOperation = cParent->ChangeL( tEntry, iStatus );
        CleanupStack::PopAndDestroy( cParent );
        CleanupStack::PopAndDestroy( cAtta );
        }
    else
        {
        CleanupStack::PopAndDestroy( cAtta );
        iStatus = KRequestPending;
        TRequestStatus* status = &iStatus;
        User::RequestComplete(status,KErrNone);
        }
    iStep = EStoreMessagePart; // Next step
    SetActive();
    }
EXPORT_C void CMsvTestUtils::ListChildrenL(RFile& aFile, CDir& rfcFileList, TInt& aCount, TInt& aEntryCount, TBool aReplace, TBool aOtherFiles)
	{
	// Check details of attachments on current context entry

	// Get list of children IDs
	CMsvEntrySelection* msvSelection = NULL;

	TMsvEntry entry;
	if (iClientServer==EClientSide)
		{
		entry = iMsvEntry->Entry(); 
		msvSelection = iMsvEntry->ChildrenL();
		}
	else
		{
		entry = iServerEntry->Entry(); 
		msvSelection = new (ELeave) CMsvEntrySelection;
		iServerEntry->GetChildren(*msvSelection);
		}
	CleanupStack::PushL(msvSelection);

	TInt attachCount = msvSelection->Count(); 	// For each child ..
	TPtrC type;
	SetFolderType(entry, type);

	TPtrC priority;
	TMsvPriority temp=entry.Priority();
	if(temp==EMsvHighPriority)
		priority.Set(_L("High  "));
	else if(temp==EMsvMediumPriority)
		priority.Set(_L("Medium"));
	else if(temp==EMsvLowPriority)
		priority.Set(_L("Low   "));
	else
		priority.Set(_L("None  "));

	TBuf<11> other=_L("-------  ");

	TBuf<6> streams=_L("------");

	if ((iClientServer==EClientSide && iMsvEntry->HasStoreL()) ||
		(iClientServer==EServerSide && iServerEntry->HasStoreL()))
		{
		CMsvStore* fileStore;
		fileStore = (iClientServer==EClientSide) ? iMsvEntry->ReadStoreL() : iServerEntry->ReadStoreL();
		
		if(aOtherFiles && fileStore->IsPresentL(KMsvEntryRichTextBody))
			{
			WriteBodyDataL(entry.Id(), iLogsDir, *fileStore, aReplace);
			streams.Replace(2, 1, _L("B"));
			}
		delete fileStore;
		}

	if(entry.Attachment())
		streams.Replace(3, 1, _L("A"));

	if (entry.New())
		other.Replace(1, 1, _L("N"));
	if (entry.Unread())
		other.Replace(2, 1, _L("U"));
	if (entry.Complete())
		other.Replace(3, 1, _L("C"));

	TBuf<600> outputLine;

	// Put details into output string buffer
	TMsvId current=entry.Id();
	if (iClientServer==EClientSide) 
		iMsvEntry->SetEntryL(current);
	else
		iServerEntry->SetEntry(current);
	
	for(TInt i=0; i<aCount; i++)
		outputLine.AppendFormat(_L("  "));
		
	outputLine.AppendFormat(TRefByValue<const TDesC>_L("%S, 00%x, Children=%d, Size=%d, Store=%S, P=%S, Other=%S, Det:%S\r\n"),
							&type, 
							entry.Id(),
							attachCount, 
							entry.iSize,
							&streams,
							&priority,
							&other,
							&entry.iDetails);
	
	HBufC8* pOutputLine8 = HBufC8::NewLC(outputLine.Length());
	pOutputLine8->Des().Copy(outputLine);
	aFile.Write(pOutputLine8->Des());
	CleanupStack::PopAndDestroy(); // pBuf16

	for(TInt j=0; j<attachCount; j++)
		{
		// Get Context of current message
		if (iClientServer==EClientSide) 
			iMsvEntry->SetEntryL((*msvSelection)[j]);
		else
			iServerEntry->SetEntry((*msvSelection)[j]);
			
		aEntryCount++;
		aCount++;
		ListChildrenL(aFile, rfcFileList, aCount, aEntryCount, aReplace);
		aCount--;
		}	

	CleanupStack::PopAndDestroy(); // msvSelection
	}