imservices/instantmessagingcache/imcacheserver/src/ccacheserveractivehelper.cpp
branchRCL_3
changeset 17 e1ad3c803639
parent 0 e6b17d312c8b
child 18 b6f2a363adf7
equal deleted inserted replaced
16:0b696286a1b2 17:e1ad3c803639
   428         iHeaderArray.Remove(headerIndex);
   428         iHeaderArray.Remove(headerIndex);
   429         if(msgHeader == iActiveHeader)
   429         if(msgHeader == iActiveHeader)
   430             {
   430             {
   431             iActiveHeader = NULL;
   431             iActiveHeader = NULL;
   432             }
   432             }
   433        
   433         // remove the universal indicator notification if there are no more unread messages,
       
   434         // apart form whose conversation is closed. loop through
       
   435         TInt headerCount = iHeaderArray.Count();
       
   436         headerIndex = KErrNotFound;
       
   437         for( TInt i=0; i<  headerCount; i++ )
       
   438             {
       
   439             // note in this case reciepient is own user id 
       
   440             MIMCacheMessageHeader* header = iHeaderArray[i];
       
   441             TRACE(T_LIT( "CCacheServerActiveHelper::PublishMessageInfoL UnreadMessageCount -- %d"), header->UnreadMessageCount());
       
   442             if(  header->ServiceId() == sericeId && header->UnreadMessageCount() )   
       
   443                 {
       
   444                 // this is required in the following scenario
       
   445                 // you receive 10 new messgaes form two parties(5, each)
       
   446                 // whne you close the conversation form one, the universal indicator is still 
       
   447                 // for the other party's messages, and when clicked on universal indicator it should
       
   448                 // open the conversation view wiht the latest user id.
       
   449                 headerIndex = i;
       
   450                 }
       
   451             }
       
   452         // there are new messages received form only one party.
       
   453         // hence the buddyid is required as conversation view will be openend.
       
   454         if(KErrNone == headerIndex)
       
   455             {
       
   456             PublishMessageInfoL(iHeaderArray[headerIndex]->BuddyId(), sericeId);
       
   457             }
       
   458         // new messages are recieved from multiple parties, hence no need of the sender id
       
   459         // as the service tab will be opened.
       
   460         else
       
   461             {
       
   462             PublishMessageInfoL(KNullDesC(), sericeId);
       
   463             }
   434 		PackAndNotifyEventL( EIMOperationChatDeleted, sericeId, msgHeader, NULL ); 
   464 		PackAndNotifyEventL( EIMOperationChatDeleted, sericeId, msgHeader, NULL ); 
   435 		 
   465 		 
   436         delete msgHeader;
   466         delete msgHeader;
   437         iHeaderArray.Compress();  
   467         iHeaderArray.Compress();  
   438        		      
   468        		      
   467             needToNotify = ETrue;
   497             needToNotify = ETrue;
   468             }
   498             }
   469         }
   499         }
   470     if( needToNotify )
   500     if( needToNotify )
   471         {
   501         {
       
   502         // remove the universal indicator notification if there it was displayed,
       
   503         // as when you logout all the ocnversations are removed.
       
   504         PublishMessageInfoL(KNullDesC(), aServiceId);
       
   505         
   472         PackAndNotifyEventL( EIMOperationAllChatDeleted, aServiceId, NULL, NULL ); 
   506         PackAndNotifyEventL( EIMOperationAllChatDeleted, aServiceId, NULL, NULL ); 
   473         }
   507         }
   474     TRACE( T_LIT( "CCacheServerActiveHelper::CloseAllConversationL  End") );
   508     TRACE( T_LIT( "CCacheServerActiveHelper::CloseAllConversationL  End") );
   475     }
   509     }
   476 // ---------------------------------------------------------
   510 // ---------------------------------------------------------