本文整理汇总了C++中CImUser::BroadcastClientMsgData方法的典型用法代码示例。如果您正苦于以下问题:C++ CImUser::BroadcastClientMsgData方法的具体用法?C++ CImUser::BroadcastClientMsgData怎么用?C++ CImUser::BroadcastClientMsgData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CImUser
的用法示例。
在下文中一共展示了CImUser::BroadcastClientMsgData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _HandleMsgData
void CRouteServConn::_HandleMsgData(CImPdu* pPdu)
{
IM::Message::IMMsgData msg;
CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));
if (CHECK_MSG_TYPE_GROUP(msg.msg_type())) {
s_group_chat->HandleGroupMessageBroadcast(pPdu);
return;
}
uint32_t from_user_id = msg.from_user_id();
uint32_t to_user_id = msg.to_session_id();
uint32_t msg_id = msg.msg_id();
log("HandleMsgData, %u->%u, msg_id=%u. ", from_user_id, to_user_id, msg_id);
CImUser* pFromImUser = CImUserManager::GetInstance()->GetImUserById(from_user_id);
if (pFromImUser)
{
pFromImUser->BroadcastClientMsgData(pPdu, msg_id, NULL, from_user_id);
}
CImUser* pToImUser = CImUserManager::GetInstance()->GetImUserById(to_user_id);
if (pToImUser)
{
pToImUser->BroadcastClientMsgData(pPdu, msg_id, NULL, from_user_id);
}
}
示例2: _HandleMsgData
void CRouteServConn::_HandleMsgData(CImPduMsgData* pPdu)
{
uint32_t from_user_id = pPdu->GetFromUserId();
uint32_t to_user_id = pPdu->GetToUserId();
log("HandleMsgData, %u->%u\n", from_user_id, to_user_id);
uint32_t seq_no = pPdu->GetRequestId();
string from_id_url = idtourl(from_user_id);
string to_id_url = idtourl(to_user_id);
uint8_t msg_type = pPdu->GetMsgType();
CImPduClientMsgData pdu(seq_no, from_id_url.c_str(), to_id_url.c_str(), pPdu->GetCreateTime(),
msg_type, pPdu->GetMsgLen(), pPdu->GetMsgData(), pPdu->GetAttachLen(), pPdu->GetAttachData());
CImUser* pFromImUser = CImUserManager::GetInstance()->GetImUserById(from_user_id);
CImUser* pToImUser = CImUserManager::GetInstance()->GetImUserById(to_user_id);
if (pFromImUser) {
pFromImUser->BroadcastClientMsgData(&pdu, NULL, from_user_id);
pFromImUser->AddOnlineFriend(to_user_id); // 聊过天就通知上下线消息
}
if (pToImUser) {
pToImUser->BroadcastClientMsgData(&pdu, NULL, from_user_id);
pToImUser->AddOnlineFriend(from_user_id);
}
}
示例3: _HandleMsgData
void CDBServConn::_HandleMsgData(CImPdu *pPdu)
{
IM::Message::IMMsgData msg;
CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));
if (CHECK_MSG_TYPE_GROUP(msg.msg_type())) {
s_group_chat->HandleGroupMessage(pPdu);
return;
}
uint32_t from_user_id = msg.from_user_id();
uint32_t to_user_id = msg.to_session_id();
uint32_t msg_id = msg.msg_id();
if (msg_id == 0) {
log("HandleMsgData, write db failed, %u->%u.", from_user_id, to_user_id);
return;
}
uint8_t msg_type = msg.msg_type();
CDbAttachData attach_data((uchar_t*)msg.attach_data().c_str(), msg.attach_data().length());
uint32_t handle = attach_data.GetHandle();
log("HandleMsgData, from_user_id=%u, to_user_id=%u, msg_id=%u.", from_user_id, to_user_id, msg_id);
CMsgConn* pMsgConn = CImUserManager::GetInstance()->GetMsgConnByHandle(from_user_id, attach_data.GetHandle());
if (pMsgConn)
{
IM::Message::IMMsgDataAck msg2;
msg2.set_user_id(from_user_id);
msg2.set_msg_id(msg_id);
msg2.set_session_id(to_user_id);
msg2.set_session_type(::IM::BaseDefine::SESSION_TYPE_SINGLE);
pMsgConn->SendPdu(SID_MSG, CID_MSG_DATA_ACK, msg2);
}
CRouteServConn* pRouteConn = get_route_serv_conn();
if (pRouteConn) {
pRouteConn->SendPdu(pPdu);
}
msg.clear_attach_data();
pPdu->SetPBMsg(&msg);
CImUser* pFromImUser = CImUserManager::GetInstance()->GetImUserById(from_user_id);
CImUser* pToImUser = CImUserManager::GetInstance()->GetImUserById(to_user_id);
pPdu->SetSeqNum(0);
if (pFromImUser) {
pFromImUser->BroadcastClientMsgData(pPdu, msg_id, pMsgConn, from_user_id);
}
if (pToImUser) {
pToImUser->BroadcastClientMsgData(pPdu, msg_id, NULL, from_user_id);
}
IM::Server::IMGetDeviceTokenReq msg3;
msg3.add_user_id(to_user_id);
msg3.set_attach_data(pPdu->GetBodyData(), pPdu->GetBodyLength());
SendPdu(SID_OTHER, CID_OTHER_GET_DEVICE_TOKEN_REQ, msg3);
}