email/pop3andsmtpmtm/smtpservermtm/src/IMSMSEND.CPP
changeset 76 60a8a215b0ec
parent 0 72b543305e3a
equal deleted inserted replaced
73:ecf6a73a9186 76:60a8a215b0ec
    54 
    54 
    55 /**
    55 /**
    56 Connect the session to the server
    56 Connect the session to the server
    57 
    57 
    58 @param aClientStatus Client status to be completed
    58 @param aClientStatus Client status to be completed
       
    59 @param aIsSilent If ETrue then Silent Connection is required
    59 */
    60 */
    60 void CImSmtpSession::ConnectL(TRequestStatus& aClientStatus)
    61 void CImSmtpSession::ConnectL(TRequestStatus& aClientStatus, TBool aIsSilent)
    61 	{
    62 	{
    62 	__ASSERT_DEBUG(!iSocketIsConnected, gPanic(EImsmSocketAlreadyConnected));
    63 	__ASSERT_DEBUG(!iSocketIsConnected, gPanic(EImsmSocketAlreadyConnected));
    63 
    64 
    64 	if (!iSocketIsConnected)
    65 	if (!iSocketIsConnected)
    65 		{
    66 		{
    70 		else
    71 		else
    71 			iThisSession = ESmtpSession;		 // use SMTP session for now
    72 			iThisSession = ESmtpSession;		 // use SMTP session for now
    72 
    73 
    73 		iCompleted = KErrNone;
    74 		iCompleted = KErrNone;
    74 		iState = EConnectingToSmtp;		// Initialise to 1st state of state machine
    75 		iState = EConnectingToSmtp;		// Initialise to 1st state of state machine
    75 		DoStateL();						// Here we go...
    76 		DoStateL(aIsSilent);						// Here we go...
    76 		Queue(aClientStatus);		
    77 		Queue(aClientStatus);		
    77 		}
    78 		}
    78 	else
    79 	else
    79 		{
    80 		{
    80 		// Nothing to do so just complete the caller
    81 		// Nothing to do so just complete the caller
   314 
   315 
   315 			iSendFiles->ResetBccRcptArrayL();
   316 			iSendFiles->ResetBccRcptArrayL();
   316 
   317 
   317 			TInt numberRcpts = rcptArray->Count();
   318 			TInt numberRcpts = rcptArray->Count();
   318 			if(numberRcpts)
   319 			if(numberRcpts)
   319 			{
   320                 {
   320 			iSendFiles->BccRcptArray().AppendL((*rcptArray)[0]);
   321                 iSendFiles->BccRcptArray().AppendL((*rcptArray)[0]);
   321 			CDesCArray& tempArr = iSendFiles->BccRcptArray();
   322                 CDesCArray& tempArr = iSendFiles->BccRcptArray();
   322 			for(TInt counter=1; counter<numberRcpts; counter++)
   323                 for(TInt counter=1; counter<numberRcpts; counter++)
   323 				{
   324                     {
   324 				TInt aPos = 0;
   325                     TInt aPos = 0;
   325 				tempArr.Find((*rcptArray)[counter],aPos,ECmpFolded16);			
   326                     TInt found = tempArr.Find((*rcptArray)[counter],aPos,ECmpFolded16);			
   326 				if(aPos > 0)	
   327                     if(found == KErrNone && aPos > 0)
   327 				iSendFiles->BccRcptArray().AppendL((*rcptArray)[counter]);
   328                         {
   328 				}
   329                         iSendFiles->BccRcptArray().AppendL((*rcptArray)[counter]);    
       
   330                         }
       
   331                     
       
   332                     }
   329 				}
   333 				}
   330 			rcptArray->Reset();
   334 			rcptArray->Reset();
   331 			}
   335 			}
   332 
   336 
   333 		iToRcptHeaderUpdated=ETrue;
   337 		iToRcptHeaderUpdated=ETrue;
   818 	// The reset was not accepted - didn't get a 2xx response. Might as
   822 	// The reset was not accepted - didn't get a 2xx response. Might as
   819 	// well end the SMTP session.
   823 	// well end the SMTP session.
   820 	return EClosingSmtp;
   824 	return EClosingSmtp;
   821 	}
   825 	}
   822 
   826 
   823 void CImSmtpSession::DoStateL()
   827 void CImSmtpSession::DoStateL(TBool aIsSilent)
   824 // performs the operation required by iState
   828 // performs the operation required by iState
   825     {
   829     {
   826     switch (iState)
   830     switch (iState)
   827         {
   831         {
   828 		case EConnectingToSmtp:
   832 		case EConnectingToSmtp:
   829 			iEsmtpSpokenHere = EFalse;
   833 			iEsmtpSpokenHere = EFalse;
   830 			i8BitMimeAcceptedHere = EFalse;
   834 			i8BitMimeAcceptedHere = EFalse;
   831 			iSizeAcceptedHere = EFalse;
   835 			iSizeAcceptedHere = EFalse;
   832 			iStartTlsAcceptedHere = EFalse;
   836 			iStartTlsAcceptedHere = EFalse;
       
   837             iSocket->SetSilentConnection(aIsSilent);
   833 			if(iSettings.SSLWrapper())
   838 			if(iSettings.SSLWrapper())
   834 				{
   839 				{
   835 				// Open secure socket on port 465 for SMTP session
   840 				// Open secure socket on port 465 for SMTP session
   836 				iSocket->SSLQueueConnectL(iStatus, iSettings.ServerAddress(), iSettings.Port(), iSettings.IapPrefs(), iSettings.TlsSslDomain());
   841 				iSocket->SSLQueueConnectL(iStatus, iSettings.ServerAddress(), iSettings.Port(), iSettings.IapPrefs(), iSettings.TlsSslDomain());
   837 				}
   842 				}