示例#1
0
TBool CSmsFile::DeleteSentEntry(TMsvId entry)
{
    TInt err;
    // Load this entry to our mtm
    TRAP(err, iReceiveMtm->SwitchCurrentEntryL(entry));
    // probably wasn't compatible, ignore
    if (err!=KErrNone) return EFalse;
    TRAP(err, iReceiveMtm->LoadMessageL());
    // probably wasn't compatible, ignore
    if (err!=KErrNone) return EFalse;

    TMsvEntry msvEntry( (iReceiveMtm->Entry()).Entry() );

    if (msvEntry.iMtmData3 == KUidRippleVaultApp.iUid)    // this entry has been created by our app
    {
        // Taking a handle to the Sent folder...
        TMsvSelectionOrdering sort;
        sort.SetShowInvisibleEntries(ETrue);    // we want to handle also the invisible entries
        // Take a handle to the parent entry
        CMsvEntry* parentEntry = CMsvEntry::NewL(iReceiveMtm->Session(), msvEntry.Parent(), sort);
        CleanupStack::PushL(parentEntry);

        // here parentEntry is the Sent folder (must be so that we can call DeleteL)
        parentEntry->DeleteL(msvEntry.Id());

        CleanupStack::Pop();

        //if(iBillSms == 1)
        //iAppUi.CheckBillingStatus(5);

        return ETrue; // entry was deleted
    }

    return EFalse; // no entries deleted
}
示例#2
0
TMsvId CFakeSMSSender::CreateNewMessageL(TTime aMsgTime)
{
    CMsvEntry* Draftentry = CMsvEntry::NewL(*iMsvSession, KMsvDraftEntryIdValue ,TMsvSelectionOrdering());
  	CleanupStack::PushL(Draftentry);

    CMsvOperationWait* wait = CMsvOperationWait::NewLC();
    wait->Start();
    
	TMsvEntry newEntry;              // This represents an entry in the Message Server index
    newEntry.iMtm = KUidMsgTypeSMS;                         // message type is SMS
 	newEntry.iType = KUidMsvMessageEntry; //KUidMsvServiceEntry                  // this defines the type of the entry: message 
 	newEntry.iServiceId = KMsvLocalServiceIndexEntryId; //    // ID of local service (containing the standard folders)
   	newEntry.iDate = aMsgTime;                              // set the date of the entry to home time
	newEntry.SetInPreparation(ETrue);                       // a flag that this message is in preparation
	newEntry.SetReadOnly(EFalse);					
		
	CMsvOperation* oper = Draftentry->CreateL(newEntry,wait->iStatus);
    CleanupStack::PushL(oper);
    CActiveScheduler::Start();

    while( wait->iStatus.Int() == KRequestPending )
    {
        CActiveScheduler::Start();
    }

    
    // ...and keep track of the progress of the create operation.
    TMsvLocalOperationProgress progress = McliUtils::GetLocalProgressL(*oper);
    User::LeaveIfError(progress.iError);
//	Draftentry->MoveL(progress.iId,KMsvGlobalInBoxIndexEntryId);

	CleanupStack::PopAndDestroy(3);//Draftentry,wait,oper
	
    return progress.iId;
 }
void CMtfTestActionCompareAttachment::ExecuteActionL()
	{
	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCompareAttachment);
	CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
	TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
	TMsvAttachmentId attachId = ObtainValueParameterL<TMsvAttachmentId>(TestCase(),ActionParameters().Parameter(2));
	HBufC* dataFilePath   = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(3));

	CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
	CleanupStack::PushL(entry);
	
	CMsvStore* store = entry->ReadStoreL();
	CleanupStack::PushL(store);
	
	MMsvAttachmentManager& manager = store->AttachmentManagerL();
	
	RFile fileAttachment = manager.GetAttachmentFileL(attachId);
	CleanupClosePushL(fileAttachment);
	
	CompareFileL(fileAttachment, *dataFilePath);
	
	CleanupStack::PopAndDestroy(&fileAttachment);
	
	CleanupStack::PopAndDestroy(2, entry); // store, entry
	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCompareAttachment);
	TestCase().ActionCompletedL(*this);
	}
示例#4
0
void CMsvSendExe::RestoreScheduleSettingsL(TMsvId aServiceId, const TUid& aMtm, CMsvScheduleSettings& aSettings)
	{
	TMsvSelectionOrdering order;
	order.SetShowInvisibleEntries(ETrue);
	CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvRootIndexEntryId, order);
	CleanupStack::PushL(cEntry);

	if (aServiceId == KMsvLocalServiceIndexEntryId)
		{
		const TInt count = cEntry->Count();

		for (TInt i = 0; i < count; i++)
			{
			const TMsvEntry& entry = (*cEntry)[i];
			if (entry.iType == KUidMsvServiceEntry && entry.iMtm == aMtm)
				{
				aServiceId = entry.Id();
				break;
				}
			}
		}

	if (aServiceId == KMsvLocalServiceIndexEntryId)
		User::Leave(KErrNotFound);
	
	CRepository* repository = CRepository::NewLC(aMtm);
	TMsvScheduleSettingsUtils::LoadScheduleSettingsL(aSettings, *repository);
	CleanupStack::PopAndDestroy(2, cEntry); // repository, cEntry
	}
void CT_CMsvSession::TestIncPcSyncCountL()
	{
	TInt error = KErrGeneral;
	INFO_PRINTF1(_L("Testing: Increment PC Sync Count -- started"));
	TRAP(error, iSession = CMsvSession::OpenSyncL(*this));
	TEST(error == KErrNone);

	CMsvOperationWait* active = CMsvOperationWait::NewLC();
	
	CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering());
	CleanupStack::PushL(cEntry);
	
	CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection;
	CleanupStack::PushL(selection);

	TInt ret = iSession->InstallMtmGroup(KDataComponentFilename);
	TEST(ret==KErrNone|| ret==KErrAlreadyExists);

	cEntry->SetEntryL(KMsvRootIndexEntryId);
	TMsvEntry service;
	service.iType=KUidMsvServiceEntry;
	service.iMtm = KUidTestServerMtmType;
	cEntry->CreateL(service);

	selection->AppendL(service.Id());
	
	TBuf8<256> progress;
	TBuf8<32> param;
	TRAP(error, iSession->IncPcSyncCountL(*selection);)
// -----------------------------------------------------------------------------
// CMmsAdapterMsvApi::FindUserFolderL
// -----------------------------------------------------------------------------
//    
TBool CMmsAdapterMsvApi::FindUserFolderL( const TDesC& aName, TMsvId& aFolder )
    {
    CMsvEntry* entry = iSession.GetEntryL( KMsvMyFoldersEntryIdValue );
    CleanupStack::PushL( entry );
     
    CMsvEntrySelection* selection = entry->ChildrenL();
    CleanupStack::PushL( selection );
    
    TBool found( EFalse );
    TMsvId serviceId;
    TMsvEntry entryT;

    for ( TInt i = 0; i < selection->Count(); i++ )
        {
        User::LeaveIfError( iSession.GetEntry( selection->At( i ), serviceId, entryT ) );
        
        if ( !entryT.Deleted() && entryT.iType == KUidMsvFolderEntry && 
            aName.Compare(entryT.iDescription) == 0 )
            {
            found = ETrue;
            aFolder = entryT.Id();
            break;
            }
        }
    
    CleanupStack::PopAndDestroy( selection );
    CleanupStack::PopAndDestroy( entry );
    
    return found;           
    }
// -----------------------------------------------------------------------------
// CMmsAdapterMsvApi::UpdateUserFolderL
// Updates user folder (changes name)
// -----------------------------------------------------------------------------    
TInt CMmsAdapterMsvApi::UpdateUserFolderL( TMsvId aFolder, const TDesC& aName )
    {
    TRACE_FUNC_ENTRY;
    LOGGER_WRITE_1( "aName: %S", &aName );
    
    CMsvEntry* entry = iSession.GetEntryL( aFolder );
    CleanupStack::PushL( entry );
    
    TMsvEntry tEntry = entry->Entry();
    
    if ( tEntry.iType != KUidMsvFolderEntry )
        {
        CleanupStack::PopAndDestroy( entry );
        LOGGER_WRITE( "No message folder" );
        TRACE_FUNC_EXIT;
        return KErrNotSupported;
        }
       
    tEntry.iDetails.Set( aName );   
    tEntry.iDescription.Set( aName );
    
    entry->ChangeL( tEntry );
    
    CleanupStack::PopAndDestroy( entry );
    
    TRACE_FUNC_EXIT;
    return KErrNone;
    } 
/**
Creates a New Service
If a Service Exists it doesnot create a new one

@param aSession		Current Session reference
@param aDescription	Entry Description Descriptor
@param aDetail		Entry Details Descriptor
@internalTechnology
*/
void CentralRepoUtils::CreateServiceL(CMsvSession* aSession, const TDesC& aDescription, const TDesC& aDetail)
	{
	TMsvId serviceId=0;
	TRAPD(err,TSmsUtilities::ServiceIdL(*aSession,serviceId));

		if(err == KErrNotFound) // If Service Already Exists Do not create new One
			{
			TInt priority = EMsvMediumPriority;
			TInt readOnlyFlag = EFalse;
			TInt visibleFlag = ETrue;

			TMsvEntry indexEntry;
			indexEntry.iType = KUidMsvServiceEntry;
			indexEntry.iMtm = KUidMsgTypeSMS;
			indexEntry.SetReadOnly(readOnlyFlag);
			indexEntry.SetVisible(visibleFlag);	
			indexEntry.SetPriority(TMsvPriority(priority));
			indexEntry.iDescription.Set(aDescription);
			indexEntry.iDetails.Set(aDetail);
			indexEntry.iDate.HomeTime();
			
			CMsvEntry* entry = CMsvEntry::NewL(*aSession,KMsvRootIndexEntryId,TMsvSelectionOrdering());
			CleanupStack::PushL(entry);
			entry->CreateL(indexEntry);
		    CleanupStack::PopAndDestroy(entry);
			}
	}
void CMtfTestActionSetUserResponse::ExecuteActionL()
	{	
	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSetUserResponse);
	CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession> (TestCase(),ActionParameters().Parameter(0));	
	TInt paramUserResponse = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(1),EFalse);
	
	CMsvEntry* cEntry = CMsvEntry::NewL(*paramSession, KMsvDraftEntryId, 
						TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue));
	CleanupStack::PushL(cEntry);
	
	CMsvEntrySelection* selection = cEntry->ChildrenL();
	CleanupStack::PushL(selection);

	TestCase().INFO_PRINTF2(_L("Count of Draft Folder's selection is %d"),selection->Count());
	
	if (selection->Count() == 0)
	{	
	User::Leave(KErrNotFound);
	}
	
	cEntry->SetEntryL((*selection)[0]);

	if (!paramUserResponse)
	{	
	TMsvEntry entry = cEntry->Entry();
	entry.iError = KErrCancel;
	cEntry->ChangeL(entry);
	}
	
	CleanupStack::PopAndDestroy(2);
	
	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSetUserResponse);
	TestCase().ActionCompletedL(*this);
	}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
//
void CIpsSosAOImapPopLogic::RemoveOrphanLogicsL()
    {
    CMsvEntry* cEntry = iSession.GetEntryL( KMsvRootIndexEntryId );
    CleanupStack::PushL( cEntry );
    
    CMsvEntrySelection* popEntries = cEntry->ChildrenWithMtmL( KSenduiMtmPop3Uid );
    CleanupStack::PushL( popEntries );
    
    CMsvEntrySelection* imapEntries = cEntry->ChildrenWithMtmL( KSenduiMtmImap4Uid );
    CleanupStack::PushL( imapEntries );
        
        
    TInt count = iMailboxLogics.Count();
    
    for(TInt i=count-1; i>-1;i--)
        {
        if( popEntries->Find(iMailboxLogics[i]->GetMailboxId()) == KErrNotFound &&
            imapEntries->Find(iMailboxLogics[i]->GetMailboxId()) == KErrNotFound)
            {
            StopAndRemoveMailboxL( iMailboxLogics[i]->GetMailboxId() );
            }
        }
    
    CleanupStack::PopAndDestroy( 3, cEntry );
    }
// ----------------------------------------------------------------------------
// CIpsPlgPop3ConnectOp::ConstructL()
// ----------------------------------------------------------------------------
//
void CIpsPlgPop3ConnectOp::ConstructL()
    {
    FUNC_LOG;
    BaseConstructL( KUidMsgTypePOP3 );

    // <qmail> iSelection construction has been removed

    CMsvEntry* cEntry = iMsvSession.GetEntryL( iService );
    User::LeaveIfNull( cEntry );
    // NOTE: Not using cleanupStack as it is not needed in this situation:
    const TMsvEntry tentry = cEntry->Entry();
    delete cEntry;
    cEntry = NULL;

    if ( tentry.iType.iUid != KUidMsvServiceEntryValue )
        {
        // should we panic with own codes?
        User::Leave( KErrNotSupported );
        }

    // <qmail> no need to have population limit as member variable
    // <qmail> it is read from settings when needed
    
    if ( tentry.Connected() )
        {      
        iState = EConnected;
        // <qmail> iAlreadyConnected removed
        }
    else
        {
        iState = EStartConnect;
        }
    // <qmail> SetActive(); moved inside CompleteThis();
    CompleteThis();
    }
示例#12
0
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
void CMailBoxContainer::GetFoldersL(void)
{
	iFolderArray.ResetAndDestroy();
	
	if(iSession)
	{	
		
		CMsvEntry *localServiceEntry = iSession->GetEntryL(KMsvLocalServiceIndexEntryId);
		CleanupStack::PushL(localServiceEntry);
		CMsvEntrySelection *folders = localServiceEntry->ChildrenWithTypeL(KUidMsvFolderEntry);
		CleanupStack::PushL(folders);

		for (TInt i = 0;i <  folders->Count();i++)
		{
			TMsvEntry ExtraFolder = localServiceEntry->ChildDataL((*folders)[i]);
			
			CMailFldItem* NewIttem = new(ELeave)CMailFldItem();
			CleanupStack::PushL(NewIttem);
			
			NewIttem->iTitle = ExtraFolder.iDetails.AllocL();
			NewIttem->iMscId = 	ExtraFolder.Id();

			CleanupStack::Pop();//NewIttem
			iFolderArray.Append(NewIttem);
		}
		
		CleanupStack::PopAndDestroy(2); // localServiceEntry, folders
	
	
		AddEmailFoldersL(iSession);
	}
}
// ----------------------------------------------------------------------------
// CIpsPlgNewChildPartFromFileOperation::PrepareMsvEntryL
// ----------------------------------------------------------------------------
//
void CIpsPlgNewChildPartFromFileOperation::PrepareMsvEntryL()
    {
    // Dig out the entry ID of the new attachment
    iMessage->GetAttachmentsListL( iEntry->Entry().Id( ), 
        CImEmailMessage::EAllAttachments, CImEmailMessage::EThisMessageOnly );
    TKeyArrayFix key( 0, ECmpTInt32 );
    CMsvEntrySelection* attachmentIds = iMessage->Selection().CopyLC();
    attachmentIds->Sort( key );
    if ( !attachmentIds->Count() )
        {
        User::Leave( KErrGeneral );
        }
    iNewAttachmentId = (*attachmentIds)[ attachmentIds->Count()-1 ];
    CleanupStack::PopAndDestroy( attachmentIds );
    
    CMsvEntry* cAtta = iMsvSession.GetEntryL( iNewAttachmentId );
    CleanupStack::PushL( cAtta );
    
    // Set filename to iDetails
    TMsvEntry tEntry = cAtta->Entry();
    tEntry.iDetails.Set(iFilePath->Des());

    // Do async
    iOperation = cAtta->ChangeL( tEntry, iStatus );
    CleanupStack::PopAndDestroy( cAtta );
    iStep = EPrepareStore; // Next step
    SetActive();
    }
TInt CPartialDownloadStep::GetEntryCountL()
	{
	
	TImapAccount imapAccount=iImapClient->GetImapAccount();
	
	TMsvSelectionOrdering ordering;	

	//open the imap service entry
	CMsvEntry* imapService = CMsvEntry::NewL(*iSession,imapAccount.iImapService,ordering);
	CleanupStack::PushL(imapService);
	//get its children
	CMsvEntrySelection* msvEntrySelection;
	msvEntrySelection=imapService->ChildrenL();
	//open its child inbox entry
	CMsvEntry* inboxEntry = CMsvEntry::NewL(*iSession, (*msvEntrySelection)[0],ordering);
    CleanupStack::PushL(inboxEntry);
    
    //get the childeren of the inbox
    delete msvEntrySelection;
    msvEntrySelection=NULL;
    msvEntrySelection=inboxEntry->ChildrenL();
    //the count should be 2
    TInt count=msvEntrySelection->Count();
    
    delete msvEntrySelection;
    msvEntrySelection=NULL;	
	CleanupStack::PopAndDestroy(2,imapService);
	
	return count;
	}
void CMtfTestActionGetAttachmentFileFromIndex::RunTestActionL()
	{
	CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
	TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
	TInt attachIndex = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2));
	HBufC* dataFilePath   = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(3), NULL);

	CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
	CleanupStack::PushL(entry);
	
	CMsvStore* store = entry->ReadStoreL();
	CleanupStack::PushL(store);
	
	MMsvAttachmentManager& manager = store->AttachmentManagerL();
	
	RFile fileAttachment = manager.GetAttachmentFileL(attachIndex);
	CleanupClosePushL(fileAttachment);
	
	if( dataFilePath != NULL )
		{
		// check of contents of attachment file is requested
		CompareFileL(fileAttachment, *dataFilePath);
		}
	
	CleanupStack::PopAndDestroy(3, entry); // fileAttachment, store, entry
	}
示例#16
0
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
void CMailBoxContainer::AddEmailFoldersL(CMsvSession* aSession)
{
	if(aSession)
	{	
		CMsvEntry *localServiceEntry = aSession->GetEntryL(KMsvRootIndexEntryId);//KMsvLocalServiceIndexEntryId);
		CleanupStack::PushL(localServiceEntry);
		CMsvEntrySelection *folders = localServiceEntry->ChildrenL();
		CleanupStack::PushL(folders);

		if(folders->Count() > 1) // first is local folder
		{
			for (TInt i = 1;i <  folders->Count();i++)
			{
				TMsvEntry ExtraFolder = localServiceEntry->ChildDataL((*folders)[i]);
				
				CMailFldItem* NewIttem = new(ELeave)CMailFldItem();
				CleanupStack::PushL(NewIttem);
					
				NewIttem->iTitle = ExtraFolder.iDetails.AllocL();
				NewIttem->iMscId = 	ExtraFolder.Id();
			
				CleanupStack::Pop();//NewIttem
				iFolderArray.Append(NewIttem);
			}
		}
		
		CleanupStack::PopAndDestroy(2); // localServiceEntry, folders
	}
}
示例#17
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CSMSSender::CreateNewMessageL()
{
	Cancel();
	iMessageMade = iMessageSent = iMessageReceived = EFalse;
	
	delete iMtm;
	iMtm = NULL;

    TMsvEntry newEntry;              // This represents an entry in the Message Server index
    newEntry.iMtm = KUidMsgTypeSMS;                         // message type is SMS
	newEntry.iType = KUidMsvMessageEntry;                   // this defines the type of the entry: message 
	newEntry.iServiceId = KMsvLocalServiceIndexEntryId;     // ID of local service (containing the standard folders)
	newEntry.iDate.UniversalTime();                              // set the date of the entry to home time
	newEntry.SetInPreparation(ETrue);                       // a flag that this message is in preparation
   	newEntry.SetReadOnly(EFalse);
   	
    // - CMsvEntry accesses and acts upon a particular Message Server entry.
    // - NewL() does not create a new entry, but simply a new object to access an existing entry.
    // - It takes in as parameters the client's message server session,
    //   ID of the entry to access and initial sorting order of the children of the entry. 
    CMsvEntry* entry = CMsvEntry::NewL(*iSession, KMsvDraftEntryIdValue, TMsvSelectionOrdering());
    CleanupStack::PushL(entry);

    delete iOperation;
    iOperation = NULL;
    iOperation = entry->CreateL(newEntry, iStatus);
    CleanupStack::PopAndDestroy(entry);

    iPhase = EWaitingForCreate;
    SetActive();    
}
示例#18
0
void CScheduleTestActive::HandleSessionEventL(TMsvSessionEvent eventType, TAny* p1, TAny*, TAny*)
	{
	if (iStopAtRunL) return;
	if (eventType != EMsvEntriesCreated) return;

	CMsvEntrySelection* entries = STATIC_CAST(CMsvEntrySelection*, p1);

	CMsvEntry* cEntry = iSession.GetEntryL((*entries)[0]);
	CleanupStack::PushL(cEntry);

	TMsvEntry entry(cEntry->Entry());
	
	if(entry.iDetails == KSchSendTestDetails)
		{
		iTest.Printf(_L("Scheduled message has been sent\n"));

		//We found the right message!
		CActiveScheduler::Stop();

		//Delete the new message
		CMsvOperationWait* wait = CMsvOperationWait::NewLC();
		wait->Start();
		cEntry->SetEntryL(entry.Parent());
		CMsvOperation* op = cEntry->DeleteL(entry.Id(), wait->iStatus);
		CActiveScheduler::Start();
		delete op;
		CleanupStack::PopAndDestroy(wait);
		}

	CleanupStack::PopAndDestroy(cEntry);
	}
void CheckNoAttachmentsL()
	{
	CDummyObserver* ob1 = new(ELeave) CDummyObserver;
	CleanupStack::PushL(ob1);
	
	CMsvSession* session = CMsvSession::OpenSyncL(*ob1);
	CleanupStack::PushL(session);
	
	CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvDraftEntryId, 
		TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue));
	CleanupStack::PushL(cEntry);
	
	CMsvEntrySelection* selection = cEntry->ChildrenL();
	CleanupStack::PushL(selection);

	test(selection->Count() == 1);
	cEntry->SetEntryL((*selection)[0]);

	if (cEntry->HasStoreL())
		{
		CMsvStore* store = cEntry->ReadStoreL();
		CleanupStack::PushL(store);
	
		MMsvAttachmentManager& attachmentMgr = store->AttachmentManagerL();
		test(attachmentMgr.AttachmentCount() == 0);
		CleanupStack::PopAndDestroy(store);
		}

	CleanupStack::PopAndDestroy(4, ob1); // selection, cEntry, session, ob1
	}
// methods from CSendAsEditUtils
void CSendAsTestEditUtils::LaunchEditorL(TMsvId /*aId*/, TRequestStatus& aStatus)
	{

	CDummyObserver* ob1 = new(ELeave) CDummyObserver;
	CleanupStack::PushL(ob1);

	CMsvSession* session = CMsvSession::OpenSyncL(*ob1);
	CleanupStack::PushL(session);

	CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvDraftEntryId, 
		TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue));
	CleanupStack::PushL(cEntry);

	CMsvEntrySelection* selection = cEntry->ChildrenL();
	CleanupStack::PushL(selection);

	CMsvEntry* cEntry2 = session->GetEntryL(selection->At(0));
	CleanupStack::PushL(cEntry2);

	TMsvEntry entry = cEntry2->Entry();
	entry.SetMtmData3(234567890); // Show we've been called by touching the TMsvEntry.
	cEntry2->ChangeL(entry);
	
	CleanupStack::PopAndDestroy(5, ob1); // cEntry2, selection, cEntry, session, ob1

	iUserStatus = &aStatus;
	aStatus = KRequestPending;
	// wait a few seconds before completing
	iEditTimer->After(KSendAsTestEditWaitTime);
	}
/**
  Function : ExecuteActionL
  Description : Issues command to Pigeon Server MTM to schedule/reschedule the messages
  @internalTechnology
  @param  : none
  @return : void
  @pre  
  @post none
*/
void CMtfTestActionSchedulePigeonMessage::ExecuteActionL()
	{
	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSchedulePigeonMessage);
	// Obtain input parameters
	CMsvSession* paramSession	= ObtainParameterReferenceL<CMsvSession>(TestCase(),
														ActionParameters().Parameter(0));
	TMsvId paramParentId		= ObtainValueParameterL<TMsvId>(TestCase(),
														ActionParameters().Parameter(1));
	TInt paramCommand			= ObtainValueParameterL<TInt>(TestCase(),
														ActionParameters().Parameter(2));
	
	//Error Handling Just in case one of the above inputs fail.
	if(TestCase().TestStepResult() == EPass)
		{
		CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramParentId,TMsvSelectionOrdering());

		// Get the selection of Pigeon Messages
		iSelection = entry->ChildrenWithMtmL(KUidMsgTypePigeon);
		
		// Initiate asynchronous operation, passing the schedule/reschedule the message in the selection
		// Dummy aParameter value passed as Pigeon MTM does not make use of it.
		iOperation = paramSession->TransferCommandL(*iSelection,paramCommand, _L8("aaaa"), iStatus);
		
		CActiveScheduler::Add(this);
		SetActive();
		}
	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSchedulePigeonMessage);
	}
// -----------------------------------------------------------------------------
// CMmsAdapterMsvApi::FindUserFolderL
// -----------------------------------------------------------------------------
//    
TBool CMmsAdapterMsvApi::FindUserFolderL( TMsvId aFolder, TPtrC& aName, TTime& aDate )
    {
    TBool found( EFalse );
    
    CMsvEntry* entry = iSession.GetEntryL( KMsvMyFoldersEntryIdValue );
    CleanupStack::PushL( entry );
     
    CMsvEntrySelection* selection = entry->ChildrenL();
    CleanupStack::PushL( selection );
    
    TMsvId serviceId;
    TMsvEntry entryT;

    for ( TInt i = 0; i < selection->Count(); i++ )
        {
        User::LeaveIfError( iSession.GetEntry( selection->At( i ), serviceId, entryT ) );
        
        if ( !entryT.Deleted() && entryT.iType == KUidMsvFolderEntry && entryT.Id() == aFolder )
            {
            found = ETrue;
            aDate = entryT.iDate;
            aName.Set( entryT.iDetails );
            break;
            }
        }
    
    CleanupStack::PopAndDestroy( selection );
    CleanupStack::PopAndDestroy( entry ); 
    
    return found;        
    }
示例#23
0
/* 
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CFakeSMSSender::AppendPDUDataL(TMsvId aEntryId, const TDesC& aRecipient,TBool aUnicodeMsg,const TDesC& aBody)
{
 	CMsvEntry* entry = iMsvSession->GetEntryL(aEntryId);
    CleanupStack::PushL(entry);				
	
	CMsvStore* srore= entry->EditStoreL();
	CleanupStack::PushL(srore);
	if(srore)
	{	
		CSmsBuffer* smsBuffer = CSmsBuffer::NewL();	
		CSmsMessage* smsMsg = CSmsMessage::NewL(iFsSession,CSmsPDU::ESmsDeliver, smsBuffer);
		
		CleanupStack::PushL(smsMsg);
				
		smsMsg->SetTime(entry->Entry().iDate);
		
		if(aRecipient.Length() > 20)
			smsMsg->SetToFromAddressL(aRecipient.Left(20));
		else
			smsMsg->SetToFromAddressL(aRecipient);
		
		smsBuffer->InsertL(0,aBody);	
		
		CSmsDeliver& DSMSPDU = STATIC_CAST(CSmsDeliver&,smsMsg->SmsPDU());
		DSMSPDU.SetMoreMessagesToSend(EFalse);
		DSMSPDU.SetReplyPath(EFalse);
		DSMSPDU.SetStatusReportIndication(EFalse);

		TInt Hours(0x20);
		DSMSPDU.SetServiceCenterTimeStamp(entry->Entry().iDate,Hours);
		DSMSPDU.SetTextCompressed(EFalse);
		DSMSPDU.SetPIDType(TSmsProtocolIdentifier::ESmsPIDShortMessageType);	
		
		//DSMSPDU.SetTextCompressed(TBool aCompressed);
		//DSMSPDU.SetAlphabet(TSmsDataCodingScheme::TSmsAlphabet aAlphabet);
		
		CSmsHeader* MyHeader = CSmsHeader::NewL(smsMsg);
		CleanupStack::Pop(1);//smsMsg
		CleanupStack::PushL(MyHeader);
		
		CSmsSettings*  MySetting = CSmsSettings::NewL();
		CleanupStack::PushL(MySetting);
		
		if(aUnicodeMsg)
			MySetting->SetCharacterSet(TSmsDataCodingScheme::ESmsAlphabetUCS2);
		else
			MySetting->SetCharacterSet(TSmsDataCodingScheme::ESmsAlphabet7Bit);
			
		//MySetting->StoreL(*srore);//InternalizeL
		MyHeader->SetSmsSettingsL(*MySetting);
			
		MyHeader->StoreL(*srore);
		srore->CommitL();
		
		CleanupStack::PopAndDestroy(2);//MySetting,MyHeader,
	}	

	CleanupStack::PopAndDestroy(2);//entry,srore
}
示例#24
0
CMsvOperation* CTextMtmClient::ForwardL(TMsvId aForwardEntryId, TMsvPartList aPartList, 
										TRequestStatus& aCompletionStatus)
// Create forwarded message 
// Destination folder is aForwardEntryL
//
	{
	__ASSERT_DEBUG(iMsvEntry!=NULL,gPanic(ETxtcNoCMsvEntrySet));
	__ASSERT_DEBUG(iMsvEntry->Entry().iType.iUid == KUidMsvMessageEntryValue, gPanic(ETxtcEntryTypeNotSupported));
	__ASSERT_DEBUG(iMsvEntry->Entry().iServiceId == KMsvLocalServiceIndexEntryId, gPanic(ETxtcInvalidServiceId));
	
	// Create the forwarded index entry
	TMsvEntry forwardEntry;
	forwardEntry.iMtm = KUidMsgTypeText;
	forwardEntry.iServiceId = Entry().Entry().iServiceId;
	forwardEntry.iType = KUidMsvMessageEntry;
	forwardEntry.iDetails.Set(iMsvEntry->Entry().iDetails);				
	forwardEntry.iSize = iMsvEntry->Entry().iSize;	
	if(aPartList&KMsvMessagePartDate)
		forwardEntry.iDate.HomeTime();
	if(aPartList&KMsvMessagePartDescription)
		forwardEntry.iDescription.Set(iMsvEntry->Entry().iDescription);		

	// Get CMsvEntry for destination (parent)
	CMsvEntry* cEntry = CMsvEntry::NewL(Session(), aForwardEntryId, TMsvSelectionOrdering());
	CleanupStack::PushL(cEntry);
	// Synchronously create new child
	CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC();
	CMsvOperation* opert = cEntry->CreateL(forwardEntry, wait->iStatus);
	CleanupStack::PushL(opert);
	wait->Start();
	User::LeaveIfError(opert->iStatus.Int());
	// Check result
	TPckgBuf<TMsvLocalOperationProgress> progressPack;
    progressPack.Copy(opert->ProgressL());
	TMsvLocalOperationProgress progress = progressPack();
	User::LeaveIfError(progress.iError);
	CleanupStack::PopAndDestroy(2);	// opert, wait

	// Get CMsvEntry for new entry
	TMsvId forwardId=progress.iId;
	cEntry->SetEntryL(forwardId);
	
	// Populate new forwarded message with Body text
	if(aPartList&KMsvMessagePartBody)
		{
		CMsvStore* store=cEntry->EditStoreL();
		CleanupStack::PushL(store);
		StoreBodyL(*store);				// Current context is original message
		store->CommitL();
		CleanupStack::PopAndDestroy();	// store
		}

	CleanupStack::PopAndDestroy(); // cEntry
		
	// Request was performed synchronously, so return a completed operation object
	return CMsvCompletedOperation::NewL(Session(), KUidMsgTypeText, progressPack, 
		KMsvNullIndexEntryId, aCompletionStatus);
	}
void MsgStoreHandler::RunL()
{
    TSsmState ssmState = iStateAwareSession.State();
    if (ssmState.MainState() != ESsmNormal) 
    {        
        iStateAwareSession.RequestStateNotification(iStatus);
        SetActive();
    }
    else 
    {
        //Create  the query/operation object
        CMsvSearchSortOperation *operation = CMsvSearchSortOperation::NewL(*iMsvSession);
        CleanupStack::PushL(operation);
        CMsvSearchSortQuery *query = CMsvSearchSortQuery::NewL();
        CleanupStack::PushL(query);

        //set the query options
        query->SetParentId(KMsvGlobalInBoxIndexEntryId);
        query->SetResultType(EMsvResultAsTMsvId);
        query->AddSearchOptionL(EMsvMtmTypeUID, KSenduiMtmSmsUidValue, EMsvEqual);
        query->AddSearchOptionL(EMsvUnreadMessages, ETrue);
        CleanupStack::Pop(query);

        CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC();
        //ownership of Query transferred to Operation  
        operation->RequestL(query, EFalse, wait->iStatus);
        wait->Start();

        //Get No of entries
        RArray<TMsvId> messageArray;
        operation->GetResultsL(messageArray);

        CMsvEntry* entry = NULL;
        for (TInt i = 0; i < messageArray.Count(); ++i) 
        {
            entry = iMsvSession->GetEntryL(messageArray[i]);
            TMsvSmsEntry smsEntry = entry->Entry();
            TSmsDataCodingScheme::TSmsClass classType(TSmsDataCodingScheme::ESmsClass0);
            if (smsEntry.Class(classType)) 
            {
                HandleClass0SmsL(entry, smsEntry.Id());
            }
            else
            {
                delete entry;
                entry = NULL;
            }
        }
        messageArray.Close();
        CleanupStack::PopAndDestroy(2, operation);
    }

}
/**
Delete Existing Service

@param aSession		Current Session reference
@internalTechnology
*/
void CentralRepoUtils::DeleteServiceL(CMsvSession* aSession)
	{
	TMsvId serviceId;
	TRAPD(err,TSmsUtilities::ServiceIdL(*aSession,serviceId));
	if(err !=KErrNotFound)
		{
		CMsvEntry* entry = CMsvEntry::NewL(*aSession,serviceId,TMsvSelectionOrdering());
		CleanupStack::PushL(entry);
		entry->SetEntryL(serviceId);
		entry->SetEntryL(entry->Entry().Parent());
		entry->DeleteL(serviceId);
		CleanupStack::PopAndDestroy(entry);
		}
	}
示例#27
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CSMSSender::DeleteEntryL(TMsvEntry& aMsvEntry)
    {
    // Take a handle to the parent entry
    CMsvEntry* parentEntry = CMsvEntry::NewL(*iSession, aMsvEntry.Parent(), TMsvSelectionOrdering());

    CleanupStack::PushL(parentEntry);

    // here parentEntry is the Sent folder (must be so that we can call DeleteL) 
    iOperation = parentEntry->DeleteL(aMsvEntry.Id(), iStatus);

    CleanupStack::PopAndDestroy(parentEntry);

    SetActive();
    }
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;
	}
void CMtfTestActionCreateEntry::ExecuteActionL()
	{
	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCreateEntry);
	CActiveScheduler::Add(this);
	
	iBlank = KNullDesC().AllocL();

	CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
	TUid paramEntryTypeUid = ObtainValueParameterL<TUid>(TestCase(),ActionParameters().Parameter(1));
	TMsvId paramParentId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(2));
	TUid paramMtmUid = ObtainValueParameterL<TUid>(TestCase(),ActionParameters().Parameter(3), KUidMsvLocalServiceMtm);
	TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(4), KMsvLocalServiceIndexEntryId);
	TMsvPriority paramPriority = ObtainValueParameterL<TMsvPriority>(TestCase(),ActionParameters().Parameter(5),EMsvMediumPriority);
	TInt paramReadOnlyFlag = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(6),EFalse);
	TInt paramVisibleFlag = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(7),ETrue);
	HBufC* paramDescription = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(8),iBlank);
	HBufC* paramDetails = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(9),iBlank);

	iIndexEntry.iType = paramEntryTypeUid;
	iIndexEntry.iMtm = paramMtmUid;	
	iIndexEntry.iServiceId = paramServiceId;
	iIndexEntry.SetPriority(paramPriority);	
	iIndexEntry.SetReadOnly(paramReadOnlyFlag);	
	iIndexEntry.SetVisible(paramVisibleFlag);	
	iIndexEntry.iDescription.Set(paramDescription->Des());
	iIndexEntry.iDetails.Set(paramDetails->Des());
	iIndexEntry.iDate.HomeTime();

	CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramParentId,TMsvSelectionOrdering());
	CleanupStack::PushL(entry);
	entry->SetEntryL(paramParentId);
	if (entry->OwningService() == KMsvLocalServiceIndexEntryId)
		{
		entry->CreateL(iIndexEntry);
		CleanupStack::PopAndDestroy(entry);
		TMsvId paramEntryId;
		paramEntryId = iIndexEntry.Id();

		StoreParameterL<TMsvId>(TestCase(),paramEntryId,ActionParameters().Parameter(10));

		TestCase().ActionCompletedL(*this);
		}
	else
		{
		iOperation = entry->CreateL(iIndexEntry,iStatus);
		SetActive();
		}
	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCreateEntry);
	}
示例#30
0
TVerdict CTestUTCSort::TestSortingL()
	{
	
	TVerdict result=EPass;
	//create ordering objects
	TMsvSelectionOrdering ordering;	
	ordering.SetSorting(EMsvSortByDate);
	
	//sort the gloabl inbox by date
	CMsvEntry* inboxEntry = CMsvEntry::NewL(*iSession, KMsvDraftEntryIdValue,ordering);
	CleanupStack::PushL(inboxEntry);
	
	//retrieve the children of the inbox
	CMsvEntrySelection* msvEntrySelection;
	msvEntrySelection=inboxEntry->ChildrenL();
	CleanupStack::PushL(msvEntrySelection);
	
	CMsvEntry* child;
	TMsvEntry childDetails;
	TBuf<45> dateTimeString;
	
	//look at the id of each child and test its id, these should
	//be in the order the entries were created.
	for(TInt i=0;i<KNumEmailMessages;++i)
		{
		child=iSession->GetEntryL((*msvEntrySelection)[i]);
		childDetails=child->Entry();
		delete child;

		//print the time of the entry to the log file		
		dateTimeString.Zero();
		FormatDateTime(dateTimeString,childDetails.iDate); 
		INFO_PRINTF2(_L("%S"),&dateTimeString);
				
		if(childDetails.Id()!=iTMsvIdList->At(i))
			{
			ERR_PRINTF1(_L("Entries in wrong order"));	
			result=EFail;
			break;
			}
		}

	CleanupStack::PopAndDestroy(msvEntrySelection);
	CleanupStack::PopAndDestroy(inboxEntry);

	return result;
	
	}