harvester/blacklistclient/src/blacklistclient.cpp
branchRCL_3
changeset 10 ab88d4a85041
parent 9 82c0024438c8
child 12 9f21bab39f42
equal deleted inserted replaced
9:82c0024438c8 10:ab88d4a85041
    41     
    41     
    42     RSessionBase::Close(); 
    42     RSessionBase::Close(); 
    43     iBlacklistMemoryTable.ResetAndDestroy();
    43     iBlacklistMemoryTable.ResetAndDestroy();
    44     iBlacklistMemoryTable.Close();
    44     iBlacklistMemoryTable.Close();
    45 	iBlacklistChunk.Close();
    45 	iBlacklistChunk.Close();
       
    46 	iFs.Close();
    46 
    47 
    47     WRITELOG( "RBlacklistClient::~RBlacklistClient - end" );
    48     WRITELOG( "RBlacklistClient::~RBlacklistClient - end" );
    48     }
    49     }
    49 
    50 
    50 // ---------------------------------------------------------------------------
    51 // ---------------------------------------------------------------------------
    54 EXPORT_C TInt RBlacklistClient::Connect()
    55 EXPORT_C TInt RBlacklistClient::Connect()
    55     {
    56     {
    56     WRITELOG( "RBlacklistClient::Connect - begin" );
    57     WRITELOG( "RBlacklistClient::Connect - begin" );
    57 
    58 
    58     iSessionOk = EFalse;
    59     iSessionOk = EFalse;
       
    60     
       
    61     TInt error = iFs.Connect();
       
    62     
       
    63     if( error != KErrNone )
       
    64         {
       
    65         return error;
       
    66         }
    59       
    67       
    60     TInt error = StartServer();
    68     error = StartServer();
    61 
    69 
    62     if ( error == KErrNone || error == KErrAlreadyExists )
    70     if ( error == KErrNone || error == KErrAlreadyExists )
    63         {
    71         {
    64         WRITELOG( "RBlacklistClient::Connect() - creating session" );
    72         WRITELOG( "RBlacklistClient::Connect() - creating session" );
    65         error = CreateSession( KBlacklistServerName, Version() );
    73         error = CreateSession( KBlacklistServerName, Version() );
    66         }
    74         }
    67     
    75     
    68     if( error == KErrNone )
    76     if( error == KErrNone )
    69         {
    77         {
    70         iSessionOk = ETrue;
    78         iSessionOk = ETrue;
       
    79         }
       
    80     else
       
    81         {
       
    82         iFs.Close();
    71         }
    83         }
    72     
    84     
    73     WRITELOG( "RBlacklistClient::Connect - end" );
    85     WRITELOG( "RBlacklistClient::Connect - end" );
    74 
    86 
    75     return error;
    87     return error;
   271 
   283 
   272 // ---------------------------------------------------------------------------
   284 // ---------------------------------------------------------------------------
   273 // RBlacklistClient::IsBlacklistedL()
   285 // RBlacklistClient::IsBlacklistedL()
   274 // ---------------------------------------------------------------------------
   286 // ---------------------------------------------------------------------------
   275 //
   287 //
   276 EXPORT_C TBool RBlacklistClient::IsBlacklistedL( const TDesC& aUri, TUint32 aMediaId, TTime aLastModifiedTime )
   288 EXPORT_C TBool RBlacklistClient::IsBlacklistedL( const TDesC& aUri, TUint32 aMediaId, TTime /*aLastModifiedTime*/ )
   277     {
   289     {
   278     WRITELOG( "RBlacklistClient::IsBlacklistedL - begin" );
   290     WRITELOG( "RBlacklistClient::IsBlacklistedL - begin" );
   279 
   291 
       
   292     if ( !iSessionOk )
       
   293         {
       
   294         return EFalse;
       
   295         }
       
   296     
   280     const TInt index = GetListIndex( aUri, aMediaId );
   297     const TInt index = GetListIndex( aUri, aMediaId );
   281     if ( index >= 0 )
   298     if ( index >= 0 )
   282         {
   299         {
       
   300         TEntry entry;
       
   301         const TInt errorcode = iFs.Entry( aUri, entry );
       
   302         
       
   303         if ( errorcode != KErrNone )
       
   304             {
       
   305             return EFalse;
       
   306             }
       
   307         
       
   308         TTime fileLastModified( 0 );
       
   309         fileLastModified = entry.iModified;
       
   310     
   283         TInt64 modified( 0 );
   311         TInt64 modified( 0 );
   284         modified = iBlacklistMemoryTable[index]->Modified();
   312         modified = iBlacklistMemoryTable[index]->Modified();
   285         
   313         
   286         if( modified > 0 )
   314         if( modified > 0 )
   287             {
   315             {
   288             if ( modified == aLastModifiedTime.Int64() )
   316             if ( modified == fileLastModified.Int64() )
   289                 {
   317                 {
   290                 WRITELOG( "RBlacklistClient::IsBlacklistedL - file is blacklisted, modification time is the same" );
   318                 WRITELOG( "RBlacklistClient::IsBlacklistedL - file is blacklisted, modification time is the same" );
   291                 return ETrue;
   319                 return ETrue;
   292                 }
   320                 }
   293             else
   321             else