本文整理汇总了C++中CImUser::BroadcastPdu方法的典型用法代码示例。如果您正苦于以下问题:C++ CImUser::BroadcastPdu方法的具体用法?C++ CImUser::BroadcastPdu怎么用?C++ CImUser::BroadcastPdu使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CImUser
的用法示例。
在下文中一共展示了CImUser::BroadcastPdu方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _HandleClientDelFriendNotify
void CRouteServConn::_HandleClientDelFriendNotify(CImPdu* pPdu)
{
IM::Buddy::IMCommonOperFriendRes msg;
CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));
log(" user_id=%d friend_id=%d.", msg.user_id(), msg.friend_id());
//send to other client
CImUser* pFromImUser = CImUserManager::GetInstance()->GetImUserById(msg.user_id());
if (pFromImUser)
{
pPdu->SetCommandId(DFFX_CID_BUDDY_LIST_DELFRIEND_RES);
pFromImUser->BroadcastPdu(pPdu);
}
// 2.send notify to myfriend
uint32_t to_user_id = msg.friend_id();
CImUser* pToImUser = CImUserManager::GetInstance()->GetImUserById(to_user_id);
if (pToImUser)
{
pPdu->SetCommandId(DFFX_CID_BUDDY_LIST_DELFRIEND_NOTIFY);
pToImUser->BroadcastPdu(pPdu);
}
}
示例2: pdu
void CRouteServConn::_HandleGroupP2PMsg(CImPduGroupP2PMessageResponse* pPdu)
{
uint32_t result = pPdu->GetResult();
uint32_t from_user_id = pPdu->GetReqUserId();
uint32_t* toUserList = pPdu->GetUserList();
log("_HandleGroupP2PMsg, from_user_id = %u, result = %u, to_user_cnt = %u.\n", from_user_id, result, pPdu->GetUserCnt());
if(result != 0 || !toUserList)
return;
for (int i = 0; i < pPdu->GetUserCnt(); ++i) {
uint32_t to_user_id = toUserList[i];
CImUser* pToImUser = CImUserManager::GetInstance()->GetImUserById(to_user_id);
if (pToImUser) {
uint32_t seq_no = 0;
string from_id_url = idtourl(from_user_id);
string to_id_url = idtourl(to_user_id);
CImPduClientP2PCmdMsg pdu(seq_no, from_id_url.c_str(), to_id_url.c_str(), pPdu->GetMsgDataLen(),
pPdu->GetMsgData());
pToImUser->BroadcastPdu(&pdu);
}
}
}
示例3: _HandleFriendStatusNotify
// friend online/off-line notify
void CRouteServConn::_HandleFriendStatusNotify(CImPduFriendStatusNotify* pPdu)
{
uint32_t user_id = pPdu->GetFromUserId();
uint32_t user_status = pPdu->GetFromUserStatus();
uint32_t friend_cnt = pPdu->GetFriendCnt();
uint32_t* friend_id_list = pPdu->GetFriendIdList();
string user_id_url = idtourl(user_id);
log("HandleFriendStatusNotify, from_id=%u, status=%u\n", user_id, user_status);
// send friend online message to client
CImPduClientFriendNotify pdu(user_id_url.c_str(), user_status);
for (uint32_t i = 0; i < friend_cnt; ++i) {
CImUser* pImUser = CImUserManager::GetInstance()->GetImUserById(friend_id_list[i]);
if (pImUser) {
pImUser->BroadcastPdu(&pdu);
if (user_status == USER_STATUS_ONLINE) {
pImUser->AddOnlineFriend(user_id);
} else if (user_status == USER_STATUS_OFFLINE){
pImUser->RemoveOnlineFriend(user_id);
}
}
}
}
示例4: _SendPduToUser
void CGroupChat::_SendPduToUser(CImPdu* pPdu, uint32_t user_id, CMsgConn* pReqConn)
{
if(!pPdu) {
return;
}
CImUser* pToUser = CImUserManager::GetInstance()->GetImUserById(user_id);
if(pToUser) {
pToUser->BroadcastPdu(pPdu, pReqConn);
}
}
示例5:
void CRouteServConn::_HandleP2PMsg(CImPdu* pPdu)
{
IM::SwitchService::IMP2PCmdMsg msg;
CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));
uint32_t from_user_id = msg.from_user_id();
uint32_t to_user_id = msg.to_user_id();
log("HandleP2PMsg, %u->%u ", from_user_id, to_user_id);
CImUser* pFromImUser = CImUserManager::GetInstance()->GetImUserById(from_user_id);
CImUser* pToImUser = CImUserManager::GetInstance()->GetImUserById(to_user_id);
if (pFromImUser) {
pFromImUser->BroadcastPdu(pPdu);
}
if (pToImUser) {
pToImUser->BroadcastPdu(pPdu);
}
}
示例6: _HandleRemoveSessionNotify
void CRouteServConn::_HandleRemoveSessionNotify(CImPdu *pPdu)
{
IM::Buddy::IMRemoveSessionNotify msg;
CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));
uint32_t user_id = msg.user_id();
uint32_t session_id = msg.session_id();
log("HandleRemoveSessionNotify, user_id=%u, session_id=%u ", user_id, session_id);
CImUser* pUser = CImUserManager::GetInstance()->GetImUserById(user_id);
if (pUser)
{
pUser->BroadcastPdu(pPdu);
}
}
示例7: _HandleClientFriendNotifyRequest
void CRouteServConn::_HandleClientFriendNotifyRequest(CImPdu* pPdu)
{
IM::Buddy::IMFriendNotifyReq msg;
CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));
log(" from_user_id=%d to_user_id=%d.", msg.from_user_id(), msg.to_user_id());
uint32_t to_user_id = msg.to_user_id();
CImUser* pToImUser = CImUserManager::GetInstance()->GetImUserById(to_user_id);
if (pToImUser)
{
pToImUser->BroadcastPdu(pPdu);
}
}
示例8: _HandleFriendStatusList
void CRouteServConn::_HandleFriendStatusList(CImPduFriendStatusList* pPdu)
{
uint32_t user_id = pPdu->GetFromUserId();
uint32_t friend_cnt = pPdu->GetFriendCnt();
user_stat_t* friend_status_list = pPdu->GetFriendStatList();
string user_id_url = idtourl(user_id);
log("HandleOnlineFriendList, from_id=%d\n", user_id);
CImUser* pImUser = CImUserManager::GetInstance()->GetImUserById(user_id);
if (!pImUser) {
return;
}
// send online friend status list to client
CImPduClientOnlineFriendList pduCOFL(pPdu->GetRequestType(), friend_cnt, friend_status_list);
pImUser->BroadcastPdu(&pduCOFL);
// user don't need to send self status to friend list
if (pPdu->GetRequestType() == ONLINE_LIST_TYPE_FRIEND_LIST) {
return;
}
// send online friend notify packet to the client in the same message server
CImPduClientFriendNotify pduCFN(user_id_url.c_str(), pImUser->GetIMOnlineStatus());
for (uint32_t i = 0; i < friend_cnt; i++) {
pImUser->AddOnlineFriend(friend_status_list[i].user_id);
CImUser* pFriendUser = CImUserManager::GetInstance()->GetImUserById(friend_status_list[i].user_id);
if (pFriendUser) {
//log("notify %u online to %u\n", user_id, friend_status_list[i].user_id);
pFriendUser->BroadcastPdu(&pduCFN);
pFriendUser->AddOnlineFriend(user_id);
}
}
}
示例9: _HanddleClientOrderStatusReadMsgBraodcast
void CRouteServConn::_HanddleClientOrderStatusReadMsgBraodcast(CImPdu* pPdu)
{
IM::Message::IMOrderStatusRead msg;
CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));
log("CRouteServConn user_id = %d order_id = %d orderlist_is_null = %d", msg.user_id(), msg.order_id(), msg.orderlist_is_null());
//send to other client
CImUser* pFromImUser = CImUserManager::GetInstance()->GetImUserById(msg.user_id());
if (pFromImUser)
{
pFromImUser->BroadcastPdu(pPdu);
}
}
示例10: _HandleDBReverseAddFriendRes
void CRouteServConn::_HandleDBReverseAddFriendRes(CImPdu* pPdu)
{
IM::Buddy::IMCommonOperFriendRes msg;
CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));
log(" user_id=%d friend_id=%d.", msg.user_id(), msg.friend_id());
//send to other client
CImUser* pFromImUser = CImUserManager::GetInstance()->GetImUserById(msg.user_id());
if (pFromImUser)
{
pFromImUser->BroadcastPdu(pPdu);
}
}
示例11: _HandleChangeAvatarResponse
void CDBServConn::_HandleChangeAvatarResponse(CImPdu* pPdu)
{
IM::Buddy::IMChangeAvatarRsp msg;
CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));
uint32_t user_id = msg.user_id();
uint32_t result = msg.result_code();
log("HandleChangeAvatarResp, user_id=%u, result=%u.", user_id, result);
CImUser* pUser = CImUserManager::GetInstance()->GetImUserById(user_id);
if (NULL != pUser) {
msg.clear_attach_data();
pPdu->SetPBMsg(&msg);
pUser->BroadcastPdu(pPdu);
}
}
示例12: _HandleMsgReadNotify
void CRouteServConn::_HandleMsgReadNotify(CImPdu *pPdu)
{
IM::Message::IMMsgDataReadNotify msg;
CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));
uint32_t req_id = msg.user_id();
uint32_t session_id = msg.session_id();
uint32_t msg_id = msg.msg_id();
uint32_t session_type = msg.session_type();
log("HandleMsgReadNotify, user_id=%u, session_id=%u, session_type=%u, msg_id=%u. ", req_id, session_id, session_type, msg_id);
CImUser* pUser = CImUserManager::GetInstance()->GetImUserById(req_id);
if (pUser)
{
pUser->BroadcastPdu(pPdu);
}
}
示例13: HandleFileNotify
void CFileHandler::HandleFileNotify(CImPduFileNotify *pPdu)
{
uint32_t from_user_id = pPdu->GetFromId();
uint32_t to_user_id = pPdu->GetToId();
string file_name(pPdu->GetFileName(), pPdu->GetFileNameLen());
uint32_t file_size = pPdu->GetFileSize();
string task_id(pPdu->GetTaskId(), pPdu->GetTaskIdLen());
string listen_ip(pPdu->GetListenIp(), pPdu->GetListenIpLen());
uint32_t listen_port = pPdu->GetListenPort();
log("HandleFileNotify, from_id: %u, to_id: %u, file_name: %s, task_id: %s, file_server_ip: %s,\
file_server_port: %u.\n", from_user_id, to_user_id, file_name.c_str(), task_id.c_str(),
listen_ip.c_str(), listen_port);
CImUser* pUser = CImUserManager::GetInstance()->GetImUserById(to_user_id);
if (pUser) {
CImPduClientFileNotify pdu(idtourl(from_user_id), idtourl(to_user_id), file_name.c_str(),
file_size, task_id.c_str(), listen_ip.c_str(), listen_port);
pUser->BroadcastPdu(&pdu);
}
}
示例14: BroadcastPdu
void CImUserManager::BroadcastPdu(CImPdu* pdu, uint32_t client_type_flag)
{
CImUser* pImUser = NULL;
for (ImUserMap_t::iterator it = m_im_user_map.begin(); it != m_im_user_map.end(); it++)
{
pImUser = (CImUser*)it->second;
if (pImUser->IsValidate())
{
switch (client_type_flag) {
case CLIENT_TYPE_FLAG_PC:
pImUser->BroadcastPduWithOutMobile(pdu);
break;
case CLIENT_TYPE_FLAG_MOBILE:
pImUser->BroadcastPduToMobile(pdu);
break;
case CLIENT_TYPE_FLAG_BOTH:
pImUser->BroadcastPdu(pdu);
break;
default:
break;
}
}
}
}