1
This commit is contained in:
parent
4af9244511
commit
aa6d5c94d7
@ -379,7 +379,7 @@ void Player::_CMFriendAddBlack(f8::MsgHdr& hdr, const cs::CMFriendAddBlack& msg)
|
|||||||
SendMsg(notifymsg);
|
SendMsg(notifymsg);
|
||||||
}
|
}
|
||||||
black_hash_[p->base_data.account_id] = p;
|
black_hash_[p->base_data.account_id] = p;
|
||||||
RemoveFriend(p->base_data.account_id, true);
|
InternalRemoveFriend(p->base_data.account_id, true, false);
|
||||||
MarkDirty();
|
MarkDirty();
|
||||||
}
|
}
|
||||||
ShowErrorMsg("成功添加到黑名单");
|
ShowErrorMsg("成功添加到黑名单");
|
||||||
@ -968,21 +968,7 @@ void Player::AddBlackList(Friend* friendobj)
|
|||||||
|
|
||||||
void Player::RemoveFriend(const std::string& account_id, bool need_sync)
|
void Player::RemoveFriend(const std::string& account_id, bool need_sync)
|
||||||
{
|
{
|
||||||
Friend* friendobj = GetFriendById(account_id);
|
InternalRemoveFriend(account_id, need_sync, true);
|
||||||
if (friendobj) {
|
|
||||||
{
|
|
||||||
cs::SMDeleteFriendNotify notifymsg;
|
|
||||||
notifymsg.add_user_list(account_id);
|
|
||||||
SendMsg(notifymsg);
|
|
||||||
}
|
|
||||||
if (need_sync) {
|
|
||||||
SyncHelper::Instance()->SyncDeleteFriend(this, friendobj->base_data.account_id, 0);
|
|
||||||
}
|
|
||||||
PlayerMgr::Instance()->UnWatchPlayer(friendobj);
|
|
||||||
friend_hash_.erase(account_id);
|
|
||||||
delete friendobj;
|
|
||||||
MarkDirty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Update(long long tick)
|
void Player::Update(long long tick)
|
||||||
@ -1469,3 +1455,24 @@ void Player::ShowErrorMsg(const std::string& msg)
|
|||||||
notifymsg.set_msg(msg);
|
notifymsg.set_msg(msg);
|
||||||
SendMsg(notifymsg);
|
SendMsg(notifymsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::InternalRemoveFriend(const std::string& account_id, bool need_sync, bool auto_delete)
|
||||||
|
{
|
||||||
|
Friend* friendobj = GetFriendById(account_id);
|
||||||
|
if (friendobj) {
|
||||||
|
{
|
||||||
|
cs::SMDeleteFriendNotify notifymsg;
|
||||||
|
notifymsg.add_user_list(account_id);
|
||||||
|
SendMsg(notifymsg);
|
||||||
|
}
|
||||||
|
if (need_sync) {
|
||||||
|
SyncHelper::Instance()->SyncDeleteFriend(this, friendobj->base_data.account_id, 0);
|
||||||
|
}
|
||||||
|
PlayerMgr::Instance()->UnWatchPlayer(friendobj);
|
||||||
|
friend_hash_.erase(account_id);
|
||||||
|
if (auto_delete) {
|
||||||
|
delete friendobj;
|
||||||
|
}
|
||||||
|
MarkDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -105,6 +105,8 @@ class Player
|
|||||||
void Update(long long tick);
|
void Update(long long tick);
|
||||||
void FillMFUserInfo(cs::MFUserInfo* user_info);
|
void FillMFUserInfo(cs::MFUserInfo* user_info);
|
||||||
std::set<std::string>& GetExcludeAccountIds();
|
std::set<std::string>& GetExcludeAccountIds();
|
||||||
|
Friend* GetFriendById(const std::string& friend_id);
|
||||||
|
Friend* GetBlackListById(const std::string& friend_id);
|
||||||
|
|
||||||
const std::string AccountId();
|
const std::string AccountId();
|
||||||
const std::string SessionId();
|
const std::string SessionId();
|
||||||
@ -116,8 +118,6 @@ private:
|
|||||||
void FillBlackList(::google::protobuf::RepeatedPtrField< ::cs::MFUserInfo >* black_list);
|
void FillBlackList(::google::protobuf::RepeatedPtrField< ::cs::MFUserInfo >* black_list);
|
||||||
void ForwardGroupCMMsg(f8::MsgHdr& hdr, long long hash_code);
|
void ForwardGroupCMMsg(f8::MsgHdr& hdr, long long hash_code);
|
||||||
void SaveToDB(a8::XParams param, f8::AsyncDBOnOkFunc on_ok, f8::AsyncDBOnErrorFunc on_error);
|
void SaveToDB(a8::XParams param, f8::AsyncDBOnOkFunc on_ok, f8::AsyncDBOnErrorFunc on_error);
|
||||||
Friend* GetFriendById(const std::string& friend_id);
|
|
||||||
Friend* GetBlackListById(const std::string& friend_id);
|
|
||||||
void FillApplyList(const cs::MFPaging& paging, cs::SMFriendApplyList& respmsg);
|
void FillApplyList(const cs::MFPaging& paging, cs::SMFriendApplyList& respmsg);
|
||||||
void MarkDirty();
|
void MarkDirty();
|
||||||
void OnDataVersion1Change();
|
void OnDataVersion1Change();
|
||||||
@ -149,6 +149,7 @@ private:
|
|||||||
void QueryUserOnline(std::vector<std::string> account_ids);
|
void QueryUserOnline(std::vector<std::string> account_ids);
|
||||||
void QueryUserFromDB();
|
void QueryUserFromDB();
|
||||||
void ShowErrorMsg(const std::string& msg);
|
void ShowErrorMsg(const std::string& msg);
|
||||||
|
void InternalRemoveFriend(const std::string& account_id, bool need_sync, bool auto_delete);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool dirty_ = false;
|
bool dirty_ = false;
|
||||||
|
@ -50,7 +50,7 @@ void PlayerMgr::_SS_IM_SendChatMsg(f8::MsgHdr& hdr, const ss::SS_IM_SendChatMsg&
|
|||||||
void PlayerMgr::_SS_IM_SendCustomMsg(f8::MsgHdr& hdr, const ss::SS_IM_SendCustomMsg& msg)
|
void PlayerMgr::_SS_IM_SendCustomMsg(f8::MsgHdr& hdr, const ss::SS_IM_SendCustomMsg& msg)
|
||||||
{
|
{
|
||||||
Player* hum = GetPlayerByAccountId(msg.target());
|
Player* hum = GetPlayerByAccountId(msg.target());
|
||||||
if (hum) {
|
if (hum && !hum->GetBlackListById(msg.target())) {
|
||||||
cs::SMCustomMsgNotify notifymsg;
|
cs::SMCustomMsgNotify notifymsg;
|
||||||
notifymsg.set_sender(msg.context().user_info().base_data().account_id());
|
notifymsg.set_sender(msg.context().user_info().base_data().account_id());
|
||||||
notifymsg.set_msg(msg.msg());
|
notifymsg.set_msg(msg.msg());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user