email/pop3andsmtpmtm/servermtmutils/src/imutcon.cpp
changeset 76 60a8a215b0ec
parent 0 72b543305e3a
equal deleted inserted replaced
73:ecf6a73a9186 76:60a8a215b0ec
    15 
    15 
    16 #include <cdbpreftable.h>
    16 #include <cdbpreftable.h>
    17 
    17 
    18 #include <commsdat.h>
    18 #include <commsdat.h>
    19 #include <commsdattypesv1_1.h>
    19 #include <commsdattypesv1_1.h>
    20 #include <commdbconnpref.h>
    20 #include <connpref.h>
       
    21 #include <extendedconnpref.h>
       
    22 
    21 #include <miut_err.h>
    23 #include <miut_err.h>
    22 #include <es_enum.h>		// For TConnectionInfo
    24 #include <es_enum.h>		// For TConnectionInfo
    23 #include <imutcon.h>
    25 #include <imutcon.h>
    24 #include "IMSK.H"
    26 #include "IMSK.H"
    25 
    27 
    93 		}
    95 		}
    94 	}
    96 	}
    95 
    97 
    96 void CImConnect::ConnectWithSNAP()
    98 void CImConnect::ConnectWithSNAP()
    97 	{
    99 	{
    98 	TConnSnapPref snapPref(iIAPPreferences.SNAPPreference());
   100 	// Create connection preferences
    99 	iConn.Start(snapPref, iStatus);
   101 	TConnPrefList prefList;
       
   102 	TExtendedConnPref prefs;
       
   103 	
       
   104 	prefs.SetSnapPurpose( CMManager::ESnapPurposeInternet );
       
   105 	if(iIsSilentConn)
       
   106 	    {
       
   107 		prefs.SetNoteBehaviour( TExtendedConnPref::ENoteBehaviourConnSilent );
       
   108 	    }
       
   109 	prefs.SetSnapId(iIAPPreferences.SNAPPreference());
       
   110 	prefList.AppendL( &prefs );
       
   111 	
       
   112 	// Start a connection with connection preferences
       
   113 	iConn.Start( prefList, iStatus );
   100 	}
   114 	}
   101 
   115 
   102 void CImConnect::ConnectWithIAPListL()
   116 void CImConnect::ConnectWithIAPListL()
   103 	{
   117 	{
   104 	TInt iapCount=iIAPPreferences.NumberOfIAPs();
   118 	TInt iapCount=iIAPPreferences.NumberOfIAPs();
   105 
   119 
       
   120 	// Create connection preferences
       
   121 	TConnPrefList prefList;
       
   122 	TExtendedConnPref prefs;
       
   123 	prefs.SetSnapPurpose( CMManager::ESnapPurposeInternet );
       
   124 	if(iIsSilentConn)
       
   125 	    {
       
   126 		prefs.SetNoteBehaviour( TExtendedConnPref::ENoteBehaviourConnSilent );
       
   127 	    }
       
   128 
       
   129 	
   106 	if(iapCount==0)
   130 	if(iapCount==0)
   107 		{
   131 		{
   108 #ifdef __IMSK_LOGGING
   132 #ifdef __IMSK_LOGGING
   109 		_LIT8(KImConDefault,"CImConnect connecting with defaults");
   133 		_LIT8(KImConDefault,"CImConnect connecting with defaults");
   110 		if (iTextSession != NULL)
   134 		if (iTextSession != NULL)
   111 			{
   135 			{
   112 			iTextSession->LogText(KImConDefault);
   136 			iTextSession->LogText(KImConDefault);
   113 			}
   137 			}
   114 #endif
   138 #endif
   115 		iConn.Start(iStatus);
   139 		prefList.AppendL( &prefs );
       
   140         // Start a connection with connection preferences
       
   141 		iConn.Start( prefList, iStatus );
   116 		}
   142 		}
   117 	else
   143 	else
   118 		{
   144 		{
   119 #ifdef __IMSK_SIMULATION
   145 #ifdef __IMSK_SIMULATION
   120 		if(iapCount<=iIAPsToFail)
   146 		if(iapCount<=iIAPsToFail)
   139 			{
   165 			{
   140 			iTextSession->LogText(KImConOverride);
   166 			iTextSession->LogText(KImConOverride);
   141 			}
   167 			}
   142 #endif
   168 #endif
   143 
   169 
   144 		TInt rank=1;
   170 			TImIAPChoice iapChoice = iIAPPreferences.IAPPreference(0);
   145 #ifdef __IMSK_SIMULATION
   171 
   146 		for(TInt i=iIAPsToFail;i<iapCount;i++)
   172 			prefs.SetIapId(iapChoice.iIAP);
   147 #else
   173 			prefList.AppendL( &prefs );
   148 		for(TInt i=0;i<iapCount;i++)
   174 		iConn.Start(prefList, iStatus);
   149 #endif
       
   150 			{
       
   151 			TCommDbConnPref pref;
       
   152 			pref.SetDirection(ECommDbConnectionDirectionOutgoing);
       
   153 			
       
   154 			// legacy code which restricted the type of bearer
       
   155 			pref.SetBearerSet(KCommDbBearerCSD | KCommDbBearerWcdma | KCommDbBearerLAN |
       
   156 			                  KCommDbBearerVirtual | KCommDbBearerPAN | KCommDbBearerWLAN);
       
   157 
       
   158 			TImIAPChoice iapChoice = iIAPPreferences.IAPPreference(i);
       
   159 
       
   160 			pref.SetIapId(iapChoice.iIAP);
       
   161 			pref.SetDialogPreference(iapChoice.iDialogPref);
       
   162 
       
   163 			User::LeaveIfError(iPrefs.SetPreference(rank, pref));
       
   164 
       
   165 			rank++;
       
   166 			}
       
   167 
       
   168 		iPrefs.SetConnectionAttempts(rank-1);
       
   169 		iConn.Start(iPrefs, iStatus);
       
   170 		}
   175 		}
   171 	}
   176 	}
   172 
   177 
   173 CImConnect::~CImConnect()
   178 CImConnect::~CImConnect()
   174 	{
   179 	{