Exemplo n.º 1
0
// friend online/off-line notify
void CRouteServConn::_HandleStatusNotify(CImPdu* pPdu)
{
	IM::Buddy::IMUserStatNotify msg;
	CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));

	IM::BaseDefine::UserStat user_stat = msg.user_stat();

	log("HandleFriendStatusNotify, user_id=%u, status=%u ", user_stat.user_id(), user_stat.status());

	// send friend online message to client
	//CImUserManager::GetInstance()->BroadcastPdu(pPdu, CLIENT_TYPE_FLAG_PC);

	//send to db
	CDBServConn* pDBConn = get_db_serv_conn();
	//CImUser* pImUser = CImUserManager::GetInstance()->GetImUserById( user_stat.user_id());
	if(pDBConn) //pImUser &&
	{
		IM::Server::IMGetFriendsidReq msgReq;
		msgReq.set_user_id(user_stat.user_id());

		CImPdu dbPdu;

		//CDbAttachData dbAttachData(pPdu->GetBodyData(), pPdu->GetBodyLength());
		//msgReq.set_attach_data(dbAttachData.GetBuffer(), dbAttachData.GetLength());
		msgReq.set_attach_data(pPdu->GetBodyData(), pPdu->GetBodyLength());

		dbPdu.SetPBMsg( &msgReq);
		dbPdu.SetServiceId(DFFX_SID_OTHER);
		dbPdu.SetCommandId(DFFX_CID_OTHER_GETFRIENDSID_REQ);
		dbPdu.SetSeqNum(pPdu->GetSeqNum());

		pDBConn->SendPdu( &dbPdu);
	}
}
Exemplo n.º 2
0
// friend online/off-line notify
void CRouteServConn::_HandleStatusNotify(CImPdu* pPdu)
{
    IM::Buddy::IMUserStatNotify msg;
    CHECK_PB_PARSE_MSG(msg.ParseFromArray(pPdu->GetBodyData(), pPdu->GetBodyLength()));

    IM::BaseDefine::UserStat user_stat = msg.user_stat();

	log("HandleFriendStatusNotify, user_id=%u, status=%u ", user_stat.user_id(), user_stat.status());

	// send friend online message to client
    CImUserManager::GetInstance()->BroadcastPdu(pPdu, CLIENT_TYPE_FLAG_PC);
}