BOOL SessionLayout::_DisplayUnreadMsg()
{
	SessionMessage_List msgList;
	if (!ReceiveMsgManage::getInstance()->popMessagesBySId(m_sId, msgList) && msgList.empty())
	{
		//没有未读消息
		return FALSE;
	}

	for (auto MessageInfo : msgList)
	{
        if (MESSAGE_RENDERTYPE_SYSTEMTIPS != MessageInfo.msgRenderType)
        {
            DECRYPT_MSG(MessageInfo.content, MessageInfo.content);
        }
		_DisplayMsgToIE(MessageInfo);
	}

	//保存到历史消息中
	module::getDatabaseModule()->sqlBatchInsertMessage(msgList);
	//离线消息需要重置获取历史消息的msgid
	MessageEntity msgFront = msgList.front();
	module::getMessageModule()->setSessionTopMsgId(msgFront.sessionId, msgFront.msgId -1);
	
    //更新总未读计数
    module::getSessionModule()->asynNotifyObserver(module::KEY_SESSION_UPDATE_TOTAL_UNREADMSG_COUNT);

	//发送已读确认
	auto msgBack = msgList.back();
	_AsynSendReadAck(msgBack);
	return TRUE;
}
示例#2
0
BOOL ReceiveMsgManage::frontMessageBySId(const std::string& sId, MessageEntity& msg)
{
	CAutoLock lock(&m_lock);
	SessionMessage_List* listChatMsg = _getChatMsgListBySID(sId);
	if (listChatMsg && !listChatMsg->empty())
	{
		msg = listChatMsg->back();
		return TRUE;
	}

	return FALSE;
}