Пример #1
0
void CGroupChat::HandleGroupNormalResponse(CImPdu* pPdu)
{
    IM::Group::IMNormalGroupListRsp msg;
    CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));

    uint32_t user_id = msg.user_id();
    uint32_t group_cnt = msg.group_version_list_size();
    CDbAttachData attach_data((uchar_t*)msg.attach_data().c_str(), msg.attach_data().length());

    log("HandleGroupNormalResponse, user_id=%u, group_cnt=%u. ", user_id, group_cnt);

    msg.clear_attach_data();
    pPdu->SetPBMsg(&msg);
    CMsgConn* pConn = CImUserManager::GetInstance()->GetMsgConnByHandle(user_id, attach_data.GetHandle());
    if (pConn)
    {
        pConn->SendPdu(pPdu);
    }
}
Пример #2
0
void ClientConn::_HandleGroupList(CImPdu *pPdu)
{
	IM::Group::IMNormalGroupListRsp msgResp;
	uint32_t nSeqNo = pPdu->GetSeqNum();
	    if(msgResp.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()))
    {
		uint32_t nUserId = msgResp.user_id();
        list<IM::BaseDefine::GroupVersionInfo> lsGroupVersionInfo;
		int Cnt = msgResp.group_version_list_size();
        for (uint32_t i=0; i<Cnt; ++i) {
            IM::BaseDefine::GroupVersionInfo groupVersionInfo = msgResp.group_version_list(i);
            lsGroupVersionInfo.push_back(groupVersionInfo);
        }
        m_pCallback->onGroupList(nSeqNo,  nUserId , lsGroupVersionInfo);
    }
    else
    {
        m_pCallback->onError(nSeqNo, pPdu->GetCommandId(), "parse pb error");
    }
}