messagingapp/msgappfw/server/src/ccsconversationcachehelper.cpp
changeset 34 84197e66a4bd
parent 31 ebfee66fde93
child 43 35b64624a9e7
equal deleted inserted replaced
31:ebfee66fde93 34:84197e66a4bd
   521                     CleanupStack::PopAndDestroy(clientConv);
   521                     CleanupStack::PopAndDestroy(clientConv);
   522                 }
   522                 }
   523             }
   523             }
   524 
   524 
   525             // Notify client of conversation change
   525             // Notify client of conversation change
   526             if (!conversation->IsDeleted())
   526             CCsClientConversation
   527             {
   527                     * clientConv =
   528                 CCsClientConversation
   528                             iConversationCache->CreateClientConvLC(conversation,
   529                         * clientConv =
   529                                                                    aConversationEntry);
   530                                 iConversationCache->CreateClientConvLC(conversation,
   530             iConversationCache->NotifyL(clientConv,
   531                                                                        aConversationEntry);
   531                                         KConversationEventDelete);
   532                 iConversationCache->NotifyL(clientConv,
   532             CleanupStack::PopAndDestroy(clientConv);
   533                                             KConversationEventDelete);
       
   534                 CleanupStack::PopAndDestroy(clientConv);
       
   535             }
       
   536 
       
   537             // check if all entries are deleted then 
   533             // check if all entries are deleted then 
   538             // delete the conversation from cache
   534             // delete the conversation from cache
   539             if (conversation->GetEntryCount() == 0
   535             if (conversation->GetEntryCount() == 0
   540                     && !conversation->IsSpecialConversation())
   536                     && !conversation->IsSpecialConversation())
   541             {
   537             {
   542                 conversationList->Remove(loop);
   538             
   543                 delete conversation;
   539             conversationList->Remove(loop);
   544                 //reset the counters
   540             delete conversation;
   545                 loop -= 1;
   541             //reset the counters
       
   542             loop -= 1;
   546             }
   543             }
   547 
   544 
   548             // Stop searching    
   545             // Stop searching    
   549             if (stopOnFirstMatch) break;
   546             if (stopOnFirstMatch) break;
   550         }
   547         }
   596         clientConv->GetConversationEntry()->
   593         clientConv->GetConversationEntry()->
   597         ChangeAttributes(ECsAttributeNewEntryAdded,ECsAttributeNone);
   594         ChangeAttributes(ECsAttributeNewEntryAdded,ECsAttributeNone);
   598         }
   595         }
   599 
   596 
   600     iConversationCache->NotifyL(clientConv, KConversationListEventNew);
   597     iConversationCache->NotifyL(clientConv, KConversationListEventNew);
       
   598     // send the new conversation event as well, so that if there are nay listeners for the cv
       
   599     // then they will get the notification.
       
   600     iConversationCache->NotifyL(clientConv, KConversationEventNew);
   601     CleanupStack::PopAndDestroy(clientConv);
   601     CleanupStack::PopAndDestroy(clientConv);
   602 
   602 
   603     CleanupStack::Pop(conversation);
   603     CleanupStack::Pop(conversation);
   604 
   604 
   605     PRINT ( _L("CCsConversationCacheHelper::AddNewConversationL - Conversation Added") );
   605     PRINT ( _L("CCsConversationCacheHelper::AddNewConversationL - Conversation Added") );