voipplugins/voipadapters/cpvoipadapter/src/CWPVoIPAdapter.cpp
branchRCL_3
changeset 9 bddb6d4447db
parent 0 a4daefaec16c
child 12 876a3df1f464
equal deleted inserted replaced
8:7117cbf1600a 9:bddb6d4447db
   984 
   984 
   985     TUint32 storageId( 0 );
   985     TUint32 storageId( 0 );
   986     TLex8 lex( aStorageIdValue );
   986     TLex8 lex( aStorageIdValue );
   987     User::LeaveIfError( lex.Val( storageId, EDecimal ) );
   987     User::LeaveIfError( lex.Val( storageId, EDecimal ) );
   988 
   988 
   989 
       
   990     const TInt itemCount = iDatas.Count();
   989     const TInt itemCount = iDatas.Count();
   991 
   990 
   992     //lint -e{961} No need for else statement here
   991     //lint -e{961} No need for else statement here
   993     if ( KErrNone == KSIPAppID8().CompareF( tmpAppId->Des() ) )
   992     if ( KErrNone == KSIPAppID8().CompareF( tmpAppId->Des() ) )
   994         {
   993         {
   997             TBool setOk = iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ESIP,
   996             TBool setOk = iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ESIP,
   998                 storageId, aAppRef );
   997                 storageId, aAppRef );
   999 
   998 
  1000             TBuf8<KTempStringlength> userAgentHeader;
   999             TBuf8<KTempStringlength> userAgentHeader;
  1001             iDatas[itemIndex]->GetUserAgentHeaderL( userAgentHeader );
  1000             iDatas[itemIndex]->GetUserAgentHeaderL( userAgentHeader );
  1002             // SIPProfileId must be bigger than 1 because otherwise
  1001             if ( setOk && storageId > 0 )
  1003             // cSIPManagedProfileRegistry->ProfileL will leave.
       
  1004             if ( setOk && storageId > 1 )
       
  1005                 {
  1002                 {
  1006                 TUint32 itemId = iDatas[itemIndex]->ItemId();
  1003                 TUint32 itemId = iDatas[itemIndex]->ItemId();
  1007                 if ( TUint( KNotSaved ) != itemId )
  1004                 if ( TUint( KNotSaved ) != itemId )
  1008                     {
  1005                     {
  1009                     // First update RCSE so that service will be created.
  1006                     // First update RCSE so that service will be created.
  1019                     referredIds.iProfileSpecificSettingId = KNotSet; 
  1016                     referredIds.iProfileSpecificSettingId = KNotSet; 
  1020                     rcseProf->iIds.Append( referredIds );
  1017                     rcseProf->iIds.Append( referredIds );
  1021                     rcseReg->UpdateL( itemId, *rcseProf );
  1018                     rcseReg->UpdateL( itemId, *rcseProf );
  1022                     CleanupStack::PopAndDestroy( 2, rcseReg );
  1019                     CleanupStack::PopAndDestroy( 2, rcseReg );
  1023                     }
  1020                     }
  1024                 
       
  1025 
  1021 
  1026                 // Then set SIP user-agent header
  1022                 // Then set SIP user-agent header
  1027                 DBG_PRINT(
  1023                 DBG_PRINT(
  1028                     "CWVoIPAdapter::SettingsSavedL - \
  1024                     "CWVoIPAdapter::SettingsSavedL - \
  1029                     create SIP User-Agent Header..." );
  1025                     create SIP User-Agent Header..." );
  1049                 if ( userAgentHeader.Length() > 0 )
  1045                 if ( userAgentHeader.Length() > 0 )
  1050                     {
  1046                     {
  1051                     User::LeaveIfError( cSIPManagedProfile->SetParameter( 
  1047                     User::LeaveIfError( cSIPManagedProfile->SetParameter( 
  1052                         KSIPHeaders, *uahArray ) );
  1048                         KSIPHeaders, *uahArray ) );
  1053                     }
  1049                     }
  1054                 
  1050 
  1055                 cSIPManagedProfileRegistry->SaveL( *cSIPManagedProfile );
  1051                 cSIPManagedProfileRegistry->SaveL( *cSIPManagedProfile );
  1056                 uahArray->Reset();
  1052                 uahArray->Reset();
  1057                 CleanupStack::PopAndDestroy( uahArray ); // CS:5
  1053                 CleanupStack::PopAndDestroy( uahArray ); // CS:5
  1058                 CleanupStack::PopAndDestroy( cSIPManagedProfile ); // CS:4
  1054                 CleanupStack::PopAndDestroy( cSIPManagedProfile ); // CS:4
  1059                 CleanupStack::Pop( cSIPProfile ); // CS:3
  1055                 CleanupStack::Pop( cSIPProfile ); // CS:3
  1065                     "CWVoIPAdapter::SettingsSavedL - \
  1061                     "CWVoIPAdapter::SettingsSavedL - \
  1066                     SIP User-Agent Header created and set." );
  1062                     SIP User-Agent Header created and set." );
  1067                 } // if ( matches ... )
  1063                 } // if ( matches ... )
  1068             } // for
  1064             } // for
  1069         }
  1065         }
  1070 
       
  1071     else if ( KErrNone == KSCCPAppID8().CompareF( tmpAppId->Des() ) )
  1066     else if ( KErrNone == KSCCPAppID8().CompareF( tmpAppId->Des() ) )
  1072         {
  1067         {
  1073         for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
  1068         for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
  1074             {
  1069             {
  1075             iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ESCCP, storageId, 
  1070             iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ESCCP, storageId, 
  1076                 aAppRef );
  1071                 aAppRef );
  1077             }
  1072             }
  1078         }
  1073         }
  1079 
       
  1080     else if ( KErrNone == KNATFWAppID8().CompareF( tmpAppId->Des() ) )
  1074     else if ( KErrNone == KNATFWAppID8().CompareF( tmpAppId->Des() ) )
  1081         {
  1075         {
  1082         for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
  1076         for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
  1083             {
  1077             {
  1084             iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ENATFW, storageId,
  1078             iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ENATFW, storageId,
  1085                 aAppRef );
  1079                 aAppRef );
  1086             }
  1080             }
  1087         }
  1081         }
  1088 
       
  1089     else if ( KErrNone == KPresenceAppId8().CompareF( tmpAppId->Des() ) )
  1082     else if ( KErrNone == KPresenceAppId8().CompareF( tmpAppId->Des() ) )
  1090         {
  1083         {
  1091         for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
  1084         for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
  1092             {
  1085             {
  1093             iDatas[itemIndex]->SetStorageId( CWPVoIPItem::EPresence, 
  1086             iDatas[itemIndex]->SetStorageId( CWPVoIPItem::EPresence, 
  1094                 storageId, aAppRef );
  1087                 storageId, aAppRef );
  1095             }
  1088             }
  1096         }
  1089         }
  1097 
       
  1098     else if ( KErrNone == KSNAPAppID8().CompareF( tmpAppId->Des() ) )
  1090     else if ( KErrNone == KSNAPAppID8().CompareF( tmpAppId->Des() ) )
  1099         {
  1091         {
  1100         for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
  1092         for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
  1101             {
  1093             {
  1102             iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ESNAP, storageId, 
  1094             iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ESNAP, storageId,