void SessionLayout::_AsynSendReadAck(IN MessageEntity& msg) { if (MESSAGE_RENDERTYPE_SYSTEMTIPS == msg.msgRenderType || MESSAGE_RENDERTYPE_FILETRANSFER == msg.msgRenderType) { LOG__(APP, _T("not send read ack msgRenderType:%d"),msg.msgRenderType); return; } if (MESSAGE_TYPE_HISTORY == msg.msgStatusType || MESSAGE_TYPE_NONE == msg.msgStatusType) { LOG__(APP, _T("Not runtime or offline msgStatusType:%d,msgId:%d"), msg.msgStatusType,msg.msgId); return; } imcore::IMLibCoreStartOperationWithLambda( [=]()mutable { std::string OriginSessionId = msg.getOriginSessionId(); IM::Message::IMMsgDataReadAck imMsgDataReadAck; imMsgDataReadAck.set_user_id(module::getSysConfigModule()->userId()); imMsgDataReadAck.set_session_id(util::stringToInt32(OriginSessionId)); imMsgDataReadAck.set_msg_id(msg.msgId); imMsgDataReadAck.set_session_type(static_cast<IM::BaseDefine::SessionType>(msg.msgSessionType)); module::getTcpClientModule()->sendPacket(IM::BaseDefine::SID_MSG, IM::BaseDefine::CID_MSG_READ_ACK, &imMsgDataReadAck); },0, imcore::OPERATION_NAME_MSG_READ_ACK ); }
uint32_t ClientConn::sendMsgReadAck(uint32_t nUserId, uint32_t nPeerId, IM::BaseDefine::SessionType nType, uint32_t nMsgId) { CImPdu cPdu; IM::Message::IMMsgDataReadAck msg; msg.set_user_id(nUserId); msg.set_session_id(nPeerId); msg.set_session_type(nType); msg.set_msg_id(nMsgId); cPdu.SetPBMsg(&msg); cPdu.SetServiceId(IM::BaseDefine::SID_MSG); cPdu.SetCommandId(IM::BaseDefine::CID_MSG_READ_ACK); uint32_t nSeqNo = m_pSeqAlloctor->getSeq(ALLOCTOR_PACKET); cPdu.SetSeqNum(nSeqNo); SendPdu(&cPdu); return nSeqNo; }
void clearUnreadMsgCounter(CImPdu* pPdu, uint32_t conn_uuid) { IM::Message::IMMsgDataReadAck msg; if(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength())) { uint32_t nUserId = msg.user_id(); uint32_t nFromId = msg.session_id(); IM::BaseDefine::SessionType nSessionType = msg.session_type(); CUserModel::getInstance()->clearUserCounter(nUserId, nFromId, nSessionType); log("userId=%u, peerId=%u, type=%u", nFromId, nUserId, nSessionType); } else { log("parse pb failed"); } }