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