// Presents a Device Selection UI and returns the error code.
//
// Arguments:
//  - aResponse - the object to hold the details of the selected device.
//
// Returns an error code.
TInt SelectDeviceUI(TBTDeviceResponseParamsPckg& aResponse)
{
    TInt err;
    RNotifier notifier;
    
    err = notifier.Connect();
    if (err) return err;
    
    TBTDeviceSelectionParamsPckg selectionFilter;
    TRequestStatus status;
    notifier.StartNotifierAndGetResponse(
        status,
        KDeviceSelectionNotifierUid,
        selectionFilter,
        aResponse
    );
    
    User::WaitForRequest(status);
    
    err = status.Int();

    notifier.CancelNotifier(KDeviceSelectionNotifierUid);
    notifier.Close();
    return err;    
}
void DoInteractiveTests()
	{
	TInt r;

	test.Start(_L("Connect to notifier server"));
	RNotifier n;
	r = n.Connect();
	test(r==KErrNone);

	test.Next(_L("Launching simple notifier"));
	_LIT(KLine1,"Line1 - Select Button2");
	_LIT(KLine2,"Line2 - or press enter");
	_LIT(KButton1,"Button1");
	_LIT(KButton2,"Button2");
	TInt button=-1;
	TRequestStatus stat;
	n.Notify(KLine1,KLine2,KButton1,KButton2,button,stat);
	User::WaitForRequest(stat);
	test(button==1);

	test.Next(_L("Close connection to notifier server"));
	n.Close();

	test.End();
	}
bool ShowDialogL( const QString& server, const QByteArray& certificate, int reason, bool cancel )
    {
    RNotifier notifier;
    User::LeaveIfError( notifier.Connect() );
    CleanupClosePushL( notifier );

    HBufC8* buffer = GetInputBufferL( server, certificate, reason );
    CleanupStack::PushL( buffer );

    TRequestStatus status;
    TPckgBuf<TServerAuthenticationFailureDialogResult> resultPckg;
    notifier.StartNotifierAndGetResponse( status, KUidSecurityDialogNotifier,
        *buffer, resultPckg );
    if( cancel )
        {
        const TInt KTenSecDelay = 10000000;
        User::After( KTenSecDelay );
        notifier.CancelNotifier( KUidSecurityDialogNotifier );
        }
    User::WaitForRequest( status );
    User::LeaveIfError( status.Int() );

    CleanupStack::PopAndDestroy( buffer );
    CleanupStack::PopAndDestroy( &notifier );
    return( resultPckg() == EContinue );
    }
void CTcBtManager::TurnOnBtL()
	{
#ifdef __SERIES60_
   	LOG( _L("CTcBtManager::TurnOnBtL() start") );

	// Connect to notitifier service
	RNotifier notifier;
	User::LeaveIfError( notifier.Connect() );
	CleanupClosePushL( notifier );

	// Request notification about power, don't care about the results 
	// This results in a UI popup being displayed to the user shortly
	TRequestStatus status;
	TPckgBuf< TBool > pckg;
	TPckgBuf< TBool > resultPckg;
	notifier.StartNotifierAndGetResponse( status,
										  KPowerModeSettingNotifierUid,
										  pckg,
										  resultPckg );
	User::WaitForRequest( status );
	// Disable error checking. this would make auto-reconnect impossible
	// The power notifier reports an error if the time between the last
	// connection attempt and this connection is too small (even if it
	// doesn't hurt..)
	//User::LeaveIfError( status.Int() );

	notifier.CancelNotifier( KPowerModeSettingNotifierUid );

	CleanupStack::PopAndDestroy(); // notifier
   	LOG( _L("CTcBtManager::TurnOnBtL() end") );
#endif
	}
// -----------------------------------------------------------------------------
// CTestDomExtNotifiers::TestCANSASHandleMessageL
// -----------------------------------------------------------------------------
//
TInt CTestDomExtNotifiers::TestCANSASHandleMessageL( CStifItemParser& /*aItem*/ )
    {
    // Print to UI
    _LIT( KTestDomExtNotifiers, "TestDomExtNotifiers" );
    _LIT( KTestCANSASHandleMessageL, "TestCANSASHandleMessageL" );
    TestModuleIf().Printf( 0, KTestDomExtNotifiers, KTestCANSASHandleMessageL );
    // Print to log file
    iLog->Log( KTestCANSASHandleMessageL );
    
    TBuf8<KGeneralBufferLength> buffer;
    TBuf8<KGeneralBufferLength> responseBuffer;
    
    RNotifier notify;
    User::LeaveIfError( notify.Connect() );
    
    //Call StartL() function.
    notify.StartNotifier( KAknGlobalNoteUid,
        buffer, responseBuffer);
    
    notify.UpdateNotifier( KAknGlobalNoteUid,
        buffer, responseBuffer );
    
    notify.CancelNotifier( KAknGlobalNoteUid );
    notify.Close();
    
    return KErrNone;
    }
void TestRemovedMethods()
//
// Test deprecated but exported methods
//
	{
	test.Start(_L("Test removed methods of RNotifier class"));
	
	// connect to server
	RNotifier n;
	TInt r = n.Connect();
	test(r==KErrNone);

	test.Next(_L("StartNotifierAndGetResponse (5-params with dllUid)"));
	TBuf8<128> response;
	response.SetMax();
	response.FillZ();
	response.Zero();
	TRequestStatus stat;
	n.StartNotifierAndGetResponse(stat,KUidTestTextNotifier1,KUidTestTextNotifier2,*&KStartData,response);
	User::WaitForRequest(stat);
	test(stat==KErrNotSupported);

	test.Next(_L("StartNotifier (4-params with dllUid)"));
	test(n.StartNotifier(KUidTestTextNotifier2,KUidTestTextNotifier1,*&KStartData,response)==KErrNotSupported);
	
	test.Next(_L("Test removed method LoadNotifiers()"));
	test(n.LoadNotifiers(KUidTestTextNotifier1)==KErrNotSupported);
	
	test.Next(_L("Test removed method UnloadNotifiers()"));
	test(n.UnloadNotifiers(KUidTestTextNotifier1)==KErrNotSupported);

	test.Next(_L("Close connection to notifier server"));
	n.Close();
	test.End();
	}
// -----------------------------------------------------------------------------
// CTestDomExtNotifiers::TestCANSASServiceL
// -----------------------------------------------------------------------------
//
TInt CTestDomExtNotifiers::TestCANSASServiceL( CStifItemParser& /*aItem*/ )
    {
    // Print to UI
    _LIT( KTestDomExtNotifiers, "TestDomExtNotifiers" );
    _LIT( KTestCANSASServiceL, "TestCANSASServiceL" );
    TestModuleIf().Printf( 0, KTestDomExtNotifiers, KTestCANSASServiceL );
    // Print to log file
    iLog->Log( KTestCANSASServiceL );
    
    _LIT( KTextLine1, "RNotify(first line)" );
    _LIT( KTextLine2, "second line" );
    _LIT( KButton1, "Button1" );
    _LIT( KButton2, "Button2" );
    TInt response( -1 );
    
    TRequestStatus status;
    RNotifier notifier;
    User::LeaveIfError( notifier.Connect() );
    //This function can call ServiceL() function
    notifier.Notify( KTextLine1, KTextLine2, KButton1, KButton2, response,status );
    User::WaitForRequest( status );
    
    notifier.Close();
    return KErrNone;
    }
void DoMemoryLeakTests(TUid aUid,TBool aCheckMNotifierManager)
	{
	TInt r;
	TRequestStatus stat;

	test.Start(_L("Connect to notifier server"));
	RNotifier n;
	r = n.Connect();
	test(r==KErrNone);

	test.Next(_L("Get Notifier Server Heap Info"));
	static TBuf8<128> heapInfo1;
	heapInfo1.Zero();
	n.StartNotifierAndGetResponse(stat,aUid,KHeapData,heapInfo1);
	User::WaitForRequest(stat);
	n.CancelNotifier(aUid);
	TInt heapCellCount=stat.Int();
	test(heapCellCount>0);

	test.Next(_L("Repeated StartNotifierAndGetResponse"));
	for(TInt i=0; i<1000; i++)
		{
		TBuf8<128> response;
		response.SetMax();
		response.FillZ();
		response.Zero();
		n.StartNotifierAndGetResponse(stat,aUid,aCheckMNotifierManager?*&KMNotifierManager:*&KStartData,response);
		User::WaitForRequest(stat);
		n.CancelNotifier(aUid);
		test(stat==KErrNone);
		test(response==KResponseData);
		}

	test.Next(_L("Check Notifier Server Heap Info"));
	static TBuf8<128> heapInfo2;
	heapInfo2.Zero();
	n.StartNotifierAndGetResponse(stat,aUid,KHeapData,heapInfo2);
	User::WaitForRequest(stat);
	n.CancelNotifier(aUid);
	test(stat==heapCellCount);
	
	TInt size1, size2;
	TLex8 lex(heapInfo1);
	r = lex.Val(size1);
	test(r==KErrNone);
	lex.Assign(heapInfo2);
	r = lex.Val(size2);
	test(r==KErrNone);
	//allocated size after should not be greater than before BUT may be less with new allocator
	test(size2 <= size1); 

	test.Next(_L("Close connection to notifier server"));
	n.Close();

	test.End();
	}
void DoCleanumpTests(TUid aUid,TBool aCheckMNotifierManager)
	{
	TInt r;

	test.Start(_L("Connect to notifier server"));
	RNotifier n;
	r = n.Connect();
	test(r==KErrNone);

	test.Next(_L("StartNotifierAndGetResponse"));
	TBuf8<128> response;
	response.SetMax();
	response.FillZ();
	response.Zero();
	TRequestStatus stat;
	n.StartNotifierAndGetResponse(stat,aUid,aCheckMNotifierManager?*&KMNotifierManager:*&KStartData,response);
	User::WaitForRequest(stat);
	test(stat==KErrNone);
	test(response==KResponseData);

	test.Next(_L("Close connection to notifier server"));
	n.Close();

	test.Next(_L("Connect to notifier server"));
	r = n.Connect();
	test(r==KErrNone);

	test.Next(_L("StartNotifierAndGetResponse (to check previous notifier was cancelled)"));
	response.SetMax();
	response.FillZ();
	response.Zero();
	n.StartNotifierAndGetResponse(stat,aUid,aCheckMNotifierManager?*&KMNotifierManagerWithCancelCheck:*&KStartWithCancelCheckData,response);
	User::WaitForRequest(stat);
	test(stat==KTestNotifierWasPreviouselyCanceled);
	test(response==KResponseData);

	test.Next(_L("Close connection to notifier server"));
	n.Close();

	test.End();
	}
void TestNotify()
//
// Test Notify by launching a simple notifier. Gets closed
// using timer and simulated keypress.
//
	{
	TInt r;
	test.Start(_L("Connect to notifier server"));
	RNotifier n;
	r = n.Connect();
	test(r==KErrNone);
	TInt button=0;
	TRequestStatus status;
	TRequestStatus timerStatus;
	RTimer timer;
	timer.CreateLocal();

	test.Next(_L("Launching simple notifier"));
	_LIT(KLine1,"Line1 - Select Button2");
	_LIT(KLine2,"Line2 - or press enter");
	_LIT(KButton1,"Button1");
	_LIT(KButton2,"Button2");

	n.Notify(KLine1,KLine2,KButton1,KButton2,button,status);
	timer.After(timerStatus,KTimeOut); // launch timer for getting control back after timeout
	User::WaitForRequest(status, timerStatus);
	if (status==KRequestPending)
		{
		test.Printf(_L("Timeout in waiting for keypress, continuing\n"));

		// make the notifier to disappear
		TRawEvent eventDown;
		eventDown.Set(TRawEvent::EKeyDown,EStdKeyEnter);
		TRawEvent eventUp;
		eventUp.Set(TRawEvent::EKeyUp,EStdKeyEnter);
		UserSvr::AddEvent(eventDown);
		UserSvr::AddEvent(eventUp);
		User::WaitForRequest(status); // wait again
		}
	else
		{
		timer.Cancel();
		}
	
	timer.Close();

	test(status.Int()==KErrNone);

	test.Next(_L("Close connection to notifier server"));
	n.Close();

	test.End();
	}
TBool CSenBaseIdentityManager::AllowSavePasswordL()
    {
    TBool retVal = EFalse;

    RNotifier notifier;
    User::LeaveIfError(notifier.Connect());
    CleanupClosePushL(notifier);

    TPckgBuf<TAskSaveDlgRequest>* request = new(ELeave)TPckgBuf<TAskSaveDlgRequest>();
    CleanupStack::PushL(request);

    TPckgBuf<TAskSaveDlgResponse>* response = new(ELeave)TPckgBuf<TAskSaveDlgResponse>();
    CleanupStack::PushL(response);

    TRequestStatus reqStatus;
    notifier.StartNotifierAndGetResponse(reqStatus, KSenNotifierPluginUID, *request, *response);

    User::WaitForRequest(reqStatus);
    notifier.Close();

    if(reqStatus.Int() == KErrNone)
        {
        if((*response)().OkButtonPressed())
            {
            TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("User pressed OK Button to allow password saving")));
            retVal = ETrue;
            }
#ifdef _SENDEBUG
        else
            {
            TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("User pressed Cancel Button to deny password saving")));
            }
#endif
        }
#ifdef _SENDEBUG
    else if(reqStatus.Int() == KErrNotFound)
        {
        TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("Notifier plug-in for 'Save WS data?' -dialog was not found")));
        }
    else
        {
        TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase  , KMinLogLevel, _L8("'Save WS data?' -dialog returned an error: %d"), 
                                                        reqStatus.Int()));
        }
#endif

    CleanupStack::PopAndDestroy(2); // request, response;
    //CleanupStack::PopAndDestroy(); // close the notifier
    CleanupStack::Pop(); // notifier
    return retVal;
    }
Beispiel #12
0
TInt CProfilerPowerListener::DisplayNotifierL(const TDesC& aLine1, const TDesC& aLine2, const TDesC& aButton1, const TDesC& aButton2)
    {
    RNotifier notifier;
    TRequestStatus stat;

    TInt buttonValue(0);

    User::LeaveIfError(notifier.Connect());

    notifier.Notify(aLine1, aLine2, aButton1, aButton2, buttonValue, stat);
    User::WaitForRequest(stat);

    notifier.Close();
    return buttonValue;
    }
Beispiel #13
0
// ----------------------------------------------------------------------------
//Uses the Notifier API to ask the user to turn on Bluetooth if it's not on already.
// ----------------------------------------------------------------------------
void CBluetoothEngine::TurnBtOnL() {
	//the constant is from btnotifierapi.h which is not in all SDKs
	//so it's hard coded here
	const TUid KPowerModeSettingNotifierUid = { 0x100059E2 };
	//const TUid KBTPowerStateNotifierUid = {0x101F808E}; //S80 and 7710

	RNotifier notifier;
	User::LeaveIfError(notifier.Connect());
	TPckgBuf<TBool> dummy(ETrue);
	TPckgBuf<TBool> reply(EFalse);
	TRequestStatus stat;
	notifier.StartNotifierAndGetResponse(stat, KPowerModeSettingNotifierUid,
			dummy, reply);
	User::WaitForRequest(stat);
	notifier.CancelNotifier(KPowerModeSettingNotifierUid);
	notifier.Close();
}
TInt CIkev1Dialog::LauchSyncDialog(const TDesC8& aInput, TDes8& aOutput)
{
    RNotifier notifier;
    TInt err = notifier.Connect();
    if(err != KErrNone)
        {
        return err;
        }
    
    TRequestStatus status;
    notifier.StartNotifierAndGetResponse(status, KUidVpnDialogNotifier, aInput, aOutput);
    User::WaitForRequest( status );
    
    notifier.CancelNotifier(KUidVpnDialogNotifier);
    notifier.Close();
    
    return status.Int();
}
void TestNotifyCancel()
//
// Simple test to just call NotifyCancel. Just sends a message
// which goes to window server. Window server ignores the cancel event
// and because of this, no notification to be canceled is started.
//
	{
	TInt r;
	test.Start(_L("Connect to notifier server"));
	RNotifier n;
	r = n.Connect();
	test(r==KErrNone);

	test.Next(_L("Call NotifyCancel"));
	n.NotifyCancel();

	test.Next(_L("Close connection to notifier server"));
	n.Close();

	test.End();
	}
// NOTE! This code does not do as documentation states.
// Only second line text is shown and
// "Ok" button on the left side.
// return the value of button pressed (OK or CANCEL)
TInt CSenBaseIdentityManager::YesNoQueryL(const TDesC& aLine1,
                                          const TDesC& aLine2,
                                          const TDesC& aButton1,
                                          const TDesC& aButton2)
    {
    RNotifier notifier;
    User::LeaveIfError(notifier.Connect());
    CleanupClosePushL(notifier);

    TRequestStatus status;
    TInt buttonVal = -1;


    // NOTE! This code does not do as documentation states.
    // Only second line text is shown and
    // "Ok" button on the left side.

//    notifier.Notify(_L("Line 1 text"), _L("Line2 text"),
//        _L("B1Txt"), _L("B2Txt"), buttonVal, status);

    notifier.Notify(aLine1,
                    aLine2,
                    aButton1,
                    aButton2,
                    buttonVal,
                    status);


    User::WaitForRequest(status);
    CleanupStack::PopAndDestroy(); // Close notifier

#ifdef _SENDEBUG
    TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase  , KMinLogLevel, _L8("User pressed button (%d)"), buttonVal));
#endif

    return buttonVal;
    }
void CBTDiscoverer::SelectDevice()
{
	CALLSTACKITEM_N(_CL("CBTDiscoverer"), _CL("SelectDevice"));

#ifdef __WINS__

	TBuf8<10> addr=_L8("12345");
	if (iDevCount==0) {
		unsigned char a[]={ 0x00, 0x02, 0xee, 0x51, 0xc4, 0x37};
		TPtrC8 ap(&a[0], 6);
		addr=ap;
	} else {
		addr.AppendNum(iDevCount);
	}

	TBuf<20> name=_L("test name ");

	name.AppendNum(iDevCount);
	AddToArrays(addr, name);
	++iDevCount;
	return;
#endif

	TInt ret;
	if ( (ret=iNotifier.Connect())!= KErrNone ) return;

	not_is_open=true;

	selectionFilter.SetUUID(targetServiceClass);
	result.Zero();
	pckg.Zero();
	iNotifier.StartNotifierAndGetResponse(iStatus, KDeviceSelectionNotifierUid, pckg, result);

	SetActive();	
	current_state=SELECTING;
}
void DoTests(TUid aUid,TBool aCheckMNotifierManager)
	{	
	TInt r;
	
	test.Start(_L("Connect to notifier server"));
	RNotifier n;
	r = n.Connect();
	test(r==KErrNone);

	test.Next(_L("StartNotifier (without response)"));
	r = n.StartNotifier(aUid,aCheckMNotifierManager?*&KMNotifierManager:*&KStartData);
	RDebug::Printf("r=%d", r);
	test(r==KErrNone);

	test.Next(_L("CancelNotifier"));
	r = n.CancelNotifier(aUid);
	test(r==KErrNone);

	test.Next(_L("StartNotifier"));
	TBuf8<128> response;
	response.SetMax();
	response.FillZ();
	response.Zero();
	r = n.StartNotifier(aUid,aCheckMNotifierManager?*&KMNotifierManager:*&KStartData,response);
	test(r==KErrNone);
	test(response==KResponseData);

	test.Next(_L("UpdateNotifier"));
	response.SetMax();
	response.FillZ();
	response.Zero();   // EKA1 text notifier dies if current length < length of response
	r = n.UpdateNotifier(aUid,aCheckMNotifierManager?*&KMNotifierManager:*&KUpdateData,response);
	test(r==KErrNone);
	test(response==KResponseData);

	test.Next(_L("UpdateNotifierAndGetResponse"));
	response.SetMax();
	response.FillZ();
	response.Zero();   // EKA1 text notifier dies if current length < length of response
	TRequestStatus updateStat;
	n.UpdateNotifierAndGetResponse(updateStat,aUid,aCheckMNotifierManager?*&KMNotifierManager:*&KUpdateData,response);
	User::WaitForRequest(updateStat);
	test(updateStat==KErrNone);
	test(response==KResponseData);
	
	test.Next(_L("CancelNotifier"));
	r = n.CancelNotifier(aUid);
	test(r==KErrNone);

	test.Next(_L("StartNotifierAndGetResponse (to check previous notifier was cancelled)"));
	response.SetMax();
	response.FillZ();
	response.Zero();
	TRequestStatus stat;
	n.StartNotifierAndGetResponse(stat,aUid,aCheckMNotifierManager?*&KMNotifierManagerWithCancelCheck:*&KStartWithCancelCheckData,response);
	User::WaitForRequest(stat);
	test(stat==KTestNotifierWasPreviouselyCanceled);
	test(response==KResponseData);

	test.Next(_L("CancelNotifier"));
	r = n.CancelNotifier(aUid);
	test(r==KErrNone);

	test.Next(_L("Close connection to notifier server"));
	n.Close();

	test.Next(_L("Memory leak tests"));
	DoMemoryLeakTests(aUid,aCheckMNotifierManager);

	test.Next(_L("Session cleanup test"));
	DoCleanumpTests(aUid,aCheckMNotifierManager);

	test.End();
	}
TInt CSenBaseIdentityManager::AuthenticationForL(
                            CSenIdentityProvider& aProvider, 
                            TPckgBuf<TSenAuthentication>& aResponse)
    {
    TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"CSenBaseIdentityManager::AuthenticationForL");

    TPtrC8 user = aProvider.AuthzID();
    if (user == KNullDesC8)
        {
        user.Set(aProvider.AdvisoryAuthnID());
        }


    if (!iShowPasswordDialog)
        {
        TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"Not allowed to show password dialog");
        HBufC8* pDecodedPassword = SenXmlUtils::DecodeHttpCharactersLC(aProvider.Password());
        TPtrC8 decodedPassword = pDecodedPassword->Des();

        aResponse().iUsername.Append((const TUint8*)user.Ptr(), user.Size());
        aResponse().iPassword.Append((const TUint8*)decodedPassword.Ptr(), 
                                        decodedPassword.Size());
        CleanupStack::PopAndDestroy(); // delete pDecodedPassword
        return KErrNone;
        }


    RNotifier notifier;
    User::LeaveIfError(notifier.Connect());
    CleanupClosePushL(notifier);

    TPckgBuf<TAuthenticationDlgRequest>* request = 
                            new(ELeave)TPckgBuf<TAuthenticationDlgRequest>();
    CleanupStack::PushL(request);

    // convert username to unicode
    HBufC* pUserAsUnicode = SenXmlUtils::ToUnicodeLC(user); // push
    TPtrC username = pUserAsUnicode->Des();

    // decode password
    HBufC8* pDecodedPassword = SenXmlUtils::DecodeHttpCharactersLC(aProvider.Password());
    TPtrC8 decodedPassword = pDecodedPassword->Des();
    // convert decoded password to unicode
    HBufC* pPasswordAsUnicode = 
                SenXmlUtils::ToUnicodeLC(decodedPassword); // push
    TPtrC password = pPasswordAsUnicode->Des();

    // set data to request
    (*request)().SetData(username, password);

    CleanupStack::PopAndDestroy(3); // delete pPasswordAsUnicode, pDecodedPassword, pUserAsUnicode


    TPckgBuf<TAuthenticationDlgResponse>* response = 
                        new(ELeave)TPckgBuf<TAuthenticationDlgResponse>();
    CleanupStack::PushL(response);

    TRequestStatus reqStatus;
    notifier.StartNotifierAndGetResponse(reqStatus, 
                            KSenNotifierPluginUID, *request, *response);

    TBool illegalUsername = EFalse;

    HBufC8* pUsernameUtf8 = NULL;
    HBufC8* pPasswordUtf8 = NULL;
    User::WaitForRequest(reqStatus);

    notifier.Close();

    if(reqStatus.Int() == KErrNone)
        {
        if((*response)().OkButtonPressed())
            {
            TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("User pressed OK Button in Password dialog")));
            pUsernameUtf8 = SenXmlUtils::ToUtf8LC((*response)().Username());
            pPasswordUtf8 = SenXmlUtils::ToUtf8LC((*response)().Password());
            TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase  , KMinLogLevel, _L8("Username: %S"), pUsernameUtf8));
            TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase  , KMinLogLevel, _L8("Password: %S"), pPasswordUtf8 ));
            HBufC8* pEncodedUsername = NULL;
            illegalUsername = 
                SenXmlUtils::EncodeHttpCharactersL(*pUsernameUtf8,
                                                    pEncodedUsername);
            if (illegalUsername) 
                {
                TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("Username included illegal characters.")));
                delete pEncodedUsername;
                pEncodedUsername = NULL;
                }
#ifdef _SENDEBUG
            else
                {
                TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"Username did NOT include illegal characters.");
                }
#endif
       		
       		//Check if iilegal chars are there then return
            if (!illegalUsername)
                {
                
                if(user != *pUsernameUtf8)
                {
                	
	                // User modified the username in the dialog prompt(!)
	                // We have to save it right away, because there is
	                // no in-memory/session based member variables in
	                // components calling identity manager (sec mechs and
	                // in ID-WSF AS client!
	                TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"Username changed. Saving new username.");

	                // Use Advisory only if AuthzID is not available
	                if (aProvider.AuthzID() == KNullDesC8 
	                    && aProvider.AdvisoryAuthnID() != KNullDesC8)
	                    {
	                    aProvider.SetUserInfoL(aProvider.AuthzID(),
	                                            *pUsernameUtf8, 
	                                            aProvider.Password());
	                    }
	                else 
	                    {
	                    // There was at least AuthzID available, and possibly
	                    // also advisory value. Any way, if 

	                    
	                    // We have to NULL advisory value (set it to KNullDesC8), 
	                    // because if both were available, then user was
	                    // prompted to allow modification of AuthzID AND 
	                    // if advisory was changed in service (is no longer
	                    // valid), there would NOT be any way for end-user
	                    // to change (remove) it(!)

	                    CSenElement& element = aProvider.AsElement();
	                    delete element.RemoveElement(KSenIdpAdvisoryAuthnIdLocalname);

	                    aProvider.SetUserInfoL(*pUsernameUtf8, 
	                                            KNullDesC8,
	                                            aProvider.Password());
	                    }
	                // serialize changed username into sensessions.xml database immediately
	                WriteDatabase();
                }
                
	            if (AllowSavePasswordL())
	                {
	                HBufC8* pEncodedPassword = SenXmlUtils::EncodeHttpCharactersLC(*pPasswordUtf8);
#ifdef _SENDEBUG
                if(pEncodedPassword)
                    {
                    TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase  , KMinLogLevel, _L8("Encoded password: %S"), pEncodedPassword));
                    }
#endif
					if(pEncodedPassword)
						{
							aProvider.SetUserInfoL(aProvider.AuthzID(),
	                                        aProvider.AdvisoryAuthnID(),
	                                        *pEncodedPassword);
						}
	                WriteDatabase();
	                CleanupStack::PopAndDestroy(1); // pEncodedPassword
	                }
                
                }

            aResponse().iUsername.Zero();
            aResponse().iPassword.Zero();
            if (!illegalUsername) 
            {
	            aResponse().iUsername.Copy(pUsernameUtf8->Des());
	            aResponse().iPassword.Copy(pPasswordUtf8->Des());
            }

            CleanupStack::PopAndDestroy(2); // pPasswordUtf8, pUsernameUtf8
            }
        else
            {
            TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("User pressed Cancel Button in Password dialog")));
            }
        }
    else if(reqStatus.Int() == KErrNotFound)
        {
        TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("Password dialog plugin notifier impl. was not found")));
        }
    else
        {
        TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase  , KMinLogLevel, _L8(" Notifier plugin for 'Password' dialog returned an error: %d"), 
                                                        reqStatus.Int()));
        }

    CleanupStack::PopAndDestroy(2); // request, response;
    CleanupStack::Pop(); // notifier

    if (illegalUsername) return KErrArgument;
    return reqStatus.Int();
    }