当前位置: 首页>>代码示例>>C++>>正文


C++ CMsgConn::GetCryptoFlag方法代码示例

本文整理汇总了C++中CMsgConn::GetCryptoFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ CMsgConn::GetCryptoFlag方法的具体用法?C++ CMsgConn::GetCryptoFlag怎么用?C++ CMsgConn::GetCryptoFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CMsgConn的用法示例。


在下文中一共展示了CMsgConn::GetCryptoFlag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BroadcastClientMsgData

void CImUser::BroadcastClientMsgData(CImPdu* pPdu, uint32_t msg_id, string msg_data, CMsgConn* pFromConn, uint32_t from_id)
{
    IM::Message::IMMsgData msg;
    CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));

    for (map<uint32_t, CMsgConn*>::iterator it = m_conn_map.begin(); it != m_conn_map.end(); it++)
    {
        CMsgConn* pConn = it->second;
        if (pConn != NULL && pConn != pFromConn) {
            if (pConn->GetCryptoFlag() == 1)
            {
                string tmp_msg_data = msg_data;
                if (pConn->EncryptMsgData(tmp_msg_data) == 0)
                {
                    //log("BroadcastClientMsgData, from %u to %u data: %s", from_id, pConn->GetUserId(), tmp_msg_data.c_str()); //debug crypto
                    msg.set_crypto_flag(1);
                    msg.set_msg_data(tmp_msg_data);
                    pPdu->SetPBMsg(&msg);
                }
            }
            pConn->SendPdu(pPdu);
            pConn->AddToSendList(msg_id, from_id);
        }
    }
}
开发者ID:ryanspeng,项目名称:yxim,代码行数:25,代码来源:ImUser.cpp

示例2: _HandleGetMsgByIdResponse

void CDBServConn::_HandleGetMsgByIdResponse(CImPdu *pPdu)
{
    IM::Message::IMGetMsgByIdRsp msg;
    CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));
    
    uint32_t user_id = msg.user_id();
    uint32_t session_type = msg.session_type();
    uint32_t session_id = msg.session_id();
    uint32_t msg_cnt = msg.msg_list_size();
    CDbAttachData attach_data((uchar_t*)msg.attach_data().c_str(), msg.attach_data().length());
    uint32_t handle = attach_data.GetHandle();
    
    log("HandleGetMsgByIdResponse, userId=%u, session_type=%u, opposite_user_id=%u, cnt=%u.", user_id, session_type, session_id, msg_cnt);
    
    CMsgConn* pMsgConn = CImUserManager::GetInstance()->GetMsgConnByHandle(user_id, handle);
    if (pMsgConn && pMsgConn->IsOpen()) {
        if (pMsgConn->GetCryptoFlag() == 1)
        {
            for (int i=0; i < msg_cnt; i++)
            {
                IM::BaseDefine::MsgInfo* pMsg = msg.mutable_msg_list(i);
                string msg_data = (string)pMsg->msg_data();
                pMsgConn->EncryptMsgData(msg_data);
                //log("HandleGetMsgByIdRepsone, %u->%u data: %s", user_id, session_id, msg_data.c_str()); //debug crypto
                pMsg->set_msg_data(msg_data);
            }
        }
        msg.clear_attach_data();
        pPdu->SetPBMsg(&msg);
        pMsgConn->SendPdu(pPdu);
    }
}
开发者ID:ryanspeng,项目名称:yxim,代码行数:32,代码来源:DBServConn.cpp

示例3: _HandleUnreadMsgCountResponse

void CDBServConn::_HandleUnreadMsgCountResponse(CImPdu* pPdu)
{
    IM::Message::IMUnreadMsgCntRsp msg;
    CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));

    uint32_t user_id = msg.user_id();
    uint32_t total_cnt = msg.total_cnt();
    uint32_t user_unread_cnt = msg.unreadinfo_list_size();
    CDbAttachData attach_data((uchar_t*)msg.attach_data().c_str(), msg.attach_data().length());
    uint32_t handle = attach_data.GetHandle();
	
    log("HandleUnreadMsgCntResp, userId=%u, total_cnt=%u, user_unread_cnt=%u.", user_id,
        total_cnt, user_unread_cnt);

    CMsgConn* pMsgConn = CImUserManager::GetInstance()->GetMsgConnByHandle(user_id, handle);

    if (pMsgConn && pMsgConn->IsOpen()) {
        if (pMsgConn->GetCryptoFlag() == 1)
        {
            for (int i=0; i < user_unread_cnt; i++)
            {
                IM::BaseDefine::UnreadInfo* pInfo = msg.mutable_unreadinfo_list(i);
                string msg_data = (string)pInfo->latest_msg_data();
                pMsgConn->EncryptMsgData(msg_data);
                //log("HandleUnreadMsgCntResp, %u data: %s", user_id, msg_data.c_str());  //debug crypto
                pInfo->set_latest_msg_data(msg_data);
            }
        }
        msg.clear_attach_data();
        pPdu->SetPBMsg(&msg);
        pMsgConn->SendPdu(pPdu);
    }
}
开发者ID:ryanspeng,项目名称:yxim,代码行数:33,代码来源:DBServConn.cpp

示例4: _HandleRecentSessionResponse

void CDBServConn::_HandleRecentSessionResponse(CImPdu *pPdu)
{
    IM::Buddy::IMRecentContactSessionRsp msg;
    CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));
    uint32_t user_id = msg.user_id();
    uint32_t session_cnt = msg.contact_session_list_size();
    CDbAttachData attach_data((uchar_t*)msg.attach_data().c_str(), msg.attach_data().length());
    uint32_t handle = attach_data.GetHandle();
    
    log("HandleRecentSessionResponse, userId=%u, session_cnt=%u", user_id, session_cnt);
    
    CMsgConn* pMsgConn = CImUserManager::GetInstance()->GetMsgConnByHandle(user_id, handle);
    if (pMsgConn && pMsgConn->IsOpen())
    {
        if (pMsgConn->GetCryptoFlag() == 1)
        {
            for (int i=0; i < session_cnt; i++)
            {
                IM::BaseDefine::ContactSessionInfo* pInfo = msg.mutable_contact_session_list(i);
                string msg_data = (string)pInfo->latest_msg_data();
                pMsgConn->EncryptMsgData(msg_data);
                //log("HandleRecentSessionResponse, %u data: %s", user_id, msg_data.c_str()); //debug crypto
                pInfo->set_latest_msg_data(msg_data);
            }
        }
        msg.clear_attach_data();
        pPdu->SetPBMsg(&msg);
        pMsgConn->SendPdu(pPdu);
    }
}
开发者ID:ryanspeng,项目名称:yxim,代码行数:30,代码来源:DBServConn.cpp


注:本文中的CMsgConn::GetCryptoFlag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。