示例#1
0
void CTestNbssMtm::DoProcessAgainL()
	{
	TBuf8<1>dummy;
	iState = ENbssTestProcess;
	// add service entry and msg entry to selection passed to MTM
	iSelection->Reset();
	iSelection->AppendL((*iMsvSelection)[iFilesProcessed]);

#if defined _HEAP_FAILURE_TEST_
	TBool finished=EFalse;

#ifdef _DEBUG
	TInt failCount=0;
#endif

	while (!finished)
		{
		__UHEAP_FAILNEXT(failCount++);
		TRAPD(error,iNbssServerMtm->StartCommandL(*iSelection, KBiosMtmProcess, dummy, iStatus));
		if (error==KErrNone)
			{
			finished=ETrue;
			__UHEAP_RESET;
			}
		else 
			{
			test(error==KErrNoMemory);
			__UHEAP_RESET;
			}
		}
#else
	iNbssServerMtm->StartCommandL(*iSelection, KBiosMtmProcess, dummy, iStatus);
#endif
	iState = ENbssTestProcess;
	}
// ----------------------------------------------------------------------------
// CIpsPlgPop3ConnectOp::DoPopulateL()
// ----------------------------------------------------------------------------
//
void CIpsPlgPop3ConnectOp::DoPopulateL()
    {
    FUNC_LOG;
    NM_COMMENT("CIpsPlgPop3ConnectOp: populating");
    // <qmail> unnecessary: iStatus = KRequestPending;

    // Prepare parameters and include filtering
    TImPop3PopulateOptions pop3GetMailInfo;
    pop3GetMailInfo.SetMaxEmailSize( KMaxTInt32 );
// <qmail>
    pop3GetMailInfo.SetPopulationLimit( GetPopulateLimitFromSettingsL() );
    TPckgBuf<TImPop3PopulateOptions> params( pop3GetMailInfo );

    // <qmail> selection is no longer a member variable
    CMsvEntrySelection* selection = new(ELeave) CMsvEntrySelection;
    CleanupStack::PushL( selection );
    selection->InsertL( 0, iService );
    iBaseMtm->SwitchCurrentEntryL( iService );
    // Start the fetch operation
    InvokeClientMtmAsyncFunctionL( KPOP3MTMPopulateAll, *selection, params ); // <qmail> 1 param removed
    SetActive();
    CleanupStack::PopAndDestroy( selection );
// <qmail> iEventHandler->SetNewPropertyEvent call removed from here
// </qmail>
    }
// 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);
	}
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);)
示例#5
0
EXPORT_C void CMsvTestUtils::DeleteServiceL(TUid aMtm)
	{
	CMsvEntrySelection* sel = new (ELeave) CMsvEntrySelection();
	CleanupStack::PushL(sel);
	TMsvId firstId = 0;
	TRAPD(err, ServiceIdL(aMtm, firstId, sel));
	
	if (!err)
		{
		TInt count = sel->Count();

		while (count--)
			{
			TMsvId del = sel->At(count);
			TRAP(err, SetEntryL(del));

			if (!err)
				{
				TRAP(err, SetEntryL(Entry().Parent()));

				if (!err)
					{
					TRAP(err, DeleteEntryL(del));
					}
				}

			if (err)
				{
				Printf(_L("Error deleting service entry\n"));
				}
			}
		}

	CleanupStack::PopAndDestroy(); //sel
	}
示例#6
0
void CImImap4Compound::GenericCopyL(TRequestStatus& aStatus, const CMsvEntrySelection& aSourceSel, const TMsvId aDestination, TInt* aSequence)
	{
	DBG((iSession->LogText(_L8("CImImap4Compound::GenericCopyL()"))));
 	Queue(aStatus);

	// Save parameters
	iSource=aSourceSel[0];
	delete iSourceSel;
	iSourceSel = NULL;
	iSourceSel=aSourceSel.CopyL();
	iDestinationFolder=aDestination;
	iMessageSelection=iSelectionStillToCopy=iSelectionStillToDelete=aSourceSel.Count();

	// Check that selection elements are contiguous. Just call Copy on contiguous selections.
	
	iSourceFolder=FindFolderL((*iSourceSel)[iSelectionStillToCopy-1]);

	// Find the offending source folder
	if (iSourceFolder == NULL &&
		aSequence != SeqMoveFromLocal && aSequence != SeqCopyFromLocal)
		{
		Complete(KErrNotFound);
		return;
		}

	// Select it
	iStep=0;
	iSequence=aSequence;
	DoRunL();
	}
// ----------------------------------------------------------------------------
// ---------------------------------------------------------------------------- 
void CIpsSosAOImapAgent::StartSyncL()
    {
    FUNC_LOG;
    if ( iOngoingOp )
        {
        User::Leave( KErrNotReady );
        }
    LoadSettingsL( );
    if ( !IsConnected() )
        {
        NM_COMMENT("CIpsSosAOImapAgent: starting sync");
        TPckg<MMsvImapConnectionObserver*> parameter(this);
        // connect and synchronise starts background sync or idle
        CMsvEntrySelection* sel = new ( ELeave ) CMsvEntrySelection();
        CleanupStack::PushL( sel );
        sel->AppendL( iServiceId );
        iImapClientMtm->SwitchCurrentEntryL( iServiceId );
        iOngoingOp = iImapClientMtm->InvokeAsyncFunctionL(
                KIMAP4MTMConnectAndSyncCompleteAfterFullSync, 
                *sel, parameter, iStatus);
        CleanupStack::PopAndDestroy( sel );
        SetActive();
        iState = EStateConnectAndSync;
        }
    else
        {
        NM_COMMENT("CIpsSosAOImapAgent: already connected do not sync");
        // do not do anything if we are connected, especially do never
        // try to sync if sync is is already started (ex. from ips plugin)
        // that cause problems with imap flags etc.
        iError = KErrCancel;
        iState = EStateCompleted;
        SetActiveAndCompleteThis();
        }
    }
// -----------------------------------------------------------------------------
// 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;        
    }
示例#9
0
EXPORT_C void CMsvServerEntry::CopyEntryL(TMsvId aId, TMsvId aDestination, TRequestStatus& aObserverStatus)
//
// Recursively copies a child of the context to another entry that belongs to a different service.
//
/** Copies a child of the context to another entry. All descendants will be copied
as well.

The copy is carried out asynchronously. The caller should supply in aObserverStatus
the status word of an active object that it owns. The function will signal
this to be completed when the copy is complete.

If the function leaves, no changes are made.

@param aId The ID of the entry to copy
@param aDestination The ID of new parent
@param aObserverStatus The request status to be completed when the operation
has finished
@leave KErrArgument The destination is a child of an aSelection entry
@leave KErrInUse The store or a file associated with an entry is open
@leave KErrNoMemory A memory allocation failed
@leave KErrNotFound An aSelection entry is not a child of the context
@leave KErrPathNotFound The destination does not exist */
	{
	CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection;
	CleanupStack::PushL(selection);
	selection->AppendL(aId);
	iCompletedSelection = NULL;
	iCompletedEntryId = NULL;

	DoCopyEntriesL(*selection, aDestination, aObserverStatus);

	CleanupStack::PopAndDestroy(); // selection
	}
示例#10
0
void CMsvServerEntry::DoMoveEntriesL(CMsvEntrySelection& aSelection, TMsvId aDestination, CMsvEntrySelection*& aMoved)
	{
	__ASSERT_DEBUG(!aMoved, PanicServer(EMsvMoveSelectionNotNull));
	__ASSERT_DEBUG(aSelection.Count() > 0, PanicServer(EMsvMovingEmptySelection));

	aMoved = new(ELeave)CMsvEntrySelection;
	aMoved->SetReserveL(aSelection.Count());

	CMsvMove* move = CMsvMove::NewL(iServer);
	CleanupStack::PushL(move);

	TInt error = KErrNone;

	TInt count = aSelection.Count();
	while(count--)
		{
		TMsvId id = aSelection.At(count);
		if (!IsAChild(id))
			error = KErrNotFound;
		else
			{
			move->StartL(id, aDestination);
			aSelection.Delete(count);
			aMoved->AppendL(id);
			}
		}
	User::LeaveIfError(error);
	CleanupStack::PopAndDestroy(); // move
	}
示例#11
0
EXPORT_C void CMsvServerEntry::MoveEntryL(TMsvId aId, TMsvId aDestination, TRequestStatus& aObserverStatus)
//
//
//
/** Moves a child of the context to another entry that belongs to a different service.
All descendants will be moved as well.

The move is carried out asynchronously. The caller should supply in aObserverStatus
the status word of an active object that it owns. The function will signal
this to be completed when the move is complete.

If the function leaves, no changes are made.

In pre-Unicode versions an asynchronous move can be cancelled through CancelMoveEntry();
in other releases, use Cancel().

@param aId The ID of the entry to move
@param aDestination The ID of new parent
@param aObserverStatus The request status to be completed when the operation
has finished
@leave KErrArgument The destination is a child of aId
@leave KErrInUse The store or a file associated with the entry is open
@leave KErrNoMemory A memory allocation failed
@leave KErrNotFound aId is not a child of the context
@leave KErrPathNotFound The destination does not exist */
	{
	CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection;
	CleanupStack::PushL(selection);
	selection->AppendL(aId);

	MoveEntriesL(*selection, aDestination, aObserverStatus);

	CleanupStack::PopAndDestroy(); // selection
	}
TMsvId CTestImapSyncManager::FindFolderL(const TDesC& aName, TBool aCaseSensitive)
	{
	TMsvId remoteId = KErrNotFound;
	iEntry->SetEntry(iServiceId);
	CMsvEntrySelection* msvEntrySelection = new (ELeave) CMsvEntrySelection;
	iEntry->GetChildren(*msvEntrySelection);
	TPtrC iEntryName = aName;
	TInt count = msvEntrySelection->Count();
	for (TInt i=0; i<count; i++) 
		{	
		iEntry->SetEntry((*msvEntrySelection)[i]);
		
		if (aCaseSensitive)
			{
			if (iEntryName.Compare(iEntry->Entry().iDetails ) == 0)
				{
				remoteId = (*msvEntrySelection)[i];
				break;
				}
			}
		else if ((iEntryName.CompareF(iEntry->Entry().iDetails) == 0))
			{
			remoteId = (*msvEntrySelection)[i];
			break;
			}
		}
		delete msvEntrySelection;
	return remoteId;	
	}
// -----------------------------------------------------------------------------
// 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;           
    }
void CBulkCommitServerMtm::ConstructL()
	{	
	// Get the entry id for the bulkcommit service entry.
	User::LeaveIfError(iServerEntry->SetEntry(KMsvRootIndexEntryId));
	CMsvEntrySelection* sel = new (ELeave) CMsvEntrySelection();
	CleanupStack::PushL(sel);
	User::LeaveIfError(iServerEntry->GetChildrenWithMtm(KUidBulkCommitTestMtm, *sel));
	TInt count = sel->Count();
	if( count > 1 )	// should only be one service entry
		{
		User::Leave(KErrCorrupt);
		}
	if( count == 0 )
		{
		// Create the settings
		TMsvEntry serviceEntry;
		serviceEntry.iType= KUidMsvServiceEntry;
		serviceEntry.iMtm = KUidBulkCommitTestMtm;

		User::LeaveIfError(iServerEntry->CreateEntry(serviceEntry));
		iServiceId = serviceEntry.Id();		
		}
	else
		{
		iServiceId = sel->At(0);
		}
	CleanupStack::PopAndDestroy(sel);	
	}
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;
	}
示例#16
0
// Delete
void CImImap4Compound::DeleteL(TRequestStatus& aStatus, const CMsvEntrySelection& aSourceSel)
	{
	LOG_COMMANDS( (iSession->LogText(_L8("COMPOUND Delete selection"))));

	Queue(aStatus);

	// Save parameters
	iSource=aSourceSel[0];
	delete iSourceSel;
	iSourceSel = NULL;
	iSourceSel=aSourceSel.CopyL();
	iMessageSelection=iSelectionStillToDelete=aSourceSel.Count();

	// Find the offending source folder
	if ((iSourceFolder=FindFolderL(iSource))==NULL)
		{
		Complete(KErrNotFound);
		return;
		}

	// Select it
	iStep=0;
	iSequence=SeqDelete;
	DoRunL();
	}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
void CIpsPlgImap4PopulateOp::ConstructL( 
        const CMsvEntrySelection& aSel,
        TBool aDoFilterSelection )
    {
    FUNC_LOG;
    BaseConstructL( KUidMsgTypeIMAP4 );
    
    // <qmail> instantiation moved here
    iSelection = new ( ELeave ) CMsvEntrySelection();
    iTempSelection = new ( ELeave ) CMsvEntrySelection();

    if ( aDoFilterSelection )
        {
        FilterSelectionL( aSel );
        }
    else // no filtering; populate all
        {
        // first entry in selection is serviceId
        for ( TInt i = 1; i < aSel.Count(); i++ )
            {
            if ( aSel[i] != iService )
                {
                iSelection->AppendL( aSel.At(i) );
                }
            }
        }
    DoConnectL();
    }
LOCAL_C void SendSmtpMessageL()
	{
	CTestActive* testActive = new (ELeave) CTestActive();
	CleanupStack::PushL(testActive);
	testUtils->iMsvEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryId);
	testUtils->InstantiateSmtpClientMtmL();
	CMsvEntrySelection* sendSel = testUtils->iMsvEntry->ChildrenL();
	CleanupStack::PushL(sendSel);
	TInt count = sendSel->Count();
	test(count >= 1);
	testUtils->Printf(KMsgSend, count);
	testUtils->iSmtpClientMtm->SetCurrentEntryL(testUtils->iMsvSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId));
	CMsvOperation* msvOperation = testUtils->iSmtpClientMtm->Entry().CopyL(*sendSel, smtpService, testActive->iStatus);
	CleanupStack::PushL(msvOperation);
	testActive->StartL();
	CActiveScheduler::Start();
	//check progress
    testUtils->Printf(KMsgCompleted, testActive->iStatus.Int()); 
	CMsvEntrySelection* sendSelc = testUtils->iMsvEntry->ChildrenL();
	TInt noOfMessages = sendSelc->Count();
	// Check Whether the mails in Outbox is Zero (i.e. mails has been sent..).
    test(noOfMessages == 0);
  	delete sendSelc;
 	TImSmtpProgress temp;	
	TPckgC<TImSmtpProgress> paramPack(temp);
	const TDesC8& progBuf = msvOperation->ProgressL();
	paramPack.Set(progBuf);
	TImSmtpProgress progress = paramPack();	
	testUtils->Printf(KProgressError, progress.Error()); 
	test(progress.Error()==0);
	CleanupStack::PopAndDestroy(3,testActive); //msvOperation,sendsel,testActive
	}
/**
GetMessagePartIndexL()
Retrieves the part index id for the email identified by aEntry

@param aEntry
A valid email identifier

@param aUid
An identifier tfor the type of message part to be retrieved

@return
TMsvId - message part identifier
*/
TMsvId CT_MsgComparePopEmailMsgs::GetMessagePartIndexL(TMsvEntry& aEntry, TUid aUid)
	{
	static TBool msgPartFound = EFalse;	
	TMsvId msgPartId = 0;
	CMsvEntry*	baseEntry  = iSharedDataPOP.iSession->GetEntryL(aEntry.Id());
	CleanupStack::PushL(baseEntry);
	CMsvEntrySelection*	selection =  baseEntry->ChildrenL();
	CleanupStack::PushL(selection);
	TInt count = selection->Count();
	TInt ind1;
	CMsvEntry* entry = iSharedDataPOP.iSession->GetEntryL(KMsvRootIndexEntryId);
	CleanupStack::PushL(entry);
	for (ind1=0, msgPartFound=EFalse; ind1 < count; ind1++)
		{
		if(msgPartFound)
			{
			break;
			}		
		TMsvId	childId  = selection->At(ind1);
		entry->SetEntryL(childId);

		if (entry->Entry().iType  == aUid)
			{
			msgPartId = childId;
			break;
			}
		else if (entry->Entry().iType  == KUidMsvFolderEntry)
			{
			TMsvEntry ent = entry->Entry();
			msgPartId = GetMessagePartIndexL(ent, aUid);
			}
		}
	CleanupStack::PopAndDestroy(3, baseEntry);  // entry,selection,baseEntry
	return msgPartId;
	}
void CPopsTestHarness::CreateTestHarnessesL()
	{
	CMsvEntrySelection* serviceSelection = new (ELeave) CMsvEntrySelection;
	CleanupStack::PushL(serviceSelection);
	serviceSelection->AppendL(iPop3Service);
	TBuf8<128> parameter;

	//--------------------------------------------
	// Copy To Local
	//--------------------------------------------
	delete iConnectAndCopyAll;
	iConnectAndCopyAll = NULL;
	iConnectAndCopyAll = CMtmTestHarness::NewL(*(iTestUtils->iPopServerMtm), *iTestUtils);
	// Connect
	iConnectAndCopyAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils->iPopServerMtm), serviceSelection, KPOP3MTMConnect, parameter));
	// Copy all messages under the service to the local inbox.
	CMtmTestCommand* copyToLocal = CMtmTestCopyToLocal::NewL(*(iTestUtils->iPopServerMtm), 0, KMsvGlobalInBoxIndexEntryId);
	iConnectAndCopyAll->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils->iPopServerMtm), copyToLocal, iPop3Service, *(iTestUtils->iServerEntry)));
	// Quit
	iConnectAndCopyAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils->iPopServerMtm), serviceSelection, KPOP3MTMDisconnect, parameter));

	//--------------------------------------------
	// Copy Within Service
	//--------------------------------------------
	delete iConnectAndPopulateAll;
	iConnectAndPopulateAll = NULL;
	iConnectAndPopulateAll = CMtmTestHarness::NewL(*(iTestUtils->iPopServerMtm), *iTestUtils);
	// Connect
	iConnectAndPopulateAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils->iPopServerMtm), serviceSelection, KPOP3MTMConnect, parameter));
	// Copy all messages under the service to the local service.
	copyToLocal = CMtmTestCopyWithinService::NewL(*(iTestUtils->iPopServerMtm), 0, iPop3Service);
	iConnectAndPopulateAll->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils->iPopServerMtm), copyToLocal, iPop3Service, *(iTestUtils->iServerEntry)));
	// Quit
	iConnectAndPopulateAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils->iPopServerMtm), serviceSelection, KPOP3MTMDisconnect, parameter));


	//--------------------------------------------
	// Offline Copy
	//--------------------------------------------
	CMsvServerEntry* serverEntry = iTestUtils->iServerEntry;
	serverEntry->SetEntry(iPop3Service);
	CMsvEntrySelection* newMessageList = new (ELeave)CMsvEntrySelection();
	CleanupStack::PushL(newMessageList);
	serverEntry->GetChildren(*newMessageList);
	delete iOfflineCopy;
	iOfflineCopy = NULL;
	iOfflineCopy = CMtmTestHarness::NewL(*(iTestUtils->iPopServerMtm), *iTestUtils);
	// Copy all messages under the service to the local inbox.
	copyToLocal = CMtmTestCopyToLocal::NewL(*(iTestUtils->iPopServerMtm), newMessageList, KMsvGlobalInBoxIndexEntryId);
	iOfflineCopy->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils->iPopServerMtm), copyToLocal, iPop3Service, *(iTestUtils->iServerEntry)));
	// Connect
	iOfflineCopy->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils->iPopServerMtm), serviceSelection, KPOP3MTMConnect, parameter));
	// Quit
	iOfflineCopy->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils->iPopServerMtm), serviceSelection, KPOP3MTMDisconnect, parameter));


	CleanupStack::PopAndDestroy(2); // newMessageList, serviceSelection
	}
void CMtfTestActionGetArrayCount::ExecuteActionL()
	{
    TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionGetArrayCount);
	CMsvEntrySelection* paramSelection = ObtainParameterReferenceL<CMsvEntrySelection>(TestCase(),ActionParameters().Parameter(0));
	TInt totalChildren = paramSelection->Count();
	StoreParameterL<TInt>(TestCase(),totalChildren,ActionParameters().Parameter(1));
	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionGetArrayCount);
	TestCase().ActionCompletedL(*this);
	}
示例#22
0
LOCAL_C void TestInitialStructureL(CMsvServer& aServer)
	{
	TInt services=1;
	TInt localFolders=5;

	CMsvServerEntry* sEntry = CMsvServerEntry::NewL(aServer, KMsvRootIndexEntryId);
	CleanupStack::PushL(sEntry);
	CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection;
	CleanupStack::PushL(selection);
	TMsvSelectionOrdering sort(KMsvNoGrouping, EMsvSortByNone, ETrue);
	sEntry->SetSort(sort);

	// root
	REPORT_IF_ERROR(sEntry->SetEntry(KMsvRootIndexEntryId));
	test(sEntry->Entry().iDetails==KNullDesC);
	test(sEntry->Entry().iDescription==KNullDesC);
	REPORT_IF_ERROR(sEntry->GetChildren(*selection));
	test(selection->Count()==services);
	
	// local service
	REPORT_IF_ERROR(sEntry->SetEntry(KMsvLocalServiceIndexEntryId));
	test(sEntry->Entry().iDetails==_L("Local"));
	REPORT_IF_ERROR(sEntry->GetChildren(*selection));
	test(selection->Count()==localFolders);

	// standard folders
	REPORT_IF_ERROR(sEntry->SetEntry(KMsvGlobalInBoxIndexEntryId));
	test(sEntry->Entry().iDetails==_L("Inbox"));
	REPORT_IF_ERROR(sEntry->SetEntry(KMsvGlobalOutBoxIndexEntryId));
	test(sEntry->Entry().iDetails==_L("Outbox"));
	REPORT_IF_ERROR(sEntry->SetEntry(KMsvDraftEntryId));
	test(sEntry->Entry().iDetails==_L("Drafts"));
	REPORT_IF_ERROR(sEntry->SetEntry(KMsvSentEntryId));
	test(sEntry->Entry().iDetails==_L("Sent"));
	REPORT_IF_ERROR(sEntry->SetEntry(KMsvDeletedEntryFolderEntryId));
	test(sEntry->Entry().iDetails==_L("Deleted"));

	// check that only the index file and the local services dir are present
	CDir* dir;
	const TUidType type(KMsvEntryFile, KMsvEntryFile, KNullUid);
	REPORT_IF_ERROR(theUtils->FileSession().GetDir(KTestFolder,type , ESortNone, dir));
	TInt count=dir->Count();
	test(count==0) ;
	delete dir;

	// check that the local services dir is empty
	TFileName filename;
	filename.Append(KTestLocalService);
	filename.Append(_L("\\"));
	REPORT_IF_ERROR(theUtils->FileSession().GetDir(filename,type , ESortNone, dir));
	count=dir->Count();
	test(count==0) ;
	delete dir;

	CleanupStack::PopAndDestroy(2); // sEntry,selection
	}
void CTestImapSyncManager::DeleteFolderL(const TDesC& aName)
	{
	TBuf8<128> parameter;
	TMsvId id = FindFolderL(aName);
	// delete
	CMsvEntrySelection* msvEntrySelection = new (ELeave) CMsvEntrySelection;
	msvEntrySelection->AppendL(id);
	iImapServerMtm->DeleteAllL(*msvEntrySelection,iActiveWaiter->iStatus);
	iActiveWaiter->WaitActive();
	delete msvEntrySelection;
	}
void CTestImapSyncManager::SetSubscriptionL(const TDesC& aName)
	{
	TBuf8<128> parameter;
	TMsvId id = FindFolderL(aName);
	CMsvEntrySelection*	msvEntrySelection = new (ELeave) CMsvEntrySelection;
	msvEntrySelection->Reset();
	msvEntrySelection->AppendL(id);
	iImapServerMtm->StartCommandL(*msvEntrySelection, KIMAP4MTMLocalSubscribe, parameter, iActiveWaiter->iStatus);
	iActiveWaiter->WaitActive();
	TBool sub = ((TMsvEmailEntry)iEntry->Entry()).LocalSubscription();
	delete msvEntrySelection;
	}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
//
void CIpsSosAOImapPopLogic::UpdateLogicArrayL( 
        const CMsvEntrySelection& aChilds )
    {
    FUNC_LOG;
    for ( TInt i = 0; i < aChilds.Count(); i++ )
        {
        TBool found = EFalse;
        TMsvId mboxId = aChilds.At(i);
        for ( TInt j = 0; !found && j < iMailboxLogics.Count(); j++  )
            {
            if ( iMailboxLogics[j]->GetMailboxId() == mboxId )
                {
                found = ETrue;
                }
            }
		//<QMail>
        CIpsSosAOSettingsHandler* settings = 
                 CIpsSosAOSettingsHandler::NewL(iSession, mboxId);
        CleanupStack::PushL(settings);
         
        if ( !found  && ( settings->AlwaysOnlineState() 
                != IpsServices::EMailAoOff || 
                    settings->EmailNotificationState() 
                != IpsServices::EMailEmnOff || 
                    !settings->FirstEmnReceived() )
                 )
            {
            CIpsSosAOMBoxLogic* newLogic = CIpsSosAOMBoxLogic::NewL( 
                    iSession, mboxId );
            CleanupStack::PushL( newLogic );
            iMailboxLogics.AppendL( newLogic );
            CleanupStack::Pop( newLogic );
            }
        else if ( found && settings->AlwaysOnlineState() 
                == IpsServices::EMailAoOff &&
                    settings->EmailNotificationState() 
                == IpsServices::EMailEmnOff &&
                    settings->FirstEmnReceived() )
            {
            StopAndRemoveMailboxL( mboxId );
            }
        
        CleanupStack::PopAndDestroy(settings);
		//</QMail>
        }
    
    //finally, check for orphans ( mailbox has been deleted )
    RemoveOrphanLogicsL();
    }
/**
doTestStepL()
It establishes connection with the Pop server using a POP account.
The account is identified by the account name that is read from the INI file.

@return
Returns the test step result
*/
TVerdict CT_MsgConnectPop3Server::doTestStepL()
	{	
	INFO_PRINTF1(_L(" Test Step : ConnectPop3Server"));
	TPtrC popAccountName;
	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
		{
		ERR_PRINTF1(_L("Pop Account Name is not specified"));
		SetTestStepResult(EFail);
		}

	else
		{
		// Retrieving the Pop service Id for the given Pop account
		TMsvId popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName);
		INFO_PRINTF2(_L("Pop service id is %d"),popServiceId);

		// Change the current context
		iSharedDataPOP.iMtm->SwitchCurrentEntryL(popServiceId);

		CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
		CleanupStack::PushL(selection);

		// Appends the popServiceId onto the end of the array
		selection->AppendL(popServiceId);
		
		TBuf8<KMaxLenghtOfChar> param;

		CT_MsgActive&	active=Active();
		// Attempts to connect to the Pop3 Service
		iOperation = iSharedDataPOP.iMtm->InvokeAsyncFunctionL(KPOP3MTMConnect,*selection,param, active.iStatus);

		active.Activate();
		CActiveScheduler::Start();
	
		// Get the error code from TPop3Progress
		TPop3Progress temp;
		TPckgC<TPop3Progress> paramPack(temp);
		paramPack.Set(iOperation->ProgressL());
		TPop3Progress progress=paramPack();
		SetTestStepError(progress.iErrorCode);

		delete iOperation;
		iOperation=NULL;
		
		CleanupStack::PopAndDestroy(selection); //operation,selection
	//	User::LeaveIfError(active.Result());
		}
	return TestStepResult();
	}
示例#27
0
TBool CMsvServerEntry::AreChildren(const CMsvEntrySelection& aSelection) const
//
// Returns true if all the entries are children
//
	{
	TInt count = aSelection.Count();
	while (count--)
		{
		if (!IsAChild(aSelection.At(count)))
			{
			return EFalse;
			}
		}
	return ETrue;
	}
示例#28
0
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
void CSMSMonitor::CheckInboxL(void)
{	
	TInt smsCount(0),mmsCount(0);

	CMsvEntry* Entrie = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
	if(Entrie)
	{
		CleanupStack::PushL(Entrie);
		
		if(Entrie->Count())
		{
			TMsvSelectionOrdering MySortType;
			
			MySortType.SetSorting(EMsvSortByDate);
			
			Entrie->SetSortTypeL(MySortType);
			
			CMsvEntrySelection* entries = Entrie->ChildrenL();
			if(entries)
			{
				CleanupStack::PushL(entries);
		 
				for(TInt i = (entries->Count() - 1); i >= 0; i--)
				{
					if(Entrie->ChildDataL(entries->At(i)).Unread())
					{	
						if(Entrie->ChildDataL(entries->At(i)).iMtm == KUidMsgTypeSMS)
						{
							smsCount++;
						}
						else if(Entrie->ChildDataL(entries->At(i)).iMtm == KUidMsgTypeMultimedia)
						{
							mmsCount++;
						}
					}
				} 
			
				CleanupStack::PopAndDestroy(entries);
			}
		}
		
		CleanupStack::PopAndDestroy(1);//Entrie
	}
	
	if(iObserver){
		iObserver->InboxChangedL(smsCount,mmsCount);
	}
}
void CMtfTestActionDisconnectPop3Server::ExecuteActionL()
	{
	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionDisconnectPop3Server);
	TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(0));
	CPop3ClientMtm* paramMtm = ObtainParameterReferenceL<CPop3ClientMtm>(TestCase(),ActionParameters().Parameter(1));

	CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
	CleanupStack::PushL(selection);
	selection->AppendL(paramServiceId);
	TBuf8<1> param;
	iOperation = paramMtm->InvokeAsyncFunctionL(KPOP3MTMDisconnect,*selection,param,iStatus);
	CleanupStack::PopAndDestroy(selection);
	CActiveScheduler::Add(this);
	SetActive();
	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionDisconnectPop3Server);
	}
/**
Schedules messages on the task scheduler.

Messages that are successfully scheduled have their sending state set to
KMsvSendStateScheduled.

@param aSelection 
Array of message IDs that need to be scheduled. This array cannot be empty.
All the messages identified in the selection must belong to the same MTM;
be scheduled for the same time; have the same setting for their OffPeak() 
flag; have the scheduled time stored in the iDate member of their 
corresponding TMsvEntry. 

@param aPackage 
Scheduling options

@leave Any error code but KErrLocked and KErrNotFound
The method overloading CMsvScheduledEntry::GetMessageL() left with an error,
i.e. the scheduling info of one of the messages from the selection could not
be retrieved from the message server.

@leave Any error code
Unable to reset the previous scheduling info for a message.

@panic ScheduleSend-DLL 0
The array of message IDs is empty.
Debug build only.

@panic ScheduleSend-DLL 1
At least one of the selected messages is scheduled for a different time
as the others.
Debug build only.

@panic ScheduleSend-DLL 2
At least one of the selected messages does not belong to the same MTM.
Debug build only.

@panic ScheduleSend-DLL 3
At least one of the selected messages does not have the same off-peak 
settings as the others.
Debug build only.
*/
EXPORT_C void CMsvScheduleSend::ScheduleL(const CMsvEntrySelection& aSelection, const TMsvSchedulePackage& aPackage)
	{
	__ASSERT_DEBUG(aSelection.Count() > 0, gPanic(EMessageSelectionEmpty));

	iPackage = aPackage;
	GetMessagesL(aSelection);	//Leaves with KErrNotFound if there
																	//are no messages returned in schEntries
	TInt entryCount = iSchEntries->Count();
	SCHSENDLOG(FLog(_L8("Asked to schedule %d msgs"), entryCount));
	
	if (entryCount)
		{
		TTime startTime;

#if defined(_DEBUG)
		CMsvScheduledEntry* firstEntry = (*iSchEntries)[0];
#endif

		while (entryCount--)
			{
			CMsvScheduledEntry* message = iSchEntries->At(entryCount);
			__ASSERT_DEBUG(firstEntry->ScheduleDate() == message->ScheduleDate(), gPanic(EMessagesNotSameTime));

			startTime = message->ScheduleDate();

			// Reset previous scheduling info
			DeleteScheduleForEntryL(*message);
			ResetScheduleInfoForEntryL(*message, EFalse);
			}

		//Schedule the messages
		DoScheduleL(*iSchEntries, KMsvSendStateScheduled, startTime, EFalse);
		}
	}