email/pop3andsmtpmtm/clientmtms/src/POP3SET.CPP
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "POP3SET.H"
       
    17 #include <nifvar.h>				// For KLinkLayerOpen
       
    18 
       
    19 
       
    20 GLREF_C TPtrC8 LimitStringSize(const TPtrC8& aString, TInt aMaxSize);
       
    21 
       
    22 const TInt KPOP3PopulateOptionsVersion=1;
       
    23 
       
    24 /**
       
    25 Creates and initialises a TImPop3PopulateOptions using data from a packaged
       
    26 descriptor to initialise members. 
       
    27 
       
    28 @param aDesc
       
    29 descriptor containing a packaged instance of either TImPop3PopulateOptions
       
    30 
       
    31 @param aUnpackTo
       
    32 Used to return the unpacked options class
       
    33 
       
    34 */
       
    35 EXPORT_C void TImPop3PopulateOptions::UnpackL(const TDesC8& aDesc, TImPop3PopulateOptions &aUnpackTo)
       
    36 
       
    37 	{
       
    38 	TPckgBuf<TImPop3PopulateOptions> options;
       
    39 	options.Copy(aDesc);
       
    40 	aUnpackTo=options();
       
    41 	}
       
    42 
       
    43 EXPORT_C TImPop3PopulateOptions::TImPop3PopulateOptions() :
       
    44 		iVersion(KPOP3PopulateOptionsVersion),
       
    45 		iMaxEmailSize(KMaxTInt),
       
    46 		iPopulationLimit(-1)
       
    47 	{
       
    48 
       
    49 	}
       
    50 
       
    51 
       
    52 EXPORT_C TInt TImPop3PopulateOptions::MaxEmailSize()
       
    53 	{
       
    54 	return iMaxEmailSize;
       
    55 	}
       
    56 
       
    57 EXPORT_C void TImPop3PopulateOptions::SetMaxEmailSize(TInt aMaxEmailSize)
       
    58 	{
       
    59 	iMaxEmailSize=aMaxEmailSize;
       
    60 	}
       
    61 
       
    62 EXPORT_C TInt TImPop3PopulateOptions::PopulationLimit()
       
    63 	{
       
    64 	return iPopulationLimit;
       
    65 	}
       
    66 
       
    67 EXPORT_C void TImPop3PopulateOptions::SetPopulationLimit(TInt aPopulationLimit)
       
    68 	{
       
    69 	iPopulationLimit=aPopulationLimit;
       
    70 	}
       
    71 		
       
    72 
       
    73 
       
    74 EXPORT_C TInt TPop3Progress::ConnectionState() const
       
    75 /**
       
    76 Retrieves the stage of the connection process as defined in nifvar.h and csdprog.h
       
    77 while the service is connecting to the POP3 server.
       
    78 
       
    79 @return
       
    80 KLinkLayerOpen if the POP3 service has successfully connected, or
       
    81 KErrNotFound if the POP3 service is disconnected, or 
       
    82 the current connection stage (declared in nifvar.h and csdprog.h) while
       
    83 establishing a connection.
       
    84 */
       
    85 	{
       
    86 	switch(iPop3Progress )
       
    87 		{
       
    88 	case EPopConnecting:
       
    89 		// Return the connection state temporarily stored in iTotalMsgs
       
    90 		// while connection is in progress
       
    91 		return iTotalMsgs;
       
    92 	case EPopDisconnected:
       
    93 		// If we're definately in a disconnected state, return KErrNotFound
       
    94 		return KErrNotFound;
       
    95 	default:
       
    96 		// If we're in one of the connected states, return KLinkLayerOpen
       
    97 		return KLinkLayerOpen;
       
    98 		}
       
    99 	}
       
   100 
       
   101 
       
   102 EXPORT_C TInt TPop3Progress::ConnectionIAP() const
       
   103 /**
       
   104 Retrieves the internet access point that is used when connecting to the
       
   105 POP3 service.
       
   106 
       
   107 @return
       
   108 KErrNotFound if the POP3 service is not connecting, otherwise the
       
   109 internet access point number.
       
   110 */
       
   111 	{
       
   112 	if (iPop3Progress == EPopConnecting)
       
   113 		{
       
   114 		// Return the connection IAP temporarily stored in iTotalBytes
       
   115 		// while connection is in progress
       
   116 		return iTotalBytes;
       
   117 		}
       
   118 	else
       
   119 		{
       
   120 		return KErrNotFound;
       
   121 		}
       
   122 	}
       
   123 
       
   124 
       
   125 EXPORT_C CImPop3Settings::CImPop3Settings()
       
   126 /** 
       
   127 Allocates and creates a new CImPop3Settings object initialised to
       
   128 default values.
       
   129 */
       
   130 	{
       
   131 	Reset();
       
   132 	} 
       
   133 
       
   134 
       
   135 EXPORT_C CImPop3Settings::~CImPop3Settings()
       
   136 /**
       
   137 Destructor.
       
   138 */
       
   139 	{
       
   140 	Reset();
       
   141 	
       
   142 	delete iExtension;
       
   143 	iExtension = NULL;
       
   144 	} 
       
   145 
       
   146 
       
   147 EXPORT_C void CImPop3Settings::Reset()
       
   148 /**
       
   149 Resets the settings to their default values.
       
   150 */
       
   151 	{
       
   152 	CImBaseEmailSettings::Reset();
       
   153 	
       
   154 	iPortNumber = KPOP3DefaultPortNumber;
       
   155 
       
   156 	iInboxSyncLimit=KImPop3SynchroniseAll;
       
   157 	iMaxEmailSize = KMaxTInt;
       
   158 
       
   159 	if (Extension())
       
   160 		{
       
   161 		delete Extension()->iLoginName;
       
   162 		Extension()->iLoginName=NULL;
       
   163 
       
   164 		delete Extension()->iPassword;
       
   165 		Extension()->iPassword = NULL;
       
   166 		
       
   167 		delete Extension()->iTlsSslDomain;
       
   168 		Extension()->iTlsSslDomain=NULL;
       
   169 		
       
   170 		// no population limit
       
   171 		Extension()->iPopulationLimit=-1;
       
   172 		}
       
   173 
       
   174 	SetApop(EFalse); 
       
   175 	}
       
   176 
       
   177 
       
   178 EXPORT_C const TPtrC8 CImPop3Settings::LoginName() const
       
   179 /**
       
   180 Retrieves the configured login user name (mailbox) of the POP3 service.
       
   181 
       
   182 @see
       
   183 SetLoginNameL()
       
   184 
       
   185 @return 
       
   186 The user name.
       
   187 */
       
   188 	{
       
   189 	if (Extension() && Extension()->iLoginName)
       
   190 		return TPtrC8(*(Extension()->iLoginName));
       
   191 	return TPtrC8();
       
   192 	}
       
   193 
       
   194 
       
   195 EXPORT_C const TPtrC8 CImPop3Settings::Password() const
       
   196 /**
       
   197 Retrieves the configured plain text login password that will be sent to the POP3
       
   198 server if APOP is not configured.
       
   199 
       
   200 @see
       
   201 SetPasswordL()
       
   202 
       
   203 @return 
       
   204 The password.
       
   205 */
       
   206 	{
       
   207 	if (Extension() && Extension()->iPassword)
       
   208 		return TPtrC8(*(Extension()->iPassword));
       
   209 	return TPtrC8();
       
   210 	}
       
   211 
       
   212 
       
   213 EXPORT_C TBool CImPop3Settings::Apop() const
       
   214 /**
       
   215 Checks whether the POP3 service is configured to log on using plain text
       
   216 authentication or APOP encrypted authentication.
       
   217 
       
   218 The default setting is EFalse.
       
   219 
       
   220 @see
       
   221 SetApop()
       
   222 
       
   223 @return
       
   224 ETrue if using APOP encrypted authentication.
       
   225 EFalse if using plain text authentication.
       
   226 */
       
   227 	{
       
   228 	return iFlags & KPop3ApopFlag;
       
   229 	}
       
   230 
       
   231 
       
   232 EXPORT_C TBool CImPop3Settings::AutoSendOnConnect() const
       
   233 /**
       
   234 Checks whether queued emails associated with the same internet access point
       
   235 as the POP3 service will be sent first before logging onto the POP3 server.
       
   236 The internet access point for each email service (POP3, IMAP4, SMTP) is configured
       
   237 using CImIAPPreferences.
       
   238  
       
   239 @see CImIAPPreferences
       
   240 
       
   241 @return 
       
   242 ETrue if configured to send emails after the connection is established, but before
       
   243 authentication with the POP3 server.
       
   244 */
       
   245 	{
       
   246 	return iFlags & KPop3AutoSendFlag;
       
   247 	}
       
   248 
       
   249 
       
   250 EXPORT_C void CImPop3Settings::SetLoginNameL(const TDesC8& aLoginName)
       
   251 /**
       
   252 Configures the login user name (mailbox) for the POP3 service.
       
   253 
       
   254 @param aLoginName
       
   255 The plain text login user name. A copy of aLoginName is made so if you
       
   256 want to change the user name you must call this method again for the
       
   257 changes to take effect.
       
   258 */
       
   259 	{
       
   260 	CheckExtensionExistsL();
       
   261 	HBufC8* newLoginName = aLoginName.AllocL();
       
   262 	delete Extension()->iLoginName;
       
   263 	Extension()->iLoginName = newLoginName;
       
   264 	}
       
   265 
       
   266 
       
   267 EXPORT_C void CImPop3Settings::SetPasswordL(const TDesC8& aPassword)
       
   268 /**
       
   269 Configures the login password for the POP3 service. The plain text password
       
   270 will be sent during authentication with the POP3 server. It can also be
       
   271 used to store the shared secret when authenticating using APOP if SetApop() is
       
   272 enabled.
       
   273 
       
   274 @param aPassword
       
   275 The plain text login password. A copy of aPassword is made so if you
       
   276 want to change the user name you must call this method again for the
       
   277 changes to take effect.
       
   278 */
       
   279 	{
       
   280 	CheckExtensionExistsL();
       
   281 	HBufC8* newPassword = aPassword.AllocL();
       
   282 	delete Extension()->iPassword;
       
   283 	Extension()->iPassword = newPassword;
       
   284 	}
       
   285 
       
   286 
       
   287 EXPORT_C void CImPop3Settings::SetApop(TBool aFlag)
       
   288 /** 
       
   289 Configures the POP3 service to authenticate using either a plain text password
       
   290 or an APOP encrypted digest.
       
   291 
       
   292 If configured to use APOP authentication, the configured password set by the call
       
   293 to SetPasswordL() is used to store the shared secret between the server and the POP3
       
   294 service. The timestamp sent in the servers' hello banner and the password are joined
       
   295 and encrypted into a digest before being sent using the MD5 algorithm.
       
   296 
       
   297 The default setting is EFalse.
       
   298 
       
   299 @param aFlag
       
   300 Specify ETrue to use APOP encrypted authentication.
       
   301 Specify EFalse to use plain text authentication.
       
   302 */
       
   303 	{
       
   304 	iFlags = (iFlags & ~KPop3ApopFlag) | (aFlag ? KPop3ApopFlag : KPop3SettingsClearFlag);
       
   305 	}
       
   306 
       
   307 
       
   308 EXPORT_C void CImPop3Settings::SetAutoSendOnConnect(TBool aFlag)
       
   309 /** 
       
   310 Configures the POP3 service to send queued emails associated with the same internet
       
   311 access point to be sent first before logging onto the POP3 server.
       
   312 
       
   313 The internet access point for each email service (POP3, IMAP4, SMTP) is configured
       
   314 using CImIAPPreferences.
       
   315  
       
   316 @see CImIAPPreferences
       
   317 
       
   318 @param aFlag 
       
   319 Specify ETrue to send emails after the connection is established, but before
       
   320 authentication with the POP3 service.
       
   321 Specify EFalse to disable this functionality.
       
   322 */
       
   323 	{
       
   324 	iFlags = (iFlags & ~KPop3AutoSendFlag) | (aFlag ? KPop3AutoSendFlag : KPop3SettingsClearFlag);
       
   325 	}
       
   326 
       
   327 
       
   328 EXPORT_C TBool CImPop3Settings::DisconnectedUserMode() const
       
   329 /**
       
   330 Checks if disconnected user mode is configured.
       
   331 
       
   332 If disconnected user mode is enabled by calling SetDisconnectedUserMode(), 
       
   333 then the POP3 client MTM (CPop3ClientMtm) will accept message operations, 
       
   334 such as deleting messages from a server, while the user is offline.
       
   335 The operations are stored and executed when the user connects again.
       
   336 
       
   337 @see
       
   338 CPop3ClientMtm
       
   339 
       
   340 @return 
       
   341 ETrue if disconnected user mode is enabled.
       
   342 */
       
   343 	{
       
   344 	return iFlags & KPop3DisconnectedModeFlag;
       
   345 	}
       
   346 
       
   347 
       
   348 EXPORT_C void CImPop3Settings::SetDisconnectedUserMode(TBool aFlag)
       
   349 /** 
       
   350 Enables the POP3 client MTM (CPop3ClientMtm) to accept message operations
       
   351 while disconnected.
       
   352 
       
   353 If disconnected user mode is enabled the POP3 client MTM will accept message
       
   354 operations such as deleting messages from a server, while the user is offline.
       
   355 The operations are stored and executed when the user connects again.
       
   356 
       
   357 @see
       
   358 CPop3ClientMtm
       
   359 
       
   360 @param aFlag
       
   361 Specify ETrue to enable disconnected user mode.
       
   362 Specify EFalse to disable disconnected user mode.
       
   363 */
       
   364 	{
       
   365 	iFlags = (iFlags & ~KPop3DisconnectedModeFlag) | (aFlag ? KPop3DisconnectedModeFlag : KPop3SettingsClearFlag);
       
   366 	}
       
   367 
       
   368 
       
   369 EXPORT_C TBool CImPop3Settings::DeleteEmailsWhenDisconnecting() const
       
   370 /** 
       
   371 Checks whether the caller has enabled this setting by calling 
       
   372 SetDeleteEmailsWhenDisconnecting().
       
   373 
       
   374 This flag is not used by the Messaging subsystem.
       
   375 
       
   376 @see
       
   377 CPop3ClientMtm
       
   378 
       
   379 @return
       
   380 ETrue if this flag is set.
       
   381 */
       
   382 	{
       
   383 	return iFlags & KPop3DeleteEmailsWhenDisconnectingFlag;
       
   384 	}
       
   385 
       
   386 
       
   387 EXPORT_C void CImPop3Settings::SetDeleteEmailsWhenDisconnecting(TBool aFlag)
       
   388 /** 
       
   389 Sets or resets a flag.
       
   390 
       
   391 This flag is not used by the Messaging subsystem.
       
   392 
       
   393 @param aFlag
       
   394 Specify ETrue to set this flag.
       
   395 */
       
   396 	{
       
   397 	iFlags = (iFlags & ~KPop3DeleteEmailsWhenDisconnectingFlag) | (aFlag ? KPop3DeleteEmailsWhenDisconnectingFlag : KPop3SettingsClearFlag);
       
   398 	}
       
   399 
       
   400 
       
   401 EXPORT_C TBool CImPop3Settings::AcknowledgeReceipts() const
       
   402 /** 
       
   403 Checks whether the caller has enabled this setting by calling 
       
   404 SetAcknowledgeReceipts().
       
   405 
       
   406 This flag is a convenience setting for Messaging client applications that may 
       
   407 wish to store whether or not to send a receipt email message to the sender when the
       
   408 email has been received. The Messaging subsystem does not use this setting, 
       
   409 and has to be explicitly commanded by the Messaging client application to
       
   410 send a receipt notification. Messaging applications can use CImHeader to check
       
   411 if a message has a return receipt address. Receipt notification messages can 
       
   412 be created using CImEmailOperation, and sent using the SMTP client MTM.
       
   413 
       
   414 @see
       
   415 CImHeader
       
   416 CImEmailOperation
       
   417 CSmtpClientMtm
       
   418 
       
   419 @return
       
   420 ETrue if this flag is set.
       
   421 */
       
   422 	{
       
   423 	return iFlags & KPop3AcknowledgeReceipts;
       
   424 	}
       
   425 
       
   426 
       
   427 EXPORT_C void CImPop3Settings::SetAcknowledgeReceipts(TBool aFlag)
       
   428 /** 
       
   429 Sets or resets a flag.
       
   430 
       
   431 This flag is a convenience setting for Messaging client applications that may 
       
   432 wish to store whether or not to send a receipt email message to the sender when the
       
   433 email has been received. The Messaging subsystem does not use this setting, 
       
   434 and has to be explicitly commanded by the Messaging client application to
       
   435 send a receipt notification. Messaging applications can use CImHeader to check
       
   436 if a message has a return receipt address. Receipt notification messages can be
       
   437 created using CImEmailOperation, and sent using the SMTP client MTM.
       
   438 
       
   439 @see
       
   440 CImHeader
       
   441 CImEmailOperation
       
   442 CSmtpClientMtm
       
   443 
       
   444 @param aFlag
       
   445 Specify ETrue to set this flag.
       
   446 */
       
   447 	{
       
   448 	iFlags = (iFlags & ~KPop3AcknowledgeReceipts) | (aFlag ? KPop3AcknowledgeReceipts : KPop3SettingsClearFlag);
       
   449 	}
       
   450 
       
   451 
       
   452 EXPORT_C TInt CImPop3Settings::MaxEmailSize() const
       
   453 /** 
       
   454 Returns the maximum message size in bytes to be downloaded. This
       
   455 value is set by a calling SetMaxEmailSize().
       
   456 
       
   457 The Messaging subsystem does not use this setting. The default setting is KMaxInt.
       
   458 
       
   459 Messaging applications can use CImPOP3GetMail or CPop3ClientMtm to specify
       
   460 a maximum email size to retrieve by passing a TImPop3GetMailInfo parameter in
       
   461 method calls.
       
   462 
       
   463 @see
       
   464 TImPop3GetMailInfo
       
   465 CImPOP3GetMail
       
   466 CPop3ClientMtm
       
   467 
       
   468 @return
       
   469 The maximum message size in bytes.
       
   470 */
       
   471 	{
       
   472 	return iMaxEmailSize;
       
   473 	}
       
   474 
       
   475 
       
   476 EXPORT_C void CImPop3Settings::SetMaxEmailSize(const TInt aMaxEmailSize)
       
   477 /** 
       
   478 Sets the maximum message size in bytes to be downloaded.
       
   479 
       
   480 The Messaging subsystem does not use this setting. The default setting is KMaxInt.
       
   481 
       
   482 Messaging applications can use CImPOP3GetMail or CPop3ClientMtm to specify
       
   483 a maximum email size to retrieve by passing a TImPop3GetMailInfo parameter in
       
   484 method calls.
       
   485 
       
   486 @see
       
   487 TImPop3GetMailInfo
       
   488 CImPOP3GetMail
       
   489 CPop3ClientMtm
       
   490 
       
   491 @param aMaxEmailSize
       
   492 Specifies the maximum message size in bytes.
       
   493 */
       
   494 	{
       
   495 	iMaxEmailSize = aMaxEmailSize;
       
   496 	}
       
   497 
       
   498 
       
   499 EXPORT_C TPop3GetMailOptions CImPop3Settings::GetMailOptions() const
       
   500 /**
       
   501 Retrieves an enumeration that specifies whether only the messages headers
       
   502 or the entire message will be downloaded when synchronising with the POP3 server.
       
   503 This is specified by calling SetGetMailOptions().
       
   504 
       
   505 @see
       
   506 TPop3GetMailOptions
       
   507 
       
   508 @return
       
   509 An enumeration specifying how messages will be synchronised.
       
   510 */
       
   511 	{
       
   512 	return iGetMailOptions;
       
   513 	}
       
   514 
       
   515 
       
   516 EXPORT_C void CImPop3Settings::SetGetMailOptions(TPop3GetMailOptions aGetMailOptions)
       
   517 /** 
       
   518 Specifies whether to download headers only, or entire messages when
       
   519 synchronising with the POP3 server.
       
   520 
       
   521 @see
       
   522 TPop3GetMailOptions
       
   523 
       
   524 @param aGetMailOptions
       
   525 Specifies whether to download headers only, or entire messages when
       
   526 synchronising with the POP3 server.
       
   527 */
       
   528 	{
       
   529 	iGetMailOptions = aGetMailOptions;
       
   530 	}
       
   531 
       
   532 
       
   533 EXPORT_C TInt32 CImPop3Settings::InboxSynchronisationLimit() const
       
   534 /** 
       
   535 Returns whether or not the POP3 service will synchronise with all
       
   536 emails on the server after connecting, or the maximum number of new messages 
       
   537 that will be synchronised if there are new messages on the server. This
       
   538 setting is configured by calling SetInboxSynchronisationLimit().
       
   539 
       
   540 The default setting is to synchronise all messages.
       
   541 
       
   542 @return
       
   543 If negative, the POP3 service will synchronise all emails after connecting.
       
   544 If zero, the POP3 service will not synchronise after connecting.
       
   545 If positive, the POP3 service will synchronise to the n most recent emails,
       
   546 where n is this return value.
       
   547 */
       
   548 	{
       
   549 	return iInboxSyncLimit ;
       
   550 	}
       
   551 
       
   552 
       
   553 EXPORT_C void CImPop3Settings::SetInboxSynchronisationLimit(const TInt32 aInboxSyncLimit)
       
   554 /** 
       
   555 Specifies whether or not the POP3 service will synchronise with all
       
   556 emails on the server after connecting, or the maximum number of new messages 
       
   557 that will be synchronised if there are new messages on the server.
       
   558 
       
   559 The default setting is to synchronise all messages.
       
   560 
       
   561 @param aInboxSyncLimit
       
   562 If negative, the POP3 service will synchronise all emails after connecting.
       
   563 If zero, the POP3 service will not synchronise after connecting.
       
   564 If positive, the POP3 service will synchronise to the n most recent emails,
       
   565 where n is this return value.
       
   566 */
       
   567 	{
       
   568 	iInboxSyncLimit = aInboxSyncLimit;
       
   569 	}
       
   570 
       
   571 /** 
       
   572 Retrieves the currently stored TOP population limit from settings.
       
   573 If this is set, it does not mean that this limit is applied but rather
       
   574 is just a convenient place to store the current limit
       
   575 */
       
   576 EXPORT_C TInt32 CImPop3Settings::PopulationLimit() const
       
   577 	{
       
   578 	if(Extension())
       
   579 		{
       
   580 		return Extension()->iPopulationLimit;
       
   581 		}
       
   582 	else
       
   583 		{
       
   584 		// default to no poulation limit if none has been set
       
   585 		return -1;
       
   586 		}
       
   587 	}
       
   588 
       
   589 
       
   590 /** 
       
   591 Sets the currently stored TOP population limit to settings.
       
   592 If this is set, it does not mean that this limit is applied but rather
       
   593 is just a convenient place to store the current limit, the limit must be passed in
       
   594 the parameters of the command
       
   595 */
       
   596 EXPORT_C void CImPop3Settings::SetPopulationLimitL(const TInt32 aPopulationLimit)
       
   597 	{
       
   598 	CheckExtensionExistsL();
       
   599 	Extension()->iPopulationLimit = aPopulationLimit;
       
   600 	}
       
   601 	
       
   602 
       
   603 EXPORT_C CImPop3Settings& CImPop3Settings::CopyL(const CImPop3Settings& aCImPop3Settings)
       
   604 /**
       
   605 Copies the configuration settings from another POP3 settings object into this object.
       
   606 
       
   607 @param aCImPop3Settings
       
   608 Specifies the object to copy.
       
   609 
       
   610 @return
       
   611 This object after copying.
       
   612 */
       
   613 	{
       
   614 	// CheckExtensionExistsL() called at the start of the function, since it's allocation will be longer lived
       
   615 	CheckExtensionExistsL();
       
   616 	Reset();
       
   617 	CImBaseEmailSettings::CopyL(aCImPop3Settings);
       
   618 	Extension()->iLoginName		=	aCImPop3Settings.LoginName().AllocL();
       
   619 	Extension()->iPassword		=	aCImPop3Settings.Password().AllocL();
       
   620 	Extension()->iTlsSslDomain 	= 	aCImPop3Settings.TlsSslDomain().AllocL();
       
   621 	iMaxEmailSize			=	aCImPop3Settings.iMaxEmailSize;
       
   622 	iGetMailOptions			=	aCImPop3Settings.GetMailOptions();
       
   623 	iInboxSyncLimit			=	aCImPop3Settings.InboxSynchronisationLimit();
       
   624 	SetPopulationLimitL(aCImPop3Settings.PopulationLimit());
       
   625 	return (*this);
       
   626 	}
       
   627 
       
   628 
       
   629 EXPORT_C TBool CImPop3Settings::operator==(const CImPop3Settings& aCImPop3Settings) const
       
   630 /**
       
   631 Equality operator.
       
   632 
       
   633 @param aCImPop3Settings
       
   634 Specifies the POP3 settings object to compare with.
       
   635 
       
   636 @return
       
   637 ETrue if the settings are the same.
       
   638 */
       
   639 	{
       
   640 	return 	((MaxEmailSize() == aCImPop3Settings.iMaxEmailSize) &&
       
   641 		 !(LoginName().Compare(aCImPop3Settings.LoginName())) &&
       
   642 		 !(Password().Compare(aCImPop3Settings.Password())) &&
       
   643 		 (CImBaseEmailSettings::operator==(aCImPop3Settings)) &&	 
       
   644 		 (InboxSynchronisationLimit()==aCImPop3Settings.InboxSynchronisationLimit()) &&
       
   645 		 (PopulationLimit()==aCImPop3Settings.PopulationLimit()));
       
   646 	}
       
   647 
       
   648 /**
       
   649 Sets the domain name to use during TLS/SSL certificate validation.
       
   650 
       
   651 @param aDomainName Domain name
       
   652 */
       
   653 EXPORT_C void CImPop3Settings::SetTlsSslDomainL(const TDesC8& aDomainName)
       
   654 	{
       
   655 	CheckExtensionExistsL();
       
   656 	HBufC8* newTlsSslDomain = aDomainName.AllocL();
       
   657 	delete Extension()->iTlsSslDomain;
       
   658 	Extension()->iTlsSslDomain = newTlsSslDomain;
       
   659 	}
       
   660 
       
   661 /**
       
   662 Gets the domain name used during TLS/SSL certificate validation.
       
   663 
       
   664 @return Domain name
       
   665 */
       
   666 EXPORT_C TPtrC8 CImPop3Settings::TlsSslDomain() const
       
   667 	{		
       
   668 	if (Extension() && Extension()->iTlsSslDomain)		
       
   669 		return TPtrC8(*(Extension()->iTlsSslDomain));
       
   670 	return TPtrC8();
       
   671 	}
       
   672 
       
   673 
       
   674 #if (defined SYMBIAN_EMAIL_CAPABILITY_SUPPORT)
       
   675 /**
       
   676 Enables POP3 authentication using CRAM-MD5 when connecting to email server.
       
   677 Read RFC 2195 "IMAP/POP Authorize Extension for Simple Challenge/Response" for more details.
       
   678 
       
   679 @param aFlag
       
   680 ETrue to enable POP3 authentication.
       
   681 */
       
   682 EXPORT_C void CImPop3Settings::SetPOP3Auth(TBool aFlag)
       
   683 	{
       
   684 	iFlags = (iFlags & ~KPop3AuthFlag) | (aFlag ? KPop3AuthFlag : KPop3SettingsClearFlag);
       
   685 	}
       
   686 
       
   687 
       
   688 /**
       
   689 Retrieves the value of POP3 authentication flag.
       
   690 
       
   691 @return
       
   692 ETrue if POP3 authentication is enabled.
       
   693 */
       
   694 
       
   695 EXPORT_C TBool CImPop3Settings::POP3Auth() const
       
   696 	{
       
   697 	return iFlags & KPop3AuthFlag;
       
   698 	}
       
   699 	
       
   700 
       
   701 /**
       
   702 Enables less secure authentication mechanism (PLAIN or LOGIN), when email server doesn't support CRAM-MD5 authentication. 
       
   703 Fallback flag will be used in conjunction with Authenticate flag and will be used when Authenticate flag is enabled.
       
   704 By default Fallback flag will be EFalse.
       
   705 
       
   706 @param aFlag
       
   707 ETrue to enable Fallback option for less secure authentication.
       
   708 */
       
   709 EXPORT_C void CImPop3Settings::SetFallBack(TBool aFlag)
       
   710 	{
       
   711 	iFlags = (iFlags & ~KPop3FallbackFlag) | (aFlag ? KPop3FallbackFlag : KPop3SettingsClearFlag);
       
   712 	}
       
   713 
       
   714 
       
   715 /**
       
   716 Retrieves the value of Fallback flag.
       
   717 
       
   718 @return
       
   719 ETrue if Fallback flag is enabled.
       
   720 */
       
   721 EXPORT_C TBool CImPop3Settings::FallBack() const
       
   722 	{
       
   723 	return iFlags & KPop3FallbackFlag;
       
   724 	}
       
   725 #endif