void CMtfTestActionGetPopAccountSettings::LoadSettingsL(CEmailAccounts& aAccounts, const TPopAccount& aAccount, CImPop3Settings& aPopSettings, CImIAPPreferences& aPopIapSettings, CImSmtpSettings& aSmtpSettings, CImIAPPreferences& aSmtpIapSettings)
	{
	aAccounts.LoadPopSettingsL(aAccount, aPopSettings);
	aAccounts.LoadPopIapSettingsL(aAccount, aPopIapSettings);
	TSmtpAccount smtpAccount;
	aAccounts.GetSmtpAccountL(aAccount.iSmtpService, smtpAccount);
	aAccounts.LoadSmtpSettingsL(smtpAccount, aSmtpSettings);
	aAccounts.LoadSmtpIapSettingsL(smtpAccount, aSmtpIapSettings);
	}
/**
LoadAccountSettingsL()
This function loads the IMAP and SMTP settings object from the IMAP account given

@param aEmailAccount
An object of type CEmailAccounts

@param aAccount
An object of type TPopAccount

@param aPopSettings
An object of type CImPop3Settings

@param aPopIapSettings
An object of type CImIAPPreferences

@param aSmtpSettings
An object of type CImSmtpSettings

@param aSmtpIapSettings
An object of type CImIAPPreferences

@return : void
*/	
void CT_MsgComparePopSettings::LoadAccountSettingsL(CEmailAccounts& aEmailAccount, const TPopAccount& aAccount, CImPop3Settings& aPopSettings, 
		CImIAPPreferences& aPopIapSettings,CImSmtpSettings& aSmtpSettings, CImIAPPreferences& aSmtpIapSettings)
	{
	aEmailAccount.LoadPopSettingsL(aAccount, aPopSettings);
	aEmailAccount.LoadPopIapSettingsL(aAccount, aPopIapSettings);
	
	TSmtpAccount smtpAccount;
	aEmailAccount.GetSmtpAccountL(aAccount.iSmtpService, smtpAccount);
	aEmailAccount.LoadSmtpSettingsL(smtpAccount, aSmtpSettings);
	aEmailAccount.LoadSmtpIapSettingsL(smtpAccount, aSmtpIapSettings);
	}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
TInt CIpsPlgPop3ConnectOp::GetPopulateLimitFromSettingsL()
    {
    FUNC_LOG;
    TInt limit( KDefaultPopulateLimit );
        
    CImPop3Settings* settings = new(ELeave) CImPop3Settings();
    CleanupStack::PushL( settings );
    TPopAccount popAccountId;
    CEmailAccounts* accounts = CEmailAccounts::NewLC();
    accounts->GetPopAccountL( iService , popAccountId );
    accounts->LoadPopSettingsL( popAccountId, *settings );
    limit = settings->PopulationLimit();
    if ( limit > 0 )
        {
        // basically doing a _very_rough_ conversion from kilobyte value to number-of-rows
        limit = ( limit * KPopulateAlgorithmBytesInKilo ) / KPopulateAlgorithmRowLength;
        }
    CleanupStack::PopAndDestroy( 2, settings );
    return limit;
    }
Пример #4
0
//
// Get all email services
//
void CEmailNotificationParser::GetEmailServicesL()
	{

	CCnvCharacterSetConverter* charconv = CCnvCharacterSetConverter::NewL();
	CleanupStack::PushL(charconv);
	CArrayFix<CCnvCharacterSetConverter::SCharacterSet> *charsetsAvailable = charconv->CreateArrayOfCharacterSetsAvailableL(iFs);
	CleanupStack::PushL(charsetsAvailable);

	charconv->PrepareToConvertToOrFromL(KUidCharsetISO88591,*charsetsAvailable,iFs);
	
	const TMsvId current = iEntry.Entry().Id();
	iEntry.SetEntryL(KMsvRootIndexEntryId);
	// Get all POP3 and Imap services
	CMsvEntrySelection* rootChildren = iEntry.ChildrenL();
	CleanupStack::PushL(rootChildren);

	TMsvEntry entry;

	CEmailAccounts* accounts = CEmailAccounts::NewLC();

	const TInt count = rootChildren->Count(); 
	TInt j =0;
	while(j < count && iFoundServer ==EFalse)
		{
		// set context to service entry
		iEntry.SetEntryL((*rootChildren)[j]);
		entry = iEntry.Entry(); 
		if (entry.iType == KUidMsvServiceEntry && (entry.iMtm == KUidMsgTypePOP3 || entry.iMtm == KUidMsgTypeIMAP4))
			{
			TBuf8<8> port;

			if(entry.iMtm == KUidMsgTypePOP3)
				{
				// calculate hash value
				CImPop3Settings* settings = new(ELeave)CImPop3Settings;
				CleanupStack::PushL(settings);
 
 				TPopAccount id;
				accounts->GetPopAccountL(entry.Id(), id);
				accounts->LoadPopSettingsL(id, *settings);

				port.Num((TUint)KPOP3DefaultPortNumber);
				iFoundServer = CalcHashValueL( *charconv, settings->LoginName(), settings->ServerAddress(), port);
				}
			else // entry.iMtm == KUidMsgTypeIMAP4
				{
				CImImap4Settings* settings = new(ELeave)CImImap4Settings;
				CleanupStack::PushL(settings);
				
 				TImapAccount id;
				accounts->GetImapAccountL(entry.Id(), id);
				accounts->LoadImapSettingsL(id, *settings);

				port.Num((TUint)KIMAPDefaultPortNumber);
				iFoundServer = CalcHashValueL( *charconv, settings->LoginName(), settings->ServerAddress(), port);
				}
			CleanupStack::PopAndDestroy(); // settings
			}
		j++;
		}

	if(	iFoundServer )
		iServiceMsvId = entry.Id();

	CleanupStack::PopAndDestroy(4, charconv); // charconv, charsetsAvailable, rootChildren, accounts
	
	iEntry.SetEntryL(current);
	}
Пример #5
0
/**
  Function : doTestStepL
  Description : Reads the Pop account name and config file name from the .ini file
				 and it then modifies the account with the settings read from the config file.
  @return : TVerdict - Test step result
  @leave  : KMsvNullIndexEntryId	Invalid POP account name specified	
*/
TVerdict CT_MsgModifyPopSettings2::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Step: ModifyPopSettings2"));
	// Read the POP account name from the ini file
	TPtrC popAccountName;
	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
		{
		ERR_PRINTF1(_L("POP account name is not specified"));
		SetTestStepResult(EFail);
		}
	else
		{
		// Read the POP Config file name from the ini file
		TPtrC configFileName;
		if(!GetStringFromConfig(ConfigSection(), KPopConfigFileName, configFileName))
			{
			ERR_PRINTF1(_L("Configuration file path 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);
			
			if(popServiceId == KMsvNullIndexEntryId)
				{
				ERR_PRINTF1(_L("Invalid POP account name specified"));
				SetTestStepResult(EFail);
				}
			// Creates the settings object
			else
				{
				CEmailAccounts* emailAccounts = CEmailAccounts::NewLC();

				CImPop3Settings* popSettings = new(ELeave) CImPop3Settings();
				CleanupStack::PushL(popSettings);
				
				CImIAPPreferences* popIapPrefs = CImIAPPreferences::NewLC();

				// Loads the settings for the account with the current settings
				TPopAccount popAccount;
				emailAccounts->GetPopAccountL(popServiceId, popAccount);
				emailAccounts->LoadPopSettingsL(popAccount, *popSettings);
				emailAccounts->LoadPopIapSettingsL(popAccount, *popIapPrefs);

				// Reads the settings from the config file
				TRAPD(err, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopSettingsFromConfigurationFileL(configFileName, *popSettings, *popIapPrefs));
				if(err)
					{	
					ERR_PRINTF2(_L("Failure while setting the POP setting parameters, failed with error %d"), err);
					SetTestStepError(err);															  
					}
				else
					{
					// Saves the new settings
					emailAccounts->SavePopSettingsL(popAccount, *popSettings);
					emailAccounts->SavePopIapSettingsL(popAccount, *popIapPrefs);
					}
				CleanupStack::PopAndDestroy(3, emailAccounts);// popIapPrefs,popSettings,emailAccounts
				}
			}
		}
	return TestStepResult();
	}
Пример #6
0
/**
doTestStepL()
Populate the default POP and SMTP settings, Load the settings of the account 
created with the default settings, and compares the settings objects.
The test passes if all the settings objects match else it fails.

@return
Returns the test step result
*/
TVerdict CT_MsgVerifyPopSettings::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Step: VerifyPopSettings"));
	// Read the Pop account name from the ini file
	TPtrC popAccountName;
	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
		{
		ERR_PRINTF1(_L("PopAccount 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);
		
		if(popServiceId == KMsvNullIndexEntryId)
			{
			ERR_PRINTF1(_L("Invalid POP account name specified"));
			SetTestStepResult(EFail);
			}
		else
			{
			CEmailAccounts* emailAccounts = CEmailAccounts::NewLC();
	
			CImPop3Settings* popSettings1 = new(ELeave) CImPop3Settings();
			CleanupStack::PushL(popSettings1);
			
			CImIAPPreferences* popIapPrefs1 = CImIAPPreferences::NewLC();
			
			CImSmtpSettings* smtpSettings1 = new(ELeave) CImSmtpSettings();
			CleanupStack::PushL(smtpSettings1);

			CImIAPPreferences* smtpIapPrefs1 = CImIAPPreferences::NewLC();

			emailAccounts->PopulateDefaultPopSettingsL(*popSettings1, *popIapPrefs1);
			emailAccounts->PopulateDefaultSmtpSettingsL(*smtpSettings1, *smtpIapPrefs1);

			
	
			CImPop3Settings* popSettings2 = new(ELeave) CImPop3Settings();
			CleanupStack::PushL(popSettings2);
			
			CImIAPPreferences* popIapPrefs2 = CImIAPPreferences::NewLC();
			
			CImSmtpSettings* smtpSettings2 = new(ELeave) CImSmtpSettings();
			CleanupStack::PushL(smtpSettings2);

			CImIAPPreferences* smtpIapPrefs2 = CImIAPPreferences::NewLC();

			TPopAccount popAccount;
			emailAccounts->GetPopAccountL(popServiceId, popAccount);
			emailAccounts->LoadPopSettingsL(popAccount, *popSettings2);
			emailAccounts->LoadPopIapSettingsL(popAccount, *popIapPrefs2);
			
			TSmtpAccount smtpAccount;
			emailAccounts->GetSmtpAccountL(popAccount.iSmtpService, smtpAccount);
			emailAccounts->LoadSmtpSettingsL(smtpAccount, *smtpSettings2);
			emailAccounts->LoadSmtpIapSettingsL(smtpAccount, *smtpIapPrefs2);

			TVerdict result = EPass;
			if (!(*popSettings1 == *popSettings2))   
				{
				// failed
				ERR_PRINTF1(_L("Pop3 Settings objects do not match !"));
				result = EFail;
				}
			else if (!(*smtpSettings1 == *smtpSettings2))
				{
				// failed
				ERR_PRINTF1(_L("SMTP Settings objects do not match !"));
				result = EFail;
				}
			else if (!CT_MsgUtilsReadEmailSettingsFromConfigFile::CompareIapPrefs(*popIapPrefs1, *popIapPrefs2))
				{
				// failed
				ERR_PRINTF1(_L("Pop3 IAP Preference objects do not match !"));
				result = EFail;
				}
			else if (!CT_MsgUtilsReadEmailSettingsFromConfigFile::CompareIapPrefs(*smtpIapPrefs1, *smtpIapPrefs2))
				{
				// failed
				ERR_PRINTF1(_L("SMTP IAP Preference objects do not match !"));
				result = EFail;
				}
			SetTestStepResult(result);
			CleanupStack::PopAndDestroy(9,emailAccounts);
			}
		}
	return TestStepResult();
	}