void TestFileLengthExceedMax()
	{
	test.Next(_L("Test accesing a long file with filename length >250 characters"));
	__UHEAP_MARK;

	// logging for failure
	gTCType = ESymbianFATSpecific;
	RBuf failedOnBuf;
	failedOnBuf.CreateL(gLogFailureData.iFuncName);
	gTCId = 0;
	RBuf tcUniquePath;
	tcUniquePath.CreateL(KNone());

	QuickFormat();
	CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\"));

	TInt r = TheFs.SessionPath(gSessionPath);
	testAndLog(r==KErrNone);
	
	TBuf<350> longName;

	_LIT(KTestDir1,	"\\TEST\\TESTLONGFILENAMELENGTH\\TESTMORETHAN260CHARACTERS\\") ;
	_LIT(KTestDir2,  "\x65B0\x6587\x4EF6\x4EF6(ABCDEFGH)\\(\x65B0\x6587\x4EF6\x4EF6)PQRST\\");
	_LIT(KTestDir3,  "MULTILEVEL-FOLDER1\\MULTILEVEL-FOLDER2\\MULTILEVEL-FOLDER3\\");
	_LIT(KTestDir4,  "\x65B0\x65B0\x65B0\x65B0(x6587)\\(\x6587\x6587\x6587\x6587)PQRST\\");
	_LIT(KTestDir5,  "\x4EF6\x4EF6\x4EF6\x4EF6(x4EF6)\\(\x6587\x6587\x6587\x6587)XYZ\\");	
	_LIT(KTestDir6,  "TESTINGINPROGRESS(TESTLENGTH)>256\\");	
	_LIT(KTestLongFileLength,  "\x4EF6\x4EF6\x4EF6\x4EF6(x4EF6).TXT");
	
	longName = gSessionPath;
	longName += KTestDir1;
	longName += KTestDir2;
	longName += KTestDir3;
	longName += KTestDir4;
	longName += KTestDir5;
	longName += KTestDir6;
	
	test.Printf(_L("longName length is  %d "), longName.Length());
	r=TheFs.MkDirAll(longName);
	
	longName += KTestLongFileLength;
	test.Printf(_L("longName count is  %d "), longName.Length());

	testAndLog(longName.Length()>256);
	
	r=TheFile.Create(TheFs,longName ,EFileWrite);
	testAndLog(r==KErrBadName);
	// TheFile.Close();
		
	r=TheFile.Open(TheFs,longName ,EFileWrite);
	testAndLog(r==KErrBadName);
	// TheFile.Close();
	
	TheFs.Delete(longName);	
	failedOnBuf.Close();
	tcUniquePath.Close();
	__UHEAP_MARKEND;		
	}
void TestLeadingE5Handling()
	{
	test.Next(_L("Test Leading \'E5\' byte handling"));
	__UHEAP_MARK;
	
	// logging for failure
	gTCType = ESymbianFATSpecific;
	RBuf failedOnBuf;
	failedOnBuf.CreateL(gLogFailureData.iFuncName);
	gTCId = 0;
	RBuf tcUniquePath;
	tcUniquePath.CreateL(KNone());

	QuickFormat();
	CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\"));

	// Enables codepage dll implementation of LocaleUtils functions for this test only
	TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);
	testAndLog(r==KErrNone);
	
	r = UserSvr::ChangeLocale(KTestLocale);
	testAndLog(r==KErrNone);

	r=TheFs.SessionPath(gSessionPath);
	testAndLog(r==KErrNone);

	_LIT(KTestFilePathAndName,		"\\F32-TST\\T_FATCHARSETCONV\\\x88F9.TXT");
	_LIT(KTestFileShortName, 		"\x88F9.TXT");
	
	MakeFile(KTestFilePathAndName);
	TFileName sn;
	r = TheFs.GetShortName(KTestFilePathAndName, sn);
	testAndLog(r==KErrNone);
	r = sn.Compare(KTestFileShortName);
	testAndLog(r==KErrNone);
	
	r=TheFs.Delete(KTestFilePathAndName);
	testAndLog(r==KErrNone);

	// Disables codepage dll implementation of LocaleUtils functions for other base tests
	r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
	testAndLog(r==KErrNone);
	failedOnBuf.Close();
	tcUniquePath.Close();
	__UHEAP_MARKEND;
	}
void TestVFATCase1()
	{
	test.Next(_L("Test Without VFAT entry, but DOS entry uses CP932 Japanese file's access"));
	__UHEAP_MARK;
	
	// logging for failure
	gTCType = ESymbianFATSpecific;
	RBuf failedOnBuf;
	failedOnBuf.CreateL(gLogFailureData.iFuncName);
	gTCId = 0;
	RBuf tcUniquePath;
	tcUniquePath.CreateL(KNone());

	QuickFormat();
	CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\"));

	GetBootInfo();

   	RFile file;
  	TFileName fn = _L("\\ABCD");
  	
  	TInt r=file.Create(TheFs,fn,EFileRead);
  	testAndLog(r==KErrNone);
  	file.Close();
  
  	//	Assume this file is the first entry in the root directory
  	r=TheDisk.Open(TheFs,CurrentDrive());
  	testAndLog(r==KErrNone);

    //-- read the 1st dir entry, it should be a DOS entry 
    const TInt posEntry1=gBootSector.RootDirStartSector() << KDefaultSectorLog2; //-- dir entry1 position
      
    TFatDirEntry fatEntry1;
 	TPtr8 ptrEntry1((TUint8*)&fatEntry1,sizeof(TFatDirEntry));
	testAndLog(TheDisk.Read(posEntry1, ptrEntry1)==KErrNone); 
	testAndLog(!fatEntry1.IsVFatEntry());

	// Manually modify the short name into unicode characters
	// 	Unicode: 	0x(798F 5C71 96C5 6CBB)
	//	Shift-JIS: 	0x(959F 8E52 89EB 8EA1)

	TBuf8<8> unicodeSN = _L8("ABCD1234");
	unicodeSN[0] = 0x95;
	unicodeSN[1] = 0x9F;
	unicodeSN[2] = 0x8E;
	unicodeSN[3] = 0x52;
	unicodeSN[4] = 0x89;
	unicodeSN[5] = 0xEB;
	unicodeSN[6] = 0x8E;
	unicodeSN[7] = 0xA1;

	fatEntry1.SetName(unicodeSN);
	testAndLog(TheDisk.Write(posEntry1, ptrEntry1)==KErrNone);
	TheDisk.Close();

  	// The Unicode file name of the file that is created
  	fn = _L("\\ABCD");
  	fn[1] = 0x798F;
  	fn[2] = 0x5C71;
  	fn[3] = 0x96C5;
  	fn[4] = 0x6CBB;
  	
  	// Access the file using its unicode file name without the DLL loaded.
      r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
  	test_KErrNone(r);
  	
  	TEntry entry;
  	TInt err = TheFs.Entry(fn, entry);
  	testAndLog(err==KErrNotFound);
  	
      // Access the file using its unicode file name with the DLL loaded.
      r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);  	
	test_KErrNone(r);
 	r = UserSvr::ChangeLocale(KTestLocale);  	
	test_KErrNone(r);
  
  	err = TheFs.Entry(fn, entry);
  	testAndLog(err==KErrNone);
  	
  	//file is no more required,delete it.
  	err = TheFs.Delete(fn);
  	testAndLog(err==KErrNone);
  	
      r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
  	test_KErrNone(r);
  	
 	r=TheFs.SessionPath(gSessionPath);
  	test_KErrNone(r);
	failedOnBuf.Close();
	tcUniquePath.Close();
	__UHEAP_MARKEND;
	}
void TestVFATCase2()
	{
	test.Next(_L("Test With VFAT entry, and DOS entry using CP932 Japanese file's access"));
	__UHEAP_MARK;
	
	// logging for failure
	gTCType = ESymbianFATSpecific;
	RBuf failedOnBuf;
	failedOnBuf.CreateL(gLogFailureData.iFuncName);
	gTCId = 0;
	RBuf tcUniquePath;
	tcUniquePath.CreateL(KNone());

	QuickFormat();
	CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\"));

	TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);
	test_KErrNone(r);
		
	r = UserSvr::ChangeLocale(KTestLocale);
	test_KErrNone(r);
	r=TheFs.SetSessionPath(gSessionPath);
	testAndLog(r==KErrNone);
	
	_LIT(KTestNormalFileName, 		"\x65B0\x6587\x4EF6.TXT");	
	_LIT(KTestNormalFileShortName, 	"\x65B0\x6587\x4EF6.TXT");
	
	test.Printf(_L("Create a file with the DLL installed, and get the shortname"));
	r=TheFile.Create(TheFs,KTestNormalFileName,EFileRead|EFileWrite);
	testAndLog(r==KErrNone);
	TFileName sn;
	r = TheFs.GetShortName(KTestNormalFileName, sn);
	testAndLog(r==KErrNone);
	r = sn.Compare(KTestNormalFileShortName);
	testAndLog(r==0);
	TheFile.Close();
	
	test.Printf(_L("Access the file with the DLL installed"));
	r=TheFile.Open(TheFs,KTestNormalFileName,EFileWrite);
	testAndLog(r==KErrNone);
	
	TBuf<50> name;	
	r=TheFile.FullName(name);
	testAndLog(r==KErrNone);
	TheFile.Close();
	
	r=TheFile.Open(TheFs,KTestNormalFileShortName,EFileWrite);
	testAndLog(r==KErrNone);
	TheFile.Close();
	
	r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
	testAndLog(r==KErrNone);
	
	test.Printf(_L("Access the file without the DLL installed"));
	
	r=TheFile.Open(TheFs,KTestNormalFileName,EFileWrite);
	testAndLog(r==KErrNone);

	r=TheFile.FullName(name);
	testAndLog(r==KErrNone);
	TheFile.Close();
	
	r=TheFile.Open(TheFs,KTestNormalFileShortName,EFileWrite);
	testAndLog(r==KErrNone);
	TheFile.Close();
	
	r=TheFs.Delete(KTestNormalFileName);
	failedOnBuf.Close();
	tcUniquePath.Close();
	__UHEAP_MARKEND;
	}
void TestIllegalCharsWithDll()
	{
	test.Next(_L("Test Illegal Character handling with DLL"));			
	__UHEAP_MARK;
	
	// logging for failure
	gTCType = ESymbianFATSpecific;
	RBuf failedOnBuf;
	failedOnBuf.CreateL(gLogFailureData.iFuncName);
	gTCId = 0;
	RBuf tcUniquePath;
	tcUniquePath.CreateL(KNone());

	QuickFormat();
	CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\"));
	
	TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);
	testAndLog(r==KErrNone);

	r = UserSvr::ChangeLocale(KTestLocale);
	testAndLog(r==KErrNone);

	_LIT(KTestNormalUnicodeFileName, 				"\x65B0\x6587\x4EF6.TXT");
	_LIT(KTestNormalUnicodeFileNameShortDefualt, 	"\x65B0\x6587\x4EF6.TXT");
	_LIT(KTestFileNameWithIllegalChars, 			"\x222F\x2F3A\x3C3E\x7C00.TXT");
	_LIT(KFileNameWithIllegalCharsShort, 			"___\x7C00.TXT");
	_LIT(KTestFileNameWithWildChars, 				"\x235B\x245C\x255D\x265E.TXT");
	_LIT(KTestFileNameWithWildCharsShort, 			"____.TXT");

	TFileName shn;

	MakeFile(KTestNormalUnicodeFileName);
	r = TheFs.GetShortName(KTestNormalUnicodeFileName, shn);
	testAndLog(r==KErrNone);
	r = shn.Compare(KTestNormalUnicodeFileNameShortDefualt);
	testAndLog(r==0);

	TFileName lgn;
	r = TheFs.GetLongName(KTestNormalUnicodeFileNameShortDefualt, lgn);
	testAndLog(r==KErrNone);
	r = lgn.Compare(KTestNormalUnicodeFileName);
	testAndLog(r==0);

	// Test illegal 8-bit ASCII chars in 16-bit Unicode chars.
	MakeFile(KTestFileNameWithIllegalChars);
	r = TheFs.GetShortName(KTestFileNameWithIllegalChars, shn);
	testAndLog(r==KErrNone);
	r = shn.Compare(KFileNameWithIllegalCharsShort);
	testAndLog(r==0);
	
	// Test wildcards, 8-bit ASCII chars in 16-bit Unicode chars.
	MakeFile(KTestFileNameWithWildChars);
	r = TheFs.GetShortName(KTestFileNameWithWildChars, shn);
	test_KErrNone(r);
	r = shn.Compare(KTestFileNameWithWildCharsShort);
	testAndLog(r==0);
	
	r=TheFs.Delete(KTestFileNameWithIllegalChars);
	testAndLog(r==0);
	r=TheFs.Delete(KTestNormalUnicodeFileName);
	testAndLog(r==0);
	r=TheFs.Delete(KTestFileNameWithWildChars);
	testAndLog(r==0);
	
	r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
	testAndLog(r==KErrNone);
	failedOnBuf.Close();
	tcUniquePath.Close();
	__UHEAP_MARKEND;
	}
/**
ReadSmtpSettingsFromConfigurationFileL()
Modifies the POP related default setting and IAP objects.

@param  aSettingsFile
Configuration/setting file path. 

@param  aSmtpSet
@param  aSmtpIapPref
*/	
EXPORT_C void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadSmtpSettingsFromConfigurationFileL(TDesC& aSettingsFile, 
										CImSmtpSettings& aSmtpSet, CImIAPPreferences& aSmtpIapPref,const TDesC&/* aPtrEmailAdd*/)
	{
	// Parses the setting file
	CT_MsgUtilsConfigFileParserUtility* scriptFileParser = CT_MsgUtilsConfigFileParserUtility::NewL(aSettingsFile);
	CleanupStack::PushL(scriptFileParser);	
	
	TPtrC8 string8Ptr; 
	TPtrC stringPtr = KNone(); 
	TInt intValue;

	if(scriptFileParser->GetFieldAsString(KCfgSmtpServerAddress, stringPtr) == KErrNone)
		{
		aSmtpSet.SetServerAddressL(stringPtr);
		}
	
	CT_MsgUtilsConfigFileMachineName* machineNameFile = CT_MsgUtilsConfigFileMachineName::NewLC(stringPtr);
	TPtrC emailAddr(machineNameFile->MachineNameEmail());
	TPtrC8 machineName(machineNameFile->MachineName());
	
	if(scriptFileParser->GetFieldAsString(KCfgSmtpEmailAddress, stringPtr) == KErrNone)
		{
		aSmtpSet.SetEmailAddressL(stringPtr);
		}
		
	else
		{
		aSmtpSet.SetEmailAddressL(emailAddr);
		}

	if(scriptFileParser->GetFieldAsString(KCfgSmtpBodyEncoding, stringPtr) == KErrNone)
		{
		TMsgOutboxBodyEncoding setBodyEncoding = CT_MsgUtilsEnumConverter::ConvertDesToTMsgOutboxBodyEncoding(stringPtr);
		aSmtpSet.SetBodyEncoding(setBodyEncoding);
		}
	
	if(scriptFileParser->GetFieldAsString(KCfgSmtpReceiptAddress, stringPtr) == KErrNone)
		{
		aSmtpSet.SetReceiptAddressL(stringPtr);
		}
		
	else
		{
		aSmtpSet.SetReceiptAddressL(emailAddr);
		}
		
	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpRequestReceipts, intValue) == KErrNone)
		{		
		aSmtpSet.SetRequestReceipts((TBool) intValue);
		}
	
	if(scriptFileParser->GetFieldAsString(KCfgSmtpSendMessageOption, stringPtr) == KErrNone)
		{
		TImSMTPSendMessageOption setSendMessageOption = CT_MsgUtilsEnumConverter::ConvertDesToTImSMTPSendMessageOption(stringPtr);
		aSmtpSet.SetSendMessageOption(setSendMessageOption);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSetPort, intValue) == KErrNone)
		{
		aSmtpSet.SetPort(intValue);
		}
	
	if(scriptFileParser->GetFieldAsString(KCfgSmtpEmailAlias, stringPtr) == KErrNone)
		{
		aSmtpSet.SetEmailAliasL(stringPtr);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpDefaultMsgCharSet, intValue) == KErrNone)
		{
		TUid tmp = { intValue };
		aSmtpSet.SetDefaultMsgCharSet(tmp);
		}
	
	if(scriptFileParser->GetFieldAsString(KCfgSmtpSetReplyToAddress, stringPtr) == KErrNone)
		{
		aSmtpSet.SetReplyToAddressL(stringPtr);
		}
		
	else
		{
		aSmtpSet.SetReplyToAddressL(emailAddr);
		}
			
	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSetAddVCardToEmail, intValue) == KErrNone)
		{		
		aSmtpSet.SetAddVCardToEmail((TBool) intValue);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSetAddSignatureToEmail, intValue) == KErrNone)
		{		
		aSmtpSet.SetAddSignatureToEmail((TBool) intValue);
		}
	
	if(scriptFileParser->GetFieldAsString(KCfgSmtpSetSendCopyToSelf, stringPtr) == KErrNone)
		{
		TImSMTPSendCopyToSelf setSMTPSendCopyToSelf = CT_MsgUtilsEnumConverter::ConvertDesToTImSMTPSendCopyToSelf(stringPtr);
		aSmtpSet.SetSendCopyToSelf(setSMTPSendCopyToSelf);
		}
	
	if(scriptFileParser->GetFieldAsString8(KCfgSmtpSetLoginName, string8Ptr) == KErrNone)
		{
		aSmtpSet.SetLoginNameL(string8Ptr);
		}
		
	else
		{
		aSmtpSet.SetLoginNameL(machineName);	
		}
			
	if(scriptFileParser->GetFieldAsString8(KCfgSmtpSetPassword, string8Ptr) == KErrNone)
		{
		aSmtpSet.SetPasswordL(string8Ptr);
		}

	else
		{
		aSmtpSet.SetPasswordL(machineName);	
		}
			
	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSetSMTPAuth, intValue) == KErrNone)
		{		
		aSmtpSet.SetSMTPAuth((TBool) intValue);
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSetInboxLoginDetails, intValue) == KErrNone)
		{		
		aSmtpSet.SetInboxLoginDetails((TBool) intValue);
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSecureSockets, intValue) == KErrNone)
		{		
		aSmtpSet.SetSecureSockets((TBool) intValue);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSSLWrapper, intValue) == KErrNone)
		{		
		aSmtpSet.SetSSLWrapper((TBool) intValue);
		}
	
	if(scriptFileParser->GetFieldAsString(KCfgSmtpIapList, stringPtr) == KErrNone)
		{
		ReadSmtpIAPAndAddL(scriptFileParser, KCfgSmtpIapList, aSmtpIapPref);
		}
		
	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSNAPId, intValue) == KErrNone)
		{		
		aSmtpIapPref.SetSNAPL(intValue);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgSmtpBearerMobility, intValue) == KErrNone)
		{		
		aSmtpSet.SetBearerMobility((TBool) intValue);
		}	
	
	CleanupStack::PopAndDestroy(2,scriptFileParser);
	
	}
/**
ReadPopSettingsFromConfigurationFileL()
Modifies the POP related default setting and IAP objects.

@param  aSettingsFile
Configuration/setting file path. 

@param  aPopSet
CImPop3Settings object.

@param  aPopIapPref
*/
EXPORT_C void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopSettingsFromConfigurationFileL(TDesC& aSettingsFile, 
											CImPop3Settings& aPopSet, CImIAPPreferences& aPopIapPref, const TDesC& /*aPtrEmailAdd*/)
	{
	// Parses the setting file
	CT_MsgUtilsConfigFileParserUtility* scriptFileParser = CT_MsgUtilsConfigFileParserUtility::NewL(aSettingsFile);
	CleanupStack::PushL(scriptFileParser);	
	
	TPtrC8 string8Ptr; 
	TPtrC stringPtr = KNone(); 
	TInt intValue;

	if(scriptFileParser->GetFieldAsString(KCfgPopServerAddress, stringPtr) == KErrNone)
		{	
		aPopSet.SetServerAddressL(stringPtr);
		}

	CT_MsgUtilsConfigFileMachineName* machineNameFile = CT_MsgUtilsConfigFileMachineName::NewLC(stringPtr);
	TPtrC8 machineName(machineNameFile->MachineName());

	
	if(scriptFileParser->GetFieldAsString8(KCfgPopLoginName, string8Ptr) == KErrNone)
		{
		aPopSet.SetLoginNameL(string8Ptr);
		}

	else
		{
		aPopSet.SetLoginNameL(machineName);
		}
	
	if(scriptFileParser->GetFieldAsString8(KCfgPopPassword, string8Ptr) == KErrNone)
		{
		aPopSet.SetPasswordL(string8Ptr);
		}

	else
		{
		aPopSet.SetPasswordL(machineName);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgPopMaxEmailSize, intValue) == KErrNone)
		{
		aPopSet.SetMaxEmailSize(intValue);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgPopPort, intValue) == KErrNone)
		{
		aPopSet.SetPort(intValue);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgPopInboxSynchronisationLimit, intValue) == KErrNone)
		{
		aPopSet.SetInboxSynchronisationLimit(intValue);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgPopSecureSockets, intValue) == KErrNone)
		{
		aPopSet.SetSecureSockets((TBool)intValue);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgPopSSLWrapper, intValue) == KErrNone)
		{
		aPopSet.SetSSLWrapper((TBool)intValue);
		}
	
	if(scriptFileParser->GetFieldAsString(KCfgPopGetMailOptions, stringPtr) == KErrNone)
		{
		TPop3GetMailOptions options = CT_MsgUtilsEnumConverter::ConvertDesToTPop3GetMailOptions(stringPtr);
		aPopSet.SetGetMailOptions(options);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgPopPopulationLimit, intValue) == KErrNone)
		{
		aPopSet.SetPopulationLimitL(intValue);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgPopAutoSendOnConnect, intValue) == KErrNone)
		{	
		aPopSet.SetAutoSendOnConnect((TBool) intValue);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgPopDeleteEmailsWhenDisconnecting, intValue) == KErrNone)
		{	
		aPopSet.SetDeleteEmailsWhenDisconnecting((TBool) intValue);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgPopAcknowledgeReceipts, intValue) == KErrNone)
		{	
		aPopSet.SetAcknowledgeReceipts((TBool) intValue);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgPopDisconnectedUserMode, intValue) == KErrNone)
		{	
		aPopSet.SetDisconnectedUserMode((TBool) intValue);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgPopAPOPEncryption, intValue) == KErrNone)
		{	
		aPopSet.SetApop((TBool) intValue);
		}
		
	if(scriptFileParser->GetFieldAsString(KCfgPopIapList, stringPtr) == KErrNone)
		{
		ReadPopIAPAndAddL(scriptFileParser, (TDesC&) KCfgPopIapList, aPopIapPref);
		}
		
	if(scriptFileParser->GetFieldAsInteger(KCfgPopSNAPId, intValue) == KErrNone)
		{		
		aPopIapPref.SetSNAPL(intValue);
		}
		
	if(scriptFileParser->GetFieldAsInteger(KCfgPopBearerMobility, intValue) == KErrNone)
		{	
		aPopSet.SetBearerMobility((TBool) intValue);
		}
		
	CleanupStack::PopAndDestroy(2,scriptFileParser);
	}
/**
ReadImapSettingsFromConfigurationFileL()
Modifies the IMAP related default setting and IAP objects.

@param  aSettingsFile
Configuration/setting file path. 

@param  aImapSet
CImImap4Settings object.

@param  aImapIapPref
CImIAPPreferences object.
*/
EXPORT_C void CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadImapSettingsFromConfigurationFileL(
															TDesC& aSettingsFile, CImImap4Settings& aImapSet, CImIAPPreferences& aImapIapPref,const TDesC& /* aPtrEmailAdd */)

	{
	// Parses the setting file
	CT_MsgUtilsConfigFileParserUtility* scriptFileParser = CT_MsgUtilsConfigFileParserUtility::NewL(aSettingsFile);
	CleanupStack::PushL(scriptFileParser);	
	
	TPtrC8 string8Ptr; 
	TPtrC stringPtr = KNone(); 
	TInt intTmp;
		
	if(scriptFileParser->GetFieldAsString(KCfgImapServerAddress, stringPtr) == KErrNone)
		{
		aImapSet.SetServerAddressL(stringPtr);
		}

	CT_MsgUtilsConfigFileMachineName* machineNameFile = CT_MsgUtilsConfigFileMachineName::NewLC(stringPtr);
	TPtrC8 machineName(machineNameFile->MachineName());
	
	if(scriptFileParser->GetFieldAsString8(KCfgImapLoginName, string8Ptr) == KErrNone)
		{
		aImapSet.SetLoginNameL(string8Ptr);
		}
	else
		{
		aImapSet.SetLoginNameL(machineName);
		}

	if(scriptFileParser->GetFieldAsString8(KCfgImapPassword, string8Ptr) == KErrNone)
		{
		aImapSet.SetPasswordL(string8Ptr);
		}
	else
		{
		aImapSet.SetPasswordL(machineName);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgImapPort, intTmp) == KErrNone)
		{
		aImapSet.SetPort(intTmp);
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgImapSecureSockets, intTmp) == KErrNone)
		{		
		aImapSet.SetSecureSockets( (TBool) intTmp );
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgImapSSLWrapper, intTmp ) == KErrNone)
		{		
		aImapSet.SetSSLWrapper( (TBool) intTmp );
		}

	if(scriptFileParser->GetFieldAsString8(KCfgImapFolderPath, string8Ptr) == KErrNone)
		{
		aImapSet.SetFolderPathL(string8Ptr);
		}

	if(scriptFileParser->GetFieldAsString8(KCfgImapPathSeperator, string8Ptr) == KErrNone)
		{
		if ( string8Ptr.Length() == 1  )
			{
			aImapSet.SetPathSeparator( string8Ptr[0] );			
			}
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgImapMaxEmailSize, intTmp) == KErrNone)
		{
		aImapSet.SetMaxEmailSize(intTmp);
		}
	
	if(scriptFileParser->GetFieldAsString(KCfgImapGetMailOptions, stringPtr) == KErrNone)
		{
		TImap4GetMailOptions setGetMailOptions = CT_MsgUtilsEnumConverter::ConvertDesToTImap4GetMailOptions(stringPtr);
		aImapSet.SetGetMailOptions(setGetMailOptions);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgImapInboxSynchronisationLimit, intTmp) == KErrNone)
		{
		aImapSet.SetInboxSynchronisationLimit(intTmp);
		}
		
	if(scriptFileParser->GetFieldAsInteger(KCfgImapMailboxSynchronisationLimit, intTmp) == KErrNone)
		{
		aImapSet.SetMailboxSynchronisationLimit(intTmp);
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgImapAutoSendOnConnect, intTmp) == KErrNone)
		{		
		aImapSet.SetAutoSendOnConnect((TBool) intTmp);
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgImapDeleteEmailsWhenDisconnecting, intTmp) == KErrNone)
		{		
		aImapSet.SetDeleteEmailsWhenDisconnecting((TBool) intTmp);
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgImapAcknowledgeReceipts, intTmp) == KErrNone)
		{		
		aImapSet.SetAcknowledgeReceipts((TBool) intTmp);
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgImapDisconnectedUserMode, intTmp) == KErrNone)
		{		
		aImapSet.SetDisconnectedUserMode((TBool) intTmp);
		}

	if(scriptFileParser->GetFieldAsString(KCfgImapSynchronise, stringPtr) == KErrNone)
		{
		TFolderSyncType setFolderSyncType = CT_MsgUtilsEnumConverter::ConvertDesToTFolderSyncType(stringPtr);
		aImapSet.SetSynchronise(setFolderSyncType);
		}

	if(scriptFileParser->GetFieldAsString(KCfgImapSubscribe, stringPtr) == KErrNone)
		{
		TFolderSubscribeType setFolderSubscribeType = CT_MsgUtilsEnumConverter::ConvertDesToTFolderSubscribeType(stringPtr);
		aImapSet.SetSubscribe(setFolderSubscribeType);
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgImapUpdatingSeenFlags, intTmp) == KErrNone)
		{		
		aImapSet.SetUpdatingSeenFlags((TBool) intTmp);
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgImapSyncRate, intTmp) == KErrNone)
		{
		aImapSet.SetSyncRateL(intTmp);
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgImapFetchSize, intTmp) == KErrNone)
		{
		aImapSet.SetFetchSizeL(intTmp);
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgImapIdle, intTmp) == KErrNone)
		{		
		aImapSet.SetImapIdle( (TBool) intTmp );
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgImapIdleTimeout, intTmp) == KErrNone)
		{
		aImapSet.SetImapIdleTimeoutL(intTmp);
		}

	if(scriptFileParser->GetFieldAsString(KCfgImapPartialMailOptions, stringPtr) == KErrNone)
		{
		TImImap4PartialMailOptions setImap4PartialMailOptions = CT_MsgUtilsEnumConverter::ConvertDesToTImImap4PartialMailOptions(stringPtr);
		aImapSet.SetPartialMailOptionsL(setImap4PartialMailOptions);
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgImapBodyTextSizeLimit, intTmp) == KErrNone)
		{
		aImapSet.SetBodyTextSizeLimitL(intTmp);
		}

	if(scriptFileParser->GetFieldAsInteger(KCfgImapAttachmentSizeLimit, intTmp) == KErrNone)
		{
		aImapSet.SetAttachmentSizeLimitL(intTmp);
		}

	if(scriptFileParser->GetFieldAsString(KCfgImapIapList, stringPtr) == KErrNone)
		{
		ReadImapIAPAndAddL(scriptFileParser, (TDesC&)KCfgImapIapList, aImapIapPref);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KUseExpunge, intTmp) == KErrNone)
		{		
		aImapSet.SetUseExpunge( (TBool) intTmp);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgImapSNAPId, intTmp) == KErrNone)
		{		
		aImapIapPref.SetSNAPL(intTmp);
		}
		
	if(scriptFileParser->GetFieldAsInteger(KCfgImapBearerMobility, intTmp) == KErrNone)
		{		
		aImapSet.SetBearerMobility((TBool) intTmp);
		}
	
	if(scriptFileParser->GetFieldAsInteger(KCfgImapDownloadRules, intTmp) == KErrNone)
		{		
		aImapSet.SetUseSyncDownloadRules((TBool) intTmp);
		}	
	
	CleanupStack::PopAndDestroy(2,scriptFileParser);
	}