This commit is contained in:
aozhiwei 2020-06-17 14:17:23 +08:00
parent 1675abc106
commit b75f26ffce
4 changed files with 16 additions and 3 deletions

View File

@ -107,9 +107,7 @@ void Player::_CMUpdateTempCustomData(f8::MsgHdr& hdr, const cs::CMUpdateTempCust
void Player::_CMFriendList(f8::MsgHdr& hdr, const cs::CMFriendList& msg)
{
cs::SMFriendList respmsg;
FillFriendList(respmsg.mutable_friend_list());
SendMsg(respmsg);
PushFriendList();
}
void Player::_CMFriendApply(f8::MsgHdr& hdr, const cs::CMFriendApply& msg)
@ -396,6 +394,11 @@ void Player::ReLogin(f8::MsgHdr& hdr, const cs::CMLogin& msg)
void Player::FillFriendList(::google::protobuf::RepeatedPtrField< ::cs::MFUserInfo >* friend_list)
{
{
auto p = friend_list->Add();
TypeConvert::Convert(data.base_data, *(p->mutable_base_data()));
TypeConvert::Convert(data.temp_custom_data, *(p->mutable_temp_custom_data()));
}
for (auto& pair : friend_hash_) {
auto p = friend_list->Add();
TypeConvert::Convert(pair.second.base_data, *(p->mutable_base_data()));
@ -629,3 +632,10 @@ void Player::NotifyUserInfoUpdate(Friend* friend_data)
TypeConvert::Convert(friend_data->temp_custom_data, *p->mutable_temp_custom_data());
SendMsg(msg);
}
void Player::PushFriendList()
{
cs::SMFriendList respmsg;
FillFriendList(respmsg.mutable_friend_list());
SendMsg(respmsg);
}

View File

@ -92,6 +92,7 @@ class Player
void NotifyOnline();
void NotifyOffline();
void NotifyUserInfoUpdate(Friend* friend_data);
void PushFriendList();
const std::string AccountId();

View File

@ -371,6 +371,7 @@ void PlayerMgr::AsyncLoginOnOk(const std::string& account_id,
respmsg.set_errcode(0);
respmsg.set_errmsg("ok");
hum->SendMsg(respmsg);
hum->PushFriendList();
}
f8::MsgHdr::Destroy(hdr);
}

View File

@ -66,6 +66,7 @@ class VirtualClient(object):
def sendLogin(self, conn):
msg = cs_proto_pb2.CMLogin()
msg.account_id = self.account
msg.nickname = '萤火虫'
self.sendMsg(conn, msg)
def parsePacket(self, conn, recv_buf):