omadrm/drmplugins/drmrohandler/src/CRoHandler.cpp
changeset 23 493788a4a8a4
parent 2 76350b5be3d8
child 52 d752ced89971
equal deleted inserted replaced
5:79d62d1d7957 23:493788a4a8a4
     1 /*
     1 /*
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include <txtrich.h>                    // for CRichText
    20 #include <txtrich.h>                    // for CRichText
    21 #include <drmmessageparser.h>           // for CDrmMessageParser
    21 #include <DRMMessageParser.h>           // for CDrmMessageParser
    22 #include <drmrights.h>                  // for CDRMRights
    22 #include <DRMRights.h>                  // for CDRMRights
    23 #include <ecom/implementationproxy.h>   // for TImplementationProxy
    23 #include <ecom/implementationproxy.h>   // for TImplementationProxy
    24 #include <push/cpushhandlerbase.h>      // for CPushHandlerBase
    24 #include <push/cpushhandlerbase.h>      // for CPushHandlerBase
    25 #include <push/pluginkiller.h>          // for CPluginKiller
    25 #include <push/pluginkiller.h>          // for CPluginKiller
    26 #include <push/pushmessage.h>           // for CPushMessage
    26 #include <push/pushmessage.h>           // for CPushMessage
    27 #include <roapeng.h>                    // for CRoapEng
    27 #include <RoapEng.h>                    // for CRoapEng
    28 #include <roapengbase.h>
    28 #include <RoapEngBase.h>
    29 #include <roapobserver.h>
    29 #include <RoapObserver.h>
    30 #include <centralrepository.h>          // link against centralrepository.lib
    30 #include <centralrepository.h>          // link against centralrepository.lib
    31 #include <msvuids.h>
    31 #include <msvuids.h>
    32 #include <msvids.h>
    32 #include <msvids.h>
    33 #include <downloadmgrclient.h>
    33 #include <DownloadMgrClient.h>
    34 
    34 
    35 #ifdef RD_MULTIPLE_DRIVE
    35 #ifdef RD_MULTIPLE_DRIVE
    36 #include <driveinfo.h>
    36 #include <driveinfo.h>
    37 #endif
    37 #endif
    38 
    38 
    39 #include <uri16.h>                          // TUriParser16
    39 #include <uri16.h>                          // TUriParser16
    40 #include <data_caging_path_literals.hrh>    // KDC_MTM_RESOURCE_DIR
    40 #include <data_caging_path_literals.hrh>    // KDC_MTM_RESOURCE_DIR
    41 #include <uriutils.h>                       // UriUtils and so on
    41 #include <uriutils.h>                       // UriUtils and so on
    42 #include <pushmtmui.rsg>                    // for R_PUSHMISC_UNK_SENDER
    42 #include <RoHandler.rsg>                    // for R_QTN_DRM_MGR_INB_TITLE
    43 #include <rohandler.rsg>                    // for R_QTN_DRM_MGR_INB_TITLE
       
    44 #include <sysutil.h>                        // Disk space checking
    43 #include <sysutil.h>                        // Disk space checking
    45 
    44 
    46 #include "crohandler.h"
    45 #include "CRoHandler.h"
    47 #include "romtmcli.h"                       // for CRightsObjectMtmClient
    46 #include "RoMtmCli.h"                       // for CRightsObjectMtmClient
    48 #include "roapsyncwrapper.h"
    47 #include "RoapSyncWrapper.h"
    49 
    48 
    50 #include "stringresourcereader.h"
    49 #include "StringResourceReader.h"
    51 #include "rohandlerdmgrwrapper.h"
    50 #include "rohandlerdmgrwrapper.h"
    52 #include "rohandlerinternalcrkeys.h"
    51 #include "rohandlerinternalcrkeys.h"
    53 
    52 
    54 #ifdef _DEBUG
    53 #ifdef _DEBUG
    55 #define DRMDEBUGLIT( a, b ) _LIT( a, b )
    54 #define DRMDEBUGLIT( a, b ) _LIT( a, b )
   112 _LIT( KFalse, "false" );
   111 _LIT( KFalse, "false" );
   113 _LIT( KZero, "0" );
   112 _LIT( KZero, "0" );
   114 
   113 
   115 _LIT( KRoAcquisitionPrefix, "ROA:" );
   114 _LIT( KRoAcquisitionPrefix, "ROA:" );
   116 _LIT( KTriggerPrefix, "TRI:" );
   115 _LIT( KTriggerPrefix, "TRI:" );
       
   116 
       
   117 _LIT( KEmpty, " " );
   117 
   118 
   118 // MODULE DATA STRUCTURES
   119 // MODULE DATA STRUCTURES
   119 
   120 
   120 // Helper class for deleting file with given filename on cleanupstack
   121 // Helper class for deleting file with given filename on cleanupstack
   121 // Note does not own its members
   122 // Note does not own its members
   713 #endif
   714 #endif
   714 
   715 
   715     HBufC16 *number( NULL );
   716     HBufC16 *number( NULL );
   716     HBufC16 *messageContent( NULL );
   717     HBufC16 *messageContent( NULL );
   717     HBufC16* buffer( NULL );
   718     HBufC16* buffer( NULL );
       
   719     _LIT( KMarker, "\x00" );
   718 
   720 
   719     TInt ret( 0 );
   721     TInt ret( 0 );
   720     if ( iMessageBodyPtr.Size() == 0 )
   722     if ( iMessageBodyPtr.Size() == 0 )
   721         {
   723         {
   722         User::Leave( KErrCorrupt );
   724         User::Leave( KErrCorrupt );
   769 
   771 
   770         number = HBufC16::NewLC( 11 ); //longer than max of tuint32
   772         number = HBufC16::NewLC( 11 ); //longer than max of tuint32
   771         TPtr ptr( number->Des() );
   773         TPtr ptr( number->Des() );
   772         ptr.AppendNum( localId, EDecimal );
   774         ptr.AppendNum( localId, EDecimal );
   773 
   775 
   774         messageContent = HBufC16::NewL( ptr.Length() + uri16.Length() + 4 );
   776         messageContent = HBufC16::NewL( ptr.Length() + uri16.Length() + 5 );
   775         TPtr ptrToMz( messageContent->Des() );
   777         TPtr ptrToMz( messageContent->Des() );
   776         ptrToMz.Append( _L( "1 " ) );
   778         ptrToMz.Append( _L( "1" ) );
       
   779         ptrToMz.Append( KMarker );
   777         ptrToMz.Append( ptr ); // add localID
   780         ptrToMz.Append( ptr ); // add localID
   778         ptrToMz.Append( _L( " " ) ); // add space
   781         ptrToMz.Append( KMarker );
   779         ptrToMz.Append( uri16 ); //add uri16
   782         ptrToMz.Append( uri16 ); //add uri16
       
   783         ptrToMz.Append( KMarker );
   780 
   784 
   781         CleanupStack::PopAndDestroy( number );
   785         CleanupStack::PopAndDestroy( number );
   782         CleanupStack::PopAndDestroy( buffer );
   786         CleanupStack::PopAndDestroy( buffer );
   783         CleanupStack::PushL( messageContent );
   787         CleanupStack::PushL( messageContent );
   784 
   788 
  1214     HBufC* result( NULL );
  1218     HBufC* result( NULL );
  1215 
  1219 
  1216     // First line in Inbox: TMsvEntry::iDetails.
  1220     // First line in Inbox: TMsvEntry::iDetails.
  1217     if ( !flag || srvAddress.Length() == 0 )
  1221     if ( !flag || srvAddress.Length() == 0 )
  1218         {
  1222         {
  1219         // Read from resource.
  1223         result = KEmpty().AllocL();
  1220 
       
  1221 #ifndef RD_MULTIPLE_DRIVE
       
  1222 
       
  1223         TFileName resourceFile( KDriveZ );
       
  1224 
       
  1225 #else //RD_MULTIPLE_DRIVE
       
  1226 
       
  1227         _LIT( KDriveRoot, "%c:" );
       
  1228         TInt driveNumber( -1 );
       
  1229         TChar driveLetter;
       
  1230         DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber );
       
  1231         iFs.DriveToChar( driveNumber, driveLetter );
       
  1232 
       
  1233         TFileName resourceFile;
       
  1234         resourceFile.Format( KDriveRoot, (TUint )driveLetter );
       
  1235 
       
  1236 #endif
       
  1237 
       
  1238         resourceFile.Append( KDC_MTM_RESOURCE_DIR );
       
  1239         resourceFile.Append( KPushMtmRes );
       
  1240         ReadFromResourceLC( resourceFile, R_PUSHMISC_UNK_SENDER, result );
       
  1241         }
  1224         }
  1242     else
  1225     else
  1243         {
  1226         {
  1244         // Convert the "From" information to the format required by the UI
  1227         // Convert the "From" information to the format required by the UI
  1245         // spec and then decode it.
  1228         // spec and then decode it.