From 012a135b930bb176696f4c3d5f705948f88f101e Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 3 Jul 2020 19:51:27 +0800 Subject: [PATCH] 1 --- server/imserver/player.cc | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/server/imserver/player.cc b/server/imserver/player.cc index 8eb24b4..4d9dee3 100644 --- a/server/imserver/player.cc +++ b/server/imserver/player.cc @@ -388,20 +388,23 @@ void Player::_CMFriendAddBlack(f8::MsgHdr& hdr, const cs::CMFriendAddBlack& msg) ShowErrorMsg("添加失败,黑名单已满"); 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()); if (p) { - if (!GetBlackListById(msg.user_info().base_data().account_id())) { - { - cs::SMAddBlackListNotify notifymsg; - auto user_info = notifymsg.add_user_infos(); - TypeConvert::Convert(p->base_data, *user_info->mutable_base_data()); - TypeConvert::Convert(p->temp_custom_data, *user_info->mutable_temp_custom_data()); - SendMsg(notifymsg); - } - black_hash_[p->base_data.account_id] = p; - InternalRemoveFriend(p->base_data.account_id, true, false); - MarkDirty(); + { + cs::SMAddBlackListNotify notifymsg; + auto user_info = notifymsg.add_user_infos(); + TypeConvert::Convert(p->base_data, *user_info->mutable_base_data()); + TypeConvert::Convert(p->temp_custom_data, *user_info->mutable_temp_custom_data()); + SendMsg(notifymsg); } + black_hash_[p->base_data.account_id] = p; + InternalRemoveFriend(p->base_data.account_id, true, false); + MarkDirty(); ShowErrorMsg("成功添加到黑名单"); } else { if (msg.user_info().base_data().account_id().empty()) {