// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
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();
    }
Пример #2
0
// ---------------------------------------------------------
// TInt CLanSettings::Connect()
// returns KErrNone on success
// ---------------------------------------------------------
//
EXPORT_C TInt CLanSettings::Connect()
    {
    TraceDump(WARNING_LEVEL,_L("CLanSettings::Connect()"));
    
    TRAPD(err,DoConnectL());
    return err;
    }
void CJavaDebugAgentConnector::RunL()
{
    TInt err = iStatus.Int();
    switch (iState)
    {
    case EStarting:
        if (err == KErrNone)
        {
            DoResolveL();
        }
        else
        {
            iState = EFailed;
            LOG1("Connection error %d",err);
            iDriver->ConnectionFailed();
        }
        break;

    case EResolving:
        if (err == KErrNone)
        {
            iAddress = iNameEntry().iAddr;
            DoConnectL();
        }
        else
        {
            iState = EFailed;
            LOG1("Host name resolution error %d",err);
            iDriver->ConnectionFailed();
        }
        break;

    case EConnecting:
        if (err == KErrNone)
        {
            iState = EConnected;

            // The ProcessRequest() call transfers ownership of the
            // CTcpServerHandler object to the driver in a rather
            // obscure way... Clear the  pointer so that we don't
            // deallocate it twice.
            CTcpServerHandler* handler = iHandler;
            iHandler = NULL;
            handler->ProcessRequest();
        }
        else
        {
            iState = EFailed;
            LOG1("Connection failed, error %d",err);
            iDriver->ConnectionFailed();
        }
        break;
    }
}
Пример #4
0
/**
Handles the connect request from the client.  We trap Leaves, to ensure
that existing sessions aren't affected by failure to create a new one.

@param aMessage The Connect message sent by the client requesting the
                connection. aMessage.Ptr0() is the required Version.
*/
EXPORT_C void CServer2::DoConnect(const RMessage2& aMessage)
	{
	ASSERT(aMessage.Function() == RMessage2::EConnect);
	ASSERT(aMessage.Session() == NULL);
	ASSERT(!aMessage.IsNull());

	CSession2* newSession = NULL;
	TRAPD(err, DoConnectL(aMessage, newSession));
	if (err != KErrNone)
		{
		// Connect failed
		delete newSession;
		aMessage.Complete(err);
		}
	else
		{
		ASSERT(newSession != NULL);
		CServer2* sessionServer = const_cast<CServer2*>(newSession->Server());
		ASSERT(sessionServer != NULL);

		// The return value of Server() will be 'this', unless it was
		// changed by a call to SetServer().
		if (sessionServer == this)
			{
			// no SetServer() call, so just complete the Connect message
			aMessage.Complete(err);
			}
		else
			{
			// Transfer the new Csession to the specified slave Cserver
			newSession->iLink.Deque();
			sessionServer->iSessionQ.AddLast(*newSession);

			// Ask the kernel to transfer the DSession to the slave DServer.
			// Note: this Exec call also completes the Connect message.
			TInt msgHandle = aMessage.iHandle;
			const_cast<TInt&>(aMessage.iHandle) = 0;
			ASSERT(msgHandle);
			Exec::TransferSession(msgHandle, sessionServer->Server().Handle());
			}
		}

	ASSERT(aMessage.IsNull());
	}
Пример #5
0
void RPeninputServerImpl::ConstructL(const TUid& aUid)
    {
    CCoeStatic * obj = CCoeEnv::Static()->FindStatic(aUid);
    CPenInputSingletonClient* client;
    //__ASSERT_ALWAYS(obj == NULL, User::Leave(KErrAlreadyExists));
    if(obj)
        {
        client = static_cast<CPenInputSingletonClient*>(obj);
        client->ReplaceServer(this);                                
        }
    else
        client = new (ELeave)CPenInputSingletonClient(aUid,this);       
    //Note: The client is destroyed by the control environment automatically    
    //User::LeaveIfError(DoConnectL());
    TRAPD(err, DoConnectL());
    if(KErrNone != err)
        {
        client->SetInvalid();
        User::LeaveIfError(err);
        }
    }
void CJavaDebugAgentConnector::DoResolveL()
{
    TDesC* host = iDriver->GetPCHost();
    TInt err = iAddress.Input(*host);
    if (err != KErrNone)
    {
        User::LeaveIfError(iResolver.Open(SocketServ(), KAfInet, 
            KProtocolInetTcp));

        iState = EResolving;
        iStatus = KRequestPending;
        SetActive();

        LOG1("Resolving %S",host);
        iResolver.GetByName(*host, iNameEntry, iStatus);
    }
    else
    {
        DoConnectL();
    }
}
// ----------------------------------------------------------------------------
// CIpsPlgPop3ConnectOp::DoRunL()
// ----------------------------------------------------------------------------
//
void CIpsPlgPop3ConnectOp::DoRunL()
    {
    FUNC_LOG;
    TInt err( KErrNone );

    // <qmail> remove EQueryingDetails state
    if ( iState == EStartConnect )
        {
        if ( iSubOperation )
            {
            // operation exist and it means 
            // disconnect operation was ongoing.
            delete iSubOperation;
            iSubOperation = NULL;
            }
        
// <qmail> ValidateL removed
        // Begin Connect.
        DoConnectL();
        iState = EConnected;
        }
    else if ( iState == EConnected )
        {
        // Connect completed
        // <qmail> Login details checking removed
        err = GetOperationErrorCodeL( );
        User::LeaveIfError( err );

        if ( iForcePopulate && Connected() )
            {
            iState = EPopulate;
            DoPopulateL();
            }
        // <qmail>
        else if( iFetchWillFollow && Connected() )
            {
            // Leave connection open to make fetch
            // operation possible
            iState = EIdle;
            CompleteObserver( KErrNone );
            }
        // </qmail>
        else
            {
            // <qmail>
            // start disconnecting
            iState = EDisconnecting;
            DoDisconnectL();
            // </qmail>
            }
        }
    else if ( iState == EPopulate )
        {
        err = GetOperationErrorCodeL( );
        if ( iEventHandler )
            {
            iEventHandler->SetNewPropertyEvent( iService, KIpsSosEmailSyncCompleted, err );
            }
        CIpsPlgSyncStateHandler::SaveSuccessfulSyncTimeL( iMsvSession, iService );

        // <qmail>
        // start disconnecting
        iState = EDisconnecting;
        DoDisconnectL();
        // </qmail>
        }
    // <qmail>
    else if ( iState == EDisconnecting )
        {
        // we're done here
        CompleteObserver( KErrNone );
        }
    // </qmail>
    // <qmail> removed state EErrInvalidDetails
    else
        {
        User::Panic( KIpsPlgPopConnectPanic ,KErrNotFound);
        }
    }