Exemplo n.º 1
0
void LoginModule_Impl::notifyLoginDone()
{
	imcore::IMLibCoreStartOperationWithLambda(
		[]
	{
		//鑾峰彇閮ㄩ棬淇℃伅
		UInt32 lastTime = module::getSysConfigModule()->getDepartmentInfoLatestUpdateTime();
		IM::Buddy::IMDepartmentReq imDepartmentReq;
		imDepartmentReq.set_user_id(module::getSysConfigModule()->userId());
		imDepartmentReq.set_latest_update_time(lastTime);
		module::getTcpClientModule()->sendPacket(IM::BaseDefine::ServiceID::SID_BUDDY_LIST
			, IM::BaseDefine::BuddyListCmdID::CID_BUDDY_LIST_DEPARTMENT_REQUEST
			, &imDepartmentReq);
		LOG__(APP, _T("IMDepartmentReq,latest update time :%d"), lastTime);

		//澧為噺鑾峰彇鎵�鏈変汉淇℃伅
		lastTime = module::getSysConfigModule()->getUserInfoLatestUpdateTime();//鑾峰彇鏈�鍚庝竴娆℃洿鏂颁汉鍛樹俊鎭殑鏃堕棿
		IM::Buddy::IMAllUserReq imAllUserReq;
		imAllUserReq.set_user_id(module::getSysConfigModule()->userId());
		imAllUserReq.set_latest_update_time(lastTime);
		module::getTcpClientModule()->sendPacket(IM::BaseDefine::ServiceID::SID_BUDDY_LIST
			, IM::BaseDefine::BuddyListCmdID::CID_BUDDY_LIST_ALL_USER_REQUEST
			,&imAllUserReq);
		LOG__(APP, _T("IMAllUserReq,latest update time :%d"), lastTime);

		//澧為噺鑾峰彇缇ゅ垪琛�
		IM::Group::IMNormalGroupListReq imNormalGroupListReq;
		imNormalGroupListReq.set_user_id(module::getSysConfigModule()->userId());
		module::getTcpClientModule()->sendPacket(IM::BaseDefine::ServiceID::SID_GROUP
			, IM::BaseDefine::GroupCmdID::CID_GROUP_NORMAL_LIST_REQUEST
			, &imNormalGroupListReq);
		LOG__(APP, _T("IMNormalGroupListReq"));
	});
}
Exemplo n.º 2
0
uint32_t ClientConn::getDepartMentInfo(uint32_t nUserId , uint32_t nLastTime)
{
	CImPdu cPdu;
    IM::Buddy::IMDepartmentReq msg;
    msg.set_user_id(nUserId);
    msg.set_latest_update_time(nLastTime);
	

    cPdu.SetPBMsg(&msg);
    cPdu.SetServiceId(IM::BaseDefine::SID_BUDDY_LIST);
    cPdu.SetCommandId( IM::BaseDefine::CID_BUDDY_LIST_DEPARTMENT_REQUEST);
    uint32_t nSeqNo = m_pSeqAlloctor->getSeq(ALLOCTOR_PACKET);
    cPdu.SetSeqNum(nSeqNo);
    SendPdu(&cPdu);

    return nSeqNo;

}
Exemplo n.º 3
0
void getChgedDepart(CImPdu* pPdu, uint32_t conn_uuid)
{
    IM::Buddy::IMDepartmentReq msg;
    IM::Buddy::IMDepartmentRsp msgResp;
    if (msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength())) {

        CImPdu* pPduRes = new CImPdu;

        uint32_t nUserId = msg.user_id();
        uint32_t nLastUpdate = msg.latest_update_time();
        list<uint32_t> lsChangedIds;
        CDepartModel::getInstance()->getChgedDeptId(nLastUpdate, lsChangedIds);
        list<IM::BaseDefine::DepartInfo> lsDeparts;
        CDepartModel::getInstance()->getDepts(lsChangedIds, lsDeparts);

        msgResp.set_user_id(nUserId);
        msgResp.set_latest_update_time(nLastUpdate);
        for(auto it=lsDeparts.begin(); it!=lsDeparts.end(); ++it)
        {
            IM::BaseDefine::DepartInfo* pDeptInfo = msgResp.add_dept_list();
            pDeptInfo->set_dept_id(it->dept_id());
            pDeptInfo->set_priority(it->priority());
            pDeptInfo->set_dept_name(it->dept_name());
            pDeptInfo->set_parent_dept_id(it->parent_dept_id());
            pDeptInfo->set_dept_status(it->dept_status());
        }
        log("userId=%u, last_update=%u, cnt=%u", nUserId, nLastUpdate, lsDeparts.size());
        msgResp.set_attach_data(msg.attach_data());
        pPduRes->SetPBMsg(&msgResp);
        pPduRes->SetSeqNum(pPdu->GetSeqNum());
        pPduRes->SetServiceId(IM::BaseDefine::SID_BUDDY_LIST);
        pPduRes->SetCommandId(IM::BaseDefine::CID_BUDDY_LIST_DEPARTMENT_RESPONSE);
        CProxyConn::AddResponsePdu(conn_uuid, pPduRes);

    }
    else
    {
        log("parse pb failed");
    }
}