1
This commit is contained in:
parent
80f6613e86
commit
5e5eba196d
@ -325,7 +325,7 @@ void Player::_CMFriendDelete(f8::MsgHdr& hdr, const cs::CMFriendDelete& msg)
|
|||||||
cs::SMFriendDelete respmsg;
|
cs::SMFriendDelete respmsg;
|
||||||
Friend* p = GetFriendById(msg.friend_id());
|
Friend* p = GetFriendById(msg.friend_id());
|
||||||
if (p) {
|
if (p) {
|
||||||
RemoveFriend(p->base_data.account_id);
|
RemoveFriend(p->base_data.account_id, true);
|
||||||
}
|
}
|
||||||
respmsg.set_friend_id(msg.friend_id());
|
respmsg.set_friend_id(msg.friend_id());
|
||||||
SendMsg(respmsg);
|
SendMsg(respmsg);
|
||||||
@ -524,6 +524,7 @@ void Player::_SS_IM_FriendAgreeRequest(f8::MsgHdr& hdr, const ss::SS_IM_FriendAg
|
|||||||
void Player::_SS_IM_FriendDeleteRequest(f8::MsgHdr& hdr, const ss::SS_IM_FriendDeleteRequest& msg)
|
void Player::_SS_IM_FriendDeleteRequest(f8::MsgHdr& hdr, const ss::SS_IM_FriendDeleteRequest& msg)
|
||||||
{
|
{
|
||||||
if (GetFriendById(msg.context().user_info().base_data().account_id())) {
|
if (GetFriendById(msg.context().user_info().base_data().account_id())) {
|
||||||
|
RemoveFriend(msg.context().user_info().base_data().account_id(), false);
|
||||||
}
|
}
|
||||||
f8::MsgHdr* hdr_copy = hdr.Clone();
|
f8::MsgHdr* hdr_copy = hdr.Clone();
|
||||||
ss::SS_IM_FriendDeleteRequest* msg_copy = new ss::SS_IM_FriendDeleteRequest;
|
ss::SS_IM_FriendDeleteRequest* msg_copy = new ss::SS_IM_FriendDeleteRequest;
|
||||||
@ -804,7 +805,7 @@ int Player::AddFriend(Friend* friendobj)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::RemoveFriend(const std::string& account_id)
|
void Player::RemoveFriend(const std::string& account_id, bool need_sync)
|
||||||
{
|
{
|
||||||
Friend* friendobj = GetFriendById(account_id);
|
Friend* friendobj = GetFriendById(account_id);
|
||||||
if (friendobj) {
|
if (friendobj) {
|
||||||
@ -813,7 +814,9 @@ void Player::RemoveFriend(const std::string& account_id)
|
|||||||
notifymsg.add_user_list(account_id);
|
notifymsg.add_user_list(account_id);
|
||||||
SendMsg(notifymsg);
|
SendMsg(notifymsg);
|
||||||
}
|
}
|
||||||
SyncHelper::Instance()->SyncDeleteFriend(this, friendobj->base_data.account_id);
|
if (need_sync) {
|
||||||
|
SyncHelper::Instance()->SyncDeleteFriend(this, friendobj->base_data.account_id);
|
||||||
|
}
|
||||||
PlayerMgr::Instance()->UnWatchPlayer(friendobj);
|
PlayerMgr::Instance()->UnWatchPlayer(friendobj);
|
||||||
friend_hash_.erase(account_id);
|
friend_hash_.erase(account_id);
|
||||||
delete friendobj;
|
delete friendobj;
|
||||||
@ -1030,7 +1033,7 @@ void Player::OnFriendDeleteEvent(Event& event)
|
|||||||
if (!GetFriendById(event.sender_id)) {
|
if (!GetFriendById(event.sender_id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RemoveFriend(event.sender_id);
|
RemoveFriend(event.sender_id, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::CanAddFriend(const std::string& account_id)
|
bool Player::CanAddFriend(const std::string& account_id)
|
||||||
|
@ -119,7 +119,7 @@ private:
|
|||||||
::google::protobuf::Message& msg);
|
::google::protobuf::Message& msg);
|
||||||
void InternalUpdateUserInfo();
|
void InternalUpdateUserInfo();
|
||||||
int AddFriend(Friend* friendobj);
|
int AddFriend(Friend* friendobj);
|
||||||
void RemoveFriend(const std::string& account_id);
|
void RemoveFriend(const std::string& account_id, bool need_sync);
|
||||||
void PushFriendList();
|
void PushFriendList();
|
||||||
void SyncOtherFriend();
|
void SyncOtherFriend();
|
||||||
void ProcessEventTimerFunc();
|
void ProcessEventTimerFunc();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user