// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
//
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 );
    }
/**
  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);
	}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
//
void CIpsSosAOImapPopLogic::RefreshMailboxListL( )
    {
    FUNC_LOG;
    CMsvEntry* cEntry = iSession.GetEntryL( KMsvRootIndexEntryId );
    CleanupStack::PushL( cEntry );
    
    CMsvEntrySelection* childEntries = cEntry->ChildrenWithMtmL( KSenduiMtmPop3Uid );
    CleanupStack::PushL( childEntries );
    UpdateLogicArrayL( *childEntries );
    CleanupStack::PopAndDestroy( childEntries );
    
    childEntries = cEntry->ChildrenWithMtmL( KSenduiMtmImap4Uid );
    CleanupStack::PushL( childEntries );
    UpdateLogicArrayL( *childEntries );
    CleanupStack::PopAndDestroy( childEntries );
    CleanupStack::PopAndDestroy( cEntry );
    }
EXPORT_C TBool phonehelper::mailbox_defined()
{
	CALLSTACKITEM_N(_CL("phonehelper"), _CL("mailbox_defined"));

	TBool mailbox_defined = EFalse;

	dummyhandler * dummy=new (ELeave) dummyhandler;
	CleanupStack::PushL(dummy);
	CMsvSession * session = CMsvSession::OpenSyncL(*dummy);
	CleanupStack::PushL(session);
	CMsvEntry* entry = CMsvEntry::NewL(*session, KMsvRootIndexEntryId ,TMsvSelectionOrdering());
	CleanupStack::PushL(entry);
	CMsvEntrySelection* imap = entry->ChildrenWithMtmL(KSenduiMtmImap4Uid);
	CleanupStack::PushL(imap);
	CMsvEntrySelection* pop = entry->ChildrenWithMtmL(KSenduiMtmPop3Uid);
	CleanupStack::PushL(pop);
	if ((imap->Count() >0) || (pop->Count()>0)) mailbox_defined = ETrue;
	CleanupStack::PopAndDestroy(5); //dummy, session, entry
	return mailbox_defined;
}
Ejemplo n.º 5
0
LOCAL_C void DoExecuteL()
	{
	CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler();
	CleanupStack::PushL(activeScheduler);
	CActiveScheduler::Install(activeScheduler);
	
	// Create Session
	CSessionObserver* sessionObserver;
	sessionObserver = new (ELeave) CSessionObserver;
	CleanupStack::PushL(sessionObserver);
		
	CMsvSession* session = CMsvSession::OpenSyncL(*sessionObserver);
	CleanupStack::PushL(session);
	
	// Set the message entry to global Outbox folder
	CMsvEntry* msvEntry = session->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
	CleanupStack::PushL(msvEntry);
	
	// Get the selection of Pigeon messages present in Outbox
	CMsvEntrySelection* selection = msvEntry->ChildrenWithMtmL(KUidMsgTypePigeon);
	CleanupStack::PushL(selection);
	
	// Schedule it to send immediately - use default settings.
	CMsvScheduleSettings* settings = CMsvScheduleSettings::NewL();
	CleanupStack::PushL(settings);

	RScheduler scheduler;
	TSchedulerItemRef ref;
	
	CMsvScheduleSend::ConnectAndRegisterL(scheduler, *settings);
	CleanupClosePushL(scheduler);
	
	TInt selCount = selection->Count();
	
	for( TInt index = 0; index < selCount; ++index )
		{
		msvEntry->SetEntryL(selection->At(index));
			
		if(msvEntry != NULL)
			{
			TMsvEntry entry = msvEntry->Entry();
					
			ref.iHandle = KErrNotFound;
			
			FindOrCreateScheduleL(scheduler, entry.iDate, *settings, ref);

			User::LeaveIfError(scheduler.DisableSchedule(ref.iHandle));
		
			TMsvSchedulePackage package;
			package.iPollProgress = 3000000;
			package.iCommandId = ESendScheduledL;
			package.iId = selection->At(index);
				
			TTaskInfo info;

			CMsvScheduleSend::ScheduleEntryL(scheduler, ref, package, info);
		
			User::LeaveIfError(scheduler.EnableSchedule(ref.iHandle));
			}
		}
	CleanupStack::PopAndDestroy(7, activeScheduler);
	}