本文整理汇总了C++中CImUser::GetClientTypeFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ CImUser::GetClientTypeFlag方法的具体用法?C++ CImUser::GetClientTypeFlag怎么用?C++ CImUser::GetClientTypeFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CImUser
的用法示例。
在下文中一共展示了CImUser::GetClientTypeFlag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleClientFileRequest
void CFileHandler::HandleClientFileRequest(CMsgConn* pMsgConn, CImPduClientFileRequest* pPdu)
{
string from_id_url(pPdu->GetFromId(), pPdu->GetFromIdLen());
uint32_t from_id = urltoid(from_id_url.c_str());
string to_id_url(pPdu->GetToId(), pPdu->GetToIdLen());
uint32_t to_id = urltoid(to_id_url.c_str());
string file_name(pPdu->GetFileName(), pPdu->GetFileNameLen());
uint32_t file_size = pPdu->GetFileSize();
log("HandleClientFileRequest, %u->%u, fileName: %s\n", from_id, to_id, file_name.c_str());
CPduAttachData attach(ATTACH_TYPE_HANDLE, pMsgConn->GetHandle(), 0, NULL, 0);
CImUser* pUser = CImUserManager::GetInstance()->GetImUserById(to_id);
if (pUser)
{
uint32_t client_type_flag = pUser->GetClientTypeFlag();
//to_user has pc_client in this msg_server
if ((client_type_flag & CLIENT_TYPE_FLAG_BOTH) == CLIENT_TYPE_FLAG_PC)
{
CFileServConn* pFileConn = get_random_file_serv_conn();
if (pFileConn)
{
CImPduMsgFileTransferReq pdu(from_id, to_id, file_name.c_str(), file_size,
FILE_TYPE_ONLINE, attach.GetLength(), attach.GetBuffer());
pdu.SetReserved(pPdu->GetReserved());
pFileConn->SendPdu(&pdu);
}
else
{
log("HandleClientFileRequest, no file server.\n");
CImPduClientFileResponse pdu2(REFUSE_REASON_NO_FILE_SERVER, from_id_url.c_str(),
to_id_url.c_str(), file_name.c_str(), NULL, NULL, 0);
pdu2.SetReserved(pPdu->GetReserved());
pMsgConn->SendPdu(&pdu2);
}
return;
}
}
else
{
//no pc_client in this msg_server, check it from route_server
CRouteServConn* pConn = get_route_serv_conn();
CPduAttachData pduAttachData(ATTACH_TYPE_HANDLE_AND_PDU, pMsgConn->GetHandle(),
pPdu->GetLength(), pPdu->GetBuffer());
CImPduUserClientTypeRequest pdu3(to_id, pduAttachData.GetLength(), pduAttachData.GetBuffer());
pdu3.SetReserved(pPdu->GetReserved());
pConn->SendPdu(&pdu3);
}
}