messagingapp/msgappfw/client/src/ccsrequesthandler.cpp
changeset 52 12db4185673b
parent 44 36f374c67aa8
child 72 6f657153cbc5
equal deleted inserted replaced
44:36f374c67aa8 52:12db4185673b
   230     PRINT( _L("Enter CCSRequestHandler::HandleGetConversationResults") );
   230     PRINT( _L("Enter CCSRequestHandler::HandleGetConversationResults") );
   231 
   231 
   232     TInt error = KErrNone;
   232     TInt error = KErrNone;
   233 
   233 
   234     RPointerArray<CCsConversationEntry> ConversationEntryList;
   234     RPointerArray<CCsConversationEntry> ConversationEntryList;
       
   235     TInt totalConversationCount(0);
       
   236     
   235     // Parse the results
   237     // Parse the results
   236     RDesReadStream resultStream(iConvResultsBuffer->Des());
   238     RDesReadStream resultStream(iConvResultsBuffer->Des());
   237     TInt  conversationEntryCount = 0;
   239     TInt  conversationEntryCount = 0;
   238 
   240 
   239     TRAP(error, resultStream.PushL();
   241     TRAP(error, resultStream.PushL();
   240 
   242 
   241     conversationEntryCount = resultStream.ReadInt32L();
   243     conversationEntryCount = resultStream.ReadInt32L();
       
   244 
       
   245     //Read total conversation count
       
   246    totalConversationCount = resultStream.ReadInt32L();
   242 
   247 
   243     resultStream.Pop());
   248     resultStream.Pop());
   244 
   249 
   245     if(error != KErrNone)
   250     if(error != KErrNone)
   246         {
   251         {
   287     resultStream.Close();
   292     resultStream.Close();
   288 
   293 
   289     // Pass the results to the observer
   294     // Pass the results to the observer
   290     if ( iResultsObserver )
   295     if ( iResultsObserver )
   291         {
   296         {
   292         iResultsObserver->Conversations(ConversationEntryList);
   297         iResultsObserver->Conversations(ConversationEntryList, totalConversationCount);
   293         }
   298         }
   294         
   299         
   295     // cleanup heap data
   300     // cleanup heap data
   296     ConversationEntryList.ResetAndDestroy();
   301     ConversationEntryList.ResetAndDestroy();
   297 
   302 
   703 // CCSRequestHandler::GetConversationsL()
   708 // CCSRequestHandler::GetConversationsL()
   704 // Get Conversation Entry list for given Conversation Entry ID to prepare
   709 // Get Conversation Entry list for given Conversation Entry ID to prepare
   705 // convresation view.
   710 // convresation view.
   706 // -----------------------------------------------------------------------------
   711 // -----------------------------------------------------------------------------
   707 EXPORT_C void CCSRequestHandler::GetConversationsL(
   712 EXPORT_C void CCSRequestHandler::GetConversationsL(
   708         CCsClientConversation*  aClientConversation)
   713         CCsClientConversation*  aClientConversation,
       
   714         TInt aKnownIndex, 
       
   715         TInt aPageSize)
   709     {
   716     {
   710     PRINT( _L("Enter CCSRequestHandler::GetConversationsL") );
   717     PRINT( _L("Enter CCSRequestHandler::GetConversationsL") );
   711 
   718 
   712     // check if the aclientconversation is null then return
   719     // check if the aclientconversation is null then return
   713     if ( aClientConversation == NULL)
   720     if ( aClientConversation == NULL)
   722     CleanupStack::PushL(dataBuf);
   729     CleanupStack::PushL(dataBuf);
   723 
   730 
   724     // Stream over the temp buffer
   731     // Stream over the temp buffer
   725     RBufWriteStream dataStream(*dataBuf);
   732     RBufWriteStream dataStream(*dataBuf);
   726     dataStream.PushL();
   733     dataStream.PushL();
   727 
   734     
       
   735     //Write requested details in buffer.
       
   736     dataStream.WriteInt32L(aKnownIndex);
       
   737     dataStream.WriteInt32L(aPageSize);
       
   738     
   728     // Write the Client Conversation in the stream
   739     // Write the Client Conversation in the stream
   729     aClientConversation->ExternalizeL(dataStream);
   740     aClientConversation->ExternalizeL(dataStream);
   730     dataStream.CommitL();
   741     dataStream.CommitL();
   731     
   742     
   732     //------------------Input Buffer--------------------------
   743     //------------------Input Buffer--------------------------
  1330 }
  1341 }
  1331 
  1342 
  1332 // -----------------------------------------------------------------------------
  1343 // -----------------------------------------------------------------------------
  1333 // CCSRequestHandler::GetMessagingHistoryL()
  1344 // CCSRequestHandler::GetMessagingHistoryL()
  1334 // -----------------------------------------------------------------------------
  1345 // -----------------------------------------------------------------------------
  1335 EXPORT_C void CCSRequestHandler::GetMessagingHistoryL(TInt aContactId)
  1346 EXPORT_C void CCSRequestHandler::GetMessagingHistoryL(TInt aContactId,
       
  1347         TInt aKnownIndex, 
       
  1348         TInt aPageSize)
  1336     {
  1349     {
  1337     TInt conversationId = GetConversationIdL(aContactId);
  1350     TInt conversationId = GetConversationIdL(aContactId);
  1338     if ( conversationId == -1 )
  1351     if ( conversationId == -1 )
  1339         User::Leave(KErrNotFound);
  1352         User::Leave(KErrNotFound);
  1340     
  1353     
  1341     CCsClientConversation* clientConversation = CCsClientConversation::NewL();
  1354     CCsClientConversation* clientConversation = CCsClientConversation::NewL();
  1342     clientConversation->SetConversationEntryId(conversationId);
  1355     clientConversation->SetConversationEntryId(conversationId);
  1343     //set dummy entry
  1356     //set dummy entry
  1344     CCsConversationEntry *entry = CCsConversationEntry::NewL();
  1357     CCsConversationEntry *entry = CCsConversationEntry::NewL();
  1345     clientConversation->SetConversationEntryL(entry);
  1358     clientConversation->SetConversationEntryL(entry);
  1346     GetConversationsL(clientConversation);
  1359     GetConversationsL(clientConversation,aKnownIndex,aPageSize);
  1347     
  1360     
  1348     //delete 
  1361     //delete 
  1349     delete clientConversation;
  1362     delete clientConversation;
  1350     if( entry )
  1363     if( entry )
  1351         delete entry;  
  1364         delete entry;