email/imum/Utils/Src/ComDbUtl.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15  *       Class implementation file
       
    16  *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "ComDbUtl.h"
       
    22 #include "EmailFeatureUtils.h"
       
    23 #include "IMSSettingsDialog.h"
       
    24 #include "ImumUtilsLogging.h"
       
    25 #include "ImumPanic.h"
       
    26 
       
    27 #include <badesca.h>                // CDesCArrayFlat
       
    28 #include <StringLoader.h>           // StringLoader
       
    29 #include <imapset.h>                // KImapDefaultFetchSizeBytes
       
    30 #include <messagingvariant.hrh>
       
    31 #include <muiu_internal.rsg>
       
    32 #include <ImumUtils.rsg>
       
    33 #include <imum.rsg>
       
    34 #include <cmconnectionmethoddef.h>
       
    35 #include <cmdestination.h>
       
    36 
       
    37 #include <cmapplicationsettingsui.h>
       
    38 #include <cmpluginpacketdatadef.h>
       
    39 #include <cmpluginwlandef.h>
       
    40 #include <cmplugincsddef.h>
       
    41 #include <cmpluginhscsddef.h>
       
    42 #include <cmpluginlanbasedef.h>
       
    43 #include <cmpluginvpndef.h>
       
    44 
       
    45 
       
    46 // ============================ MEMBER FUNCTIONS ===============================
       
    47 
       
    48 // ----------------------------------------------------------------------------
       
    49 // CMsvCommDbUtilities::CMsvCommDbUtilities()
       
    50 // ----------------------------------------------------------------------------
       
    51 //
       
    52 CMsvCommDbUtilities::CMsvCommDbUtilities()
       
    53     {
       
    54     IMUM_CONTEXT( CMsvCommDbUtilities::CMsvCommDbUtilities, 0, KLogUi );
       
    55     }
       
    56 
       
    57 // ----------------------------------------------------------------------------
       
    58 // CMsvCommDbUtilities::NewLC()
       
    59 // ----------------------------------------------------------------------------
       
    60 //
       
    61 CMsvCommDbUtilities* CMsvCommDbUtilities::NewLC()
       
    62     {
       
    63     IMUM_STATIC_CONTEXT( CMsvCommDbUtilities::NewL, 0, utils, KLogUi );
       
    64 
       
    65     CMsvCommDbUtilities* self = new ( ELeave ) CMsvCommDbUtilities;
       
    66     CleanupStack::PushL(self);
       
    67     self->ConstructL();
       
    68     return self;
       
    69     }
       
    70 
       
    71 // ----------------------------------------------------------------------------
       
    72 // CMsvCommDbUtilities::NewL()
       
    73 // ----------------------------------------------------------------------------
       
    74 //
       
    75 CMsvCommDbUtilities* CMsvCommDbUtilities::NewL()
       
    76     {
       
    77     IMUM_STATIC_CONTEXT( CMsvCommDbUtilities::NewL, 0, utils, KLogUi );
       
    78 
       
    79     CMsvCommDbUtilities* self = NewLC();
       
    80     CleanupStack::Pop(); // self
       
    81     return self;
       
    82     }
       
    83 
       
    84 // ----------------------------------------------------------------------------
       
    85 // CMsvCommDbUtilities::~CMsvCommDbUtilities()
       
    86 // ----------------------------------------------------------------------------
       
    87 //
       
    88 CMsvCommDbUtilities::~CMsvCommDbUtilities()
       
    89     {
       
    90     IMUM_CONTEXT( CMsvCommDbUtilities::~CMsvCommDbUtilities, 0, KLogUi );
       
    91     delete iFlags;
       
    92     iFilters.Close();
       
    93     iIapList.Close();
       
    94     iCmManager.Close();
       
    95     }
       
    96 
       
    97 // ----------------------------------------------------------------------------
       
    98 // CMsvCommDbUtilities::ConstructL()
       
    99 // ----------------------------------------------------------------------------
       
   100 //
       
   101 void CMsvCommDbUtilities::ConstructL()
       
   102     {
       
   103     IMUM_CONTEXT( CMsvCommDbUtilities::ConstructL, 0, KLogUi );
       
   104 
       
   105     iInitialized = EFalse;
       
   106     iFlags = MsvEmailMtmUiFeatureUtils::EmailFeaturesL( ETrue, ETrue );
       
   107     iFeatureAllowVPN = MsvEmailMtmUiFeatureUtils::LocalFeatureL(
       
   108             		   	KCRUidMuiuVariation, KMuiuEmailConfigFlags,
       
   109             		   	KEmailFeatureIdEmailVPNAllowed );
       
   110 
       
   111     // Fill IAP Filter array
       
   112     iFilters.Append( KUidPacketDataBearerType );
       
   113     iFilters.Append( KUidLanBearerType );
       
   114     if ( iFlags->GF( EMailFeatureCsd ) )
       
   115         {
       
   116         iFilters.Append( KUidCSDBearerType );
       
   117         iFilters.Append( KUidHSCSDBearerType );
       
   118         }
       
   119     if ( iFlags->GF( EMailFeatureProtocolWlan ) )
       
   120         {
       
   121         iFilters.Append( KUidWlanBearerType );
       
   122         }
       
   123     if( iFeatureAllowVPN )
       
   124     	{
       
   125     	iFilters.Append( KPluginVPNBearerTypeUid );
       
   126     	}
       
   127 
       
   128     iCmManager.OpenL();
       
   129     }
       
   130 
       
   131 
       
   132 // ----------------------------------------------------------------------------
       
   133 // CMsvCommDbUtilities::IsApBearerCircuitSwitchedL()
       
   134 // ----------------------------------------------------------------------------
       
   135 //
       
   136 TBool CMsvCommDbUtilities::IsApBearerCircuitSwitchedL( TUint32 aApId )
       
   137     {
       
   138     IMUM_CONTEXT( CMsvCommDbUtilities::IsApBearerCircuitSwitchedL, 0, KLogUi );
       
   139 
       
   140     TBool retVal = EFalse;
       
   141 
       
   142     // Get the connection method that's used, leaves if no
       
   143     // connection methods found
       
   144     RCmConnectionMethod connectionMethod = iCmManager.ConnectionMethodL( aApId );
       
   145     CleanupClosePushL( connectionMethod );
       
   146 
       
   147     // Check for CSD type
       
   148     TInt bearerType = connectionMethod.GetIntAttributeL( CMManager::ECmBearerType );
       
   149 	if( bearerType == KCommDbBearerCSD )
       
   150 		{
       
   151 		retVal = ETrue;
       
   152 		}
       
   153     // Check for VPN access point's home IAP
       
   154 	else if( bearerType == KPluginVPNBearerTypeUid )
       
   155     	{
       
   156     	TInt homeIAP = connectionMethod.GetIntAttributeL( CMManager::EVpnIapId );
       
   157 
       
   158     	RCmConnectionMethod vpnMethod = iCmManager.ConnectionMethodL( homeIAP );
       
   159     	CleanupClosePushL( vpnMethod );
       
   160     	TInt vpnBearerType = vpnMethod.GetIntAttributeL( CMManager::ECmBearerType );
       
   161 
       
   162     	// Is the home AP a CSD access point?
       
   163     	if( vpnBearerType == KCommDbBearerCSD )
       
   164     		{
       
   165     		retVal = ETrue;
       
   166     		}
       
   167     	CleanupStack::PopAndDestroy(); // vpnMethod
       
   168     	}
       
   169 
       
   170     CleanupStack::PopAndDestroy(); // connectionMethod
       
   171     return retVal;
       
   172     }
       
   173 
       
   174 // ----------------------------------------------------------------------------
       
   175 // CMsvCommDbUtilities::FillCustomIapArrayL()
       
   176 // ----------------------------------------------------------------------------
       
   177 //
       
   178 void CMsvCommDbUtilities::FillCustomIapArrayL( CDesCArrayFlat& aFillArray )
       
   179     {
       
   180     IMUM_CONTEXT( CMsvCommDbUtilities::FillCustomIapArrayL, 0, KLogUi );
       
   181 
       
   182     // Set filters and get the accesspoint list
       
   183     InitializeSelectionL();
       
   184 
       
   185     // Create the current iap list
       
   186     const TInt count = iIapList.Count();
       
   187 
       
   188     // Make sure there are items in the array
       
   189     if ( count )
       
   190         {
       
   191         // Add all iap items to main array
       
   192         for ( TInt item = 0; item < count; item++ )
       
   193             {
       
   194             RCmConnectionMethod cm = iCmManager.ConnectionMethodL( iIapList[item] );
       
   195             CleanupClosePushL( cm );
       
   196 
       
   197             HBufC* apname = cm.GetStringAttributeL(CMManager::ECmName);
       
   198             CleanupStack::PushL(apname);
       
   199             // Insert to array and delete old item
       
   200             aFillArray.AppendL( apname->Des() );
       
   201             CleanupStack::PopAndDestroy(2); // CSI: 47 # cm, apname
       
   202             }
       
   203         }
       
   204     }
       
   205 
       
   206 
       
   207 // ----------------------------------------------------------------------------
       
   208 // CMsvCommDbUtilities::InitializeSelectionL()
       
   209 // ----------------------------------------------------------------------------
       
   210 //
       
   211 void CMsvCommDbUtilities::InitializeSelectionL()
       
   212     {
       
   213     IMUM_CONTEXT( CMsvCommDbUtilities::InitializeSelectionL, 0, KLogUi );
       
   214 
       
   215     if(!iInitialized)
       
   216         {
       
   217         TBool wlanSupported = EFalse;
       
   218         if ( iFlags->GF( EMailFeatureProtocolWlan ) )
       
   219             {
       
   220             wlanSupported = ETrue;
       
   221             }
       
   222 
       
   223         //fill the array of connection method id's
       
   224         iCmManager.ConnectionMethodL( iIapList, ETrue, EFalse, wlanSupported );
       
   225 
       
   226         TInt methodCount = iIapList.Count();
       
   227         TInt bearerCount = iFilters.Count();
       
   228 
       
   229         // Make sure there are items in the array
       
   230         if ( methodCount )
       
   231             {
       
   232             for ( TInt methodItem = 0; methodItem < methodCount; methodItem++ )
       
   233                 {
       
   234                 RCmConnectionMethod cm =
       
   235                 	iCmManager.ConnectionMethodL( iIapList[methodItem] );
       
   236                 CleanupClosePushL( cm );
       
   237                 TUint methodBearer = cm.GetIntAttributeL( CMManager::ECmBearerType );
       
   238                 CleanupStack::PopAndDestroy(1); //cm
       
   239 
       
   240                 TBool found(EFalse);
       
   241                 for ( TInt bearerItem = 0; bearerItem < bearerCount; bearerItem++ )
       
   242                     {
       
   243                     TUint bearerUid = iFilters[bearerItem];
       
   244                     if( bearerUid == methodBearer )
       
   245                         {
       
   246                         found = ETrue;
       
   247                         }
       
   248                     }
       
   249                 if(!found)
       
   250                     {
       
   251                     iIapList.Remove(methodItem);
       
   252                     methodCount--;
       
   253                     }
       
   254                 }
       
   255             }
       
   256         iInitialized = ETrue;
       
   257         }
       
   258     }
       
   259 
       
   260 
       
   261 // ----------------------------------------------------------------------------
       
   262 // CMsvCommDbUtilities::StaticIAPCount()
       
   263 // ----------------------------------------------------------------------------
       
   264 //
       
   265 TInt CMsvCommDbUtilities::StaticIAPCount()
       
   266 	{
       
   267 	IMUM_CONTEXT( CMsvCommDbUtilities::StaticIAPCount, 0, KLogUi );
       
   268 	IMUM_IN();
       
   269 
       
   270 	TInt staticCount = 1; // this is for default connection
       
   271 
       
   272     if ( iFlags->GF( EMailFeatureProtocolWlan ) )
       
   273         {
       
   274         // Add one for WLAN Access Point
       
   275         staticCount++;
       
   276         }
       
   277 
       
   278 	IMUM_OUT();
       
   279 	return staticCount;
       
   280 	}
       
   281 
       
   282 
       
   283 // ----------------------------------------------------------------------------
       
   284 // CMsvCommDbUtilities::InitItemAccessPointL()
       
   285 // ----------------------------------------------------------------------------
       
   286 //
       
   287 void CMsvCommDbUtilities::InitItemAccessPointL(
       
   288     CIMSSettingsAccessPointItem& aIapItem,
       
   289     const TBool aIsWizard )
       
   290     {
       
   291     IMUM_CONTEXT( CMsvCommDbUtilities::InitItemAccessPointL, 0, KLogUi );
       
   292 
       
   293     // Initialize to first access point if called from wizard
       
   294     if( aIsWizard )
       
   295     	{
       
   296     	aIapItem.iIap.iResult = CMManager::EDefaultConnection;
       
   297     	aIapItem.iIap.iId = 0;
       
   298     	aIapItem.iIapRadioButton = 0;
       
   299     	}
       
   300     else
       
   301     	{
       
   302     	if( aIapItem.iIap.iId == 0 )
       
   303     		{
       
   304         	aIapItem.iIap.iResult = CMManager::EDefaultConnection;
       
   305         	aIapItem.iIapRadioButton = 0;
       
   306     		}
       
   307     	else
       
   308     		{
       
   309         	aIapItem.iIap.iResult = CMManager::EConnectionMethod;
       
   310         	aIapItem.iIapRadioButton = GetIapIndexL( aIapItem.iIap.iId );
       
   311     		}
       
   312     	}
       
   313 
       
   314     aIapItem.iIsWizard = aIsWizard;
       
   315 
       
   316     // Trap the leave but ignore the error, as the result is only seen in UI
       
   317     TRAP_IGNORE( SettingsItemIapStringL( aIapItem ) );
       
   318     }
       
   319 
       
   320 
       
   321 // ----------------------------------------------------------------------------
       
   322 // CMsvCommDbUtilities::GetWizardRadioButton()
       
   323 // ----------------------------------------------------------------------------
       
   324 //
       
   325 TInt CMsvCommDbUtilities::GetWizardRadioButton(
       
   326     CIMSSettingsAccessPointItem& aIapItem )
       
   327     {
       
   328     IMUM_CONTEXT( CMsvCommDbUtilities::GetWizardRadioButton, 0, KLogUi );
       
   329 
       
   330     return aIapItem.iIapRadioButton;
       
   331     }
       
   332 
       
   333 
       
   334 // ----------------------------------------------------------------------------
       
   335 // CMsvCommDbUtilities::GetIapIndexL()
       
   336 // ----------------------------------------------------------------------------
       
   337 //
       
   338 TInt CMsvCommDbUtilities::GetIapIndexL( const TUint32 aId )
       
   339 	{
       
   340     IMUM_CONTEXT( CMsvCommDbUtilities::GetIapIndexL, 0, KLogUi );
       
   341     IMUM_IN();
       
   342 
       
   343     for ( TInt index = 0; index< iIapList.Count(); index++ )
       
   344         {
       
   345         TUint32 iapId( 0 );
       
   346         RCmConnectionMethod cm = iCmManager.ConnectionMethodL( iIapList[index] );
       
   347         CleanupClosePushL( cm );
       
   348         iapId = cm.GetIntAttributeL( CMManager::ECmId );
       
   349         CleanupStack::PopAndDestroy(1); // cm
       
   350         if( iapId == aId )
       
   351             {
       
   352             IMUM_OUT();
       
   353             return index;
       
   354             }
       
   355         }
       
   356 
       
   357     IMUM_OUT();
       
   358     // Default to 0 so the radio button points to the default connection
       
   359     return 0;
       
   360 	}
       
   361 
       
   362 
       
   363 // ----------------------------------------------------------------------------
       
   364 // CMsvCommDbUtilities::SettingsItemIapStringL()
       
   365 // ----------------------------------------------------------------------------
       
   366 //
       
   367 const TDesC* CMsvCommDbUtilities::SettingsItemIapStringL(
       
   368     CIMSSettingsAccessPointItem& aIapItem )
       
   369     {
       
   370     IMUM_CONTEXT( CMsvCommDbUtilities::SettingsItemIapStringL, 0, KLogUi );
       
   371 
       
   372     // If the static access point is set, the name of the accesspoint can
       
   373     // be fetched from the list.
       
   374     if ( aIapItem.iIap.iResult != CMManager::EDefaultConnection )
       
   375         {
       
   376         RCmConnectionMethod cm;
       
   377         cm = iCmManager.ConnectionMethodL( aIapItem.iIap.iId );
       
   378         CleanupClosePushL( cm );
       
   379         HBufC* bearerName = cm.GetStringAttributeL(CMManager::ECmName);
       
   380         CleanupStack::PushL( bearerName );
       
   381         aIapItem.iItemSettingText->Copy( bearerName->Des() );
       
   382         CleanupStack::PopAndDestroy( 2, &cm ); // CSI: 47 # cm, bearername
       
   383         }
       
   384     else
       
   385         {
       
   386         TInt resourceId = 0;
       
   387         resourceId = R_NETW_CONSET_OPTIONS_DEFAULT_CONNECTION;
       
   388         ItemLoadBufferForItemL( aIapItem, resourceId );
       
   389         }
       
   390 
       
   391     return aIapItem.iItemSettingText;
       
   392     }
       
   393 
       
   394 // ----------------------------------------------------------------------------
       
   395 // CMsvCommDbUtilities::ItemLoadBufferForItemL()
       
   396 // ----------------------------------------------------------------------------
       
   397 //
       
   398 void CMsvCommDbUtilities::ItemLoadBufferForItemL(
       
   399     CIMSSettingsAccessPointItem& aIapItem,
       
   400     const TInt aResource )
       
   401     {
       
   402     IMUM_CONTEXT( CMsvCommDbUtilities::ItemLoadBufferForItemL, 0, KLogUi );
       
   403 
       
   404     // Load the string from the resource and store it into the setting item
       
   405     HBufC* text = StringLoader::LoadL( aResource );
       
   406     CleanupStack::PushL( text );
       
   407 
       
   408     aIapItem.iItemSettingText->Copy(
       
   409         text->Left( KMuiuDynMaxSettingsLongTextLength ) );
       
   410 
       
   411     CleanupStack::PopAndDestroy( text );
       
   412     text = NULL;
       
   413     }
       
   414 
       
   415 // ----------------------------------------------------------------------------
       
   416 // CMsvCommDbUtilities::LaunchIapPageL()
       
   417 // ----------------------------------------------------------------------------
       
   418 //
       
   419 TInt CMsvCommDbUtilities::LaunchIapPageL( CIMSSettingsAccessPointItem& aIapItem )
       
   420     {
       
   421     IMUM_CONTEXT( CMsvCommDbUtilities::LaunchIapPageL, 0, KLogUi );
       
   422 
       
   423     // This function handles the launching of the IAP setting page.
       
   424     // using the Connection Method Manager
       
   425     TInt result = KErrNotFound;
       
   426 
       
   427     // Show the access point list using Connection Method Manager
       
   428     CCmApplicationSettingsUi* settingsUi = CCmApplicationSettingsUi::NewLC();
       
   429     TUint apFilter = CMManager::EShowDefaultConnection |
       
   430     				 CMManager::EShowConnectionMethods;
       
   431     result = settingsUi->RunApplicationSettingsL( aIapItem.iIap,
       
   432     											  apFilter,
       
   433                                                   iFilters );
       
   434     CleanupStack::PopAndDestroy( settingsUi );
       
   435 
       
   436     // Return the quit method
       
   437     return result ? KErrNone : KErrCancel;
       
   438     }
       
   439 
       
   440 
       
   441 // ----------------------------------------------------------------------------
       
   442 // CMsvCommDbUtilities::IsWlanAccessPointL()
       
   443 // ----------------------------------------------------------------------------
       
   444 //
       
   445 TBool CMsvCommDbUtilities::IsWlanAccessPointL( TUint32 aIap ) const
       
   446     {
       
   447     IMUM_CONTEXT( CMsvCommDbUtilities::IsWlanAccessPointL, 0, KLogUi );
       
   448 
       
   449     TBool isWlan = EFalse;
       
   450 
       
   451     // First check if the AP is of wlan type
       
   452     TUint bearerType = BearerTypeL( aIap );
       
   453     if( bearerType == KUidWlanBearerType )
       
   454     	{
       
   455     	isWlan = ETrue;
       
   456     	}
       
   457     // Then make sure VPN doesn't have wlan IAP as home IAP
       
   458     else if( bearerType == KPluginVPNBearerTypeUid )
       
   459     	{
       
   460     	RCmConnectionMethod vpnCM = iCmManager.ConnectionMethodL( aIap );
       
   461     	CleanupClosePushL( vpnCM );
       
   462     	TInt homeIAP = vpnCM.GetIntAttributeL( CMManager::EVpnIapId );
       
   463     	CleanupStack::PopAndDestroy(); // vpnCM
       
   464 
       
   465     	isWlan = ( BearerTypeL( homeIAP ) == KUidWlanBearerType );
       
   466     	}
       
   467     	
       
   468     return isWlan;
       
   469     }
       
   470 
       
   471 // ----------------------------------------------------------------------------
       
   472 // CMsvCommDbUtilities::DetermineImap4BufferSize()
       
   473 // ----------------------------------------------------------------------------
       
   474 //
       
   475 TInt CMsvCommDbUtilities::DetermineImap4BufferSize(
       
   476     const TUint32 aIap,
       
   477     const CImumMboxDefaultData& aDefaultData ) const
       
   478     {
       
   479     IMUM_CONTEXT( CMsvCommDbUtilities::DetermineImap4BufferSize, 0, KLogUi );
       
   480 
       
   481 	// If the following leaves, it really, really doesn't matter
       
   482     TBool isWlan = EFalse;
       
   483     TRAP_IGNORE( isWlan = IsWlanAccessPointL( aIap ) );
       
   484 
       
   485     TInt key = isWlan ?
       
   486         TImumInSettings:: EKeyDownloadBufferWlan:
       
   487         TImumInSettings:: EKeyDownloadBufferGprs;
       
   488 
       
   489     TInt value = 0;
       
   490     aDefaultData.GetAttr( key, value );
       
   491     return value;
       
   492     }
       
   493 
       
   494 // ----------------------------------------------------------------------------
       
   495 // CMsvCommDbUtilities::BearerTypeL()
       
   496 // ----------------------------------------------------------------------------
       
   497 //
       
   498 TUint32 CMsvCommDbUtilities::BearerTypeL( TUint32 aUid ) const
       
   499     {
       
   500     IMUM_CONTEXT( CMsvCommDbUtilities::BearerTypeL, 0, KLogUi );
       
   501     IMUM_IN();
       
   502 
       
   503     RCmConnectionMethod cm;
       
   504     cm = iCmManager.ConnectionMethodL( aUid );
       
   505     CleanupClosePushL( cm );
       
   506     TInt retVal = cm.GetIntAttributeL(CMManager::ECmBearerType);
       
   507     CleanupStack::PopAndDestroy(1); //cm
       
   508 
       
   509     IMUM_OUT();
       
   510     return retVal;
       
   511     }
       
   512 
       
   513 // ----------------------------------------------------------------------------
       
   514 // CMsvCommDbUtilities::GetIapIdL()
       
   515 // ----------------------------------------------------------------------------
       
   516 //
       
   517 TInt CMsvCommDbUtilities::GetIapIdL( const TInt32 aSelectionIndex )
       
   518 	{
       
   519     IMUM_CONTEXT( CMsvCommDbUtilities::GetIapIdL, 0, KLogUi );
       
   520     IMUM_IN();
       
   521 
       
   522     // The radiobutton id can't go over the count of access point list
       
   523     __ASSERT_ALWAYS( aSelectionIndex <= iIapList.Count(),
       
   524     		User::Panic( KImumCommsDbUtilPanic,
       
   525     		EPanicIAPsDoNotMatch ) );
       
   526     
       
   527     TUint32 iapId( 0 );
       
   528     RCmConnectionMethod cm = iCmManager.ConnectionMethodL( 
       
   529     		iIapList[ aSelectionIndex - 1 ] );
       
   530     CleanupClosePushL( cm );
       
   531     iapId = cm.GetIntAttributeL( CMManager::ECmId );
       
   532     CleanupStack::PopAndDestroy(); // cm
       
   533     IMUM_OUT();
       
   534     return iapId;
       
   535 
       
   536 	}
       
   537 
       
   538 
       
   539 // End of File