This commit is contained in:
aozhiwei 2020-07-03 19:51:27 +08:00
parent d03402c6a6
commit 012a135b93

View File

@ -388,20 +388,23 @@ void Player::_CMFriendAddBlack(f8::MsgHdr& hdr, const cs::CMFriendAddBlack& msg)
ShowErrorMsg("添加失败,黑名单已满"); ShowErrorMsg("添加失败,黑名单已满");
return; return;
} }
if (GetBlackListById(msg.user_info().base_data().account_id())) {
cs::SMFriendAddBlack respmsg;
SendMsg(respmsg);
return;
}
Friend* p = GetFriendById(msg.user_info().base_data().account_id()); Friend* p = GetFriendById(msg.user_info().base_data().account_id());
if (p) { if (p) {
if (!GetBlackListById(msg.user_info().base_data().account_id())) { {
{ cs::SMAddBlackListNotify notifymsg;
cs::SMAddBlackListNotify notifymsg; auto user_info = notifymsg.add_user_infos();
auto user_info = notifymsg.add_user_infos(); TypeConvert::Convert(p->base_data, *user_info->mutable_base_data());
TypeConvert::Convert(p->base_data, *user_info->mutable_base_data()); TypeConvert::Convert(p->temp_custom_data, *user_info->mutable_temp_custom_data());
TypeConvert::Convert(p->temp_custom_data, *user_info->mutable_temp_custom_data()); SendMsg(notifymsg);
SendMsg(notifymsg);
}
black_hash_[p->base_data.account_id] = p;
InternalRemoveFriend(p->base_data.account_id, true, false);
MarkDirty();
} }
black_hash_[p->base_data.account_id] = p;
InternalRemoveFriend(p->base_data.account_id, true, false);
MarkDirty();
ShowErrorMsg("成功添加到黑名单"); ShowErrorMsg("成功添加到黑名单");
} else { } else {
if (msg.user_info().base_data().account_id().empty()) { if (msg.user_info().base_data().account_id().empty()) {