1
This commit is contained in:
parent
c45438fa34
commit
c471082c43
@ -51,14 +51,7 @@ void Player::Deserialize(const ss::MFUserDB& user_db)
|
||||
for (auto& friend_db : user_db.friends()) {
|
||||
Friend* friendobj = new Friend;
|
||||
TypeConvert::Convert(friend_db.base_data(), friendobj->base_data);
|
||||
friendobj->crc32_code = a8::openssl::Crc32
|
||||
(
|
||||
(unsigned char*)friendobj->base_data.account_id.data(),
|
||||
friendobj->base_data.account_id.size()
|
||||
);
|
||||
friendobj->hum = this;
|
||||
friend_hash_[friendobj->base_data.account_id] = friendobj;
|
||||
PlayerMgr::Instance()->WatchPlayer(friendobj);
|
||||
AddFriend(friendobj);
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,15 +233,11 @@ void Player::_CMFriendAgree(f8::MsgHdr& hdr, const cs::CMFriendAgree& msg)
|
||||
}
|
||||
Friend* friendobj = new Friend;
|
||||
TypeConvert::Convert(msg.apply().base_data(), friendobj->base_data);
|
||||
friendobj->crc32_code = a8::openssl::Crc32
|
||||
(
|
||||
(unsigned char*)friendobj->base_data.account_id.data(),
|
||||
friendobj->base_data.account_id.size()
|
||||
);
|
||||
friendobj->hum = this;
|
||||
friend_hash_[friendobj->base_data.account_id] = friendobj;
|
||||
NotifyUserInfoUpdate(friendobj);
|
||||
PlayerMgr::Instance()->WatchPlayer(friendobj);
|
||||
if (AddFriend(friendobj) == 0) {
|
||||
NotifyUserInfoUpdate(friendobj);
|
||||
} else {
|
||||
delete friendobj;
|
||||
}
|
||||
SendMsg(respmsg);
|
||||
MarkDirty();
|
||||
#if 1
|
||||
@ -707,11 +696,9 @@ void Player::InternalSendSSMsg(const Friend& friend_data,
|
||||
#endif
|
||||
}
|
||||
|
||||
void Player::AddFriend(Friend* p)
|
||||
int Player::AddFriend(Friend* friendobj)
|
||||
{
|
||||
if (!GetFriendById(p->base_data.account_id)) {
|
||||
Friend* friendobj = new Friend;
|
||||
*friendobj = *p;
|
||||
if (!GetFriendById(friendobj->base_data.account_id)) {
|
||||
INIT_LIST_HEAD(&friendobj->watch_node);
|
||||
friendobj->crc32_code = a8::openssl::Crc32
|
||||
(
|
||||
@ -722,7 +709,9 @@ void Player::AddFriend(Friend* p)
|
||||
friend_hash_[friendobj->base_data.account_id] = friendobj;
|
||||
NotifyUserInfoUpdate(friendobj);
|
||||
PlayerMgr::Instance()->WatchPlayer(friendobj);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Player::RemoveFriend(const std::string& account_id)
|
||||
|
@ -94,9 +94,6 @@ class Player
|
||||
void NotifyOnline();
|
||||
void NotifyOffline();
|
||||
void NotifyUserInfoUpdate(Friend* friend_data);
|
||||
void PushFriendList();
|
||||
void AddFriend(Friend* friendobj);
|
||||
void RemoveFriend(const std::string& account_id);
|
||||
|
||||
const std::string AccountId();
|
||||
|
||||
@ -115,6 +112,9 @@ private:
|
||||
int msgid,
|
||||
::google::protobuf::Message& msg);
|
||||
void InternalUpdateUserInfo();
|
||||
int AddFriend(Friend* friendobj);
|
||||
void RemoveFriend(const std::string& account_id);
|
||||
void PushFriendList();
|
||||
|
||||
private:
|
||||
bool dirty_ = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user