1
This commit is contained in:
parent
16e36e091f
commit
40bdddabf2
@ -363,12 +363,12 @@ void Player::_CMFriendAddBlack(f8::MsgHdr& hdr, const cs::CMFriendAddBlack& msg)
|
|||||||
ShowErrorMsg("添加失败,黑名单已满");
|
ShowErrorMsg("添加失败,黑名单已满");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Friend* p = GetFriendById(msg.account_id());
|
Friend* p = GetFriendById(msg.user_info().base_data().account_id());
|
||||||
if (p) {
|
if (p) {
|
||||||
if (!GetBlackListById(msg.account_id())) {
|
if (!GetBlackListById(msg.user_info().base_data().account_id())) {
|
||||||
{
|
{
|
||||||
cs::SMDeleteFriendNotify notifymsg;
|
cs::SMDeleteFriendNotify notifymsg;
|
||||||
notifymsg.add_user_list(msg.account_id());
|
notifymsg.add_user_list(msg.user_info().base_data().account_id());
|
||||||
SendMsg(notifymsg);
|
SendMsg(notifymsg);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -384,7 +384,19 @@ void Player::_CMFriendAddBlack(f8::MsgHdr& hdr, const cs::CMFriendAddBlack& msg)
|
|||||||
}
|
}
|
||||||
ShowErrorMsg("成功添加到黑名单");
|
ShowErrorMsg("成功添加到黑名单");
|
||||||
} else {
|
} else {
|
||||||
ShowErrorMsg("对方不是你的好友");
|
if (msg.user_info().base_data().account_id() == AccountId()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p = new Friend();
|
||||||
|
TypeConvert::Convert(msg.user_info().base_data(), p->base_data);
|
||||||
|
AddBlackList(p);
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -919,17 +931,15 @@ void Player::AddBlackList(Friend* friendobj)
|
|||||||
if (friendobj->base_data.account_id == AccountId()) {
|
if (friendobj->base_data.account_id == AccountId()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!GetFriendById(friendobj->base_data.account_id)) {
|
INIT_LIST_HEAD(&friendobj->watch_node);
|
||||||
INIT_LIST_HEAD(&friendobj->watch_node);
|
friendobj->crc32_code = a8::openssl::Crc32
|
||||||
friendobj->crc32_code = a8::openssl::Crc32
|
(
|
||||||
(
|
(unsigned char*)friendobj->base_data.account_id.data(),
|
||||||
(unsigned char*)friendobj->base_data.account_id.data(),
|
friendobj->base_data.account_id.size()
|
||||||
friendobj->base_data.account_id.size()
|
);
|
||||||
);
|
friendobj->hum = this;
|
||||||
friendobj->hum = this;
|
black_hash_[friendobj->base_data.account_id] = friendobj;
|
||||||
black_hash_[friendobj->base_data.account_id] = friendobj;
|
PlayerMgr::Instance()->WatchPlayer(friendobj);
|
||||||
PlayerMgr::Instance()->WatchPlayer(friendobj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::RemoveFriend(const std::string& account_id, bool need_sync)
|
void Player::RemoveFriend(const std::string& account_id, bool need_sync)
|
||||||
|
@ -198,7 +198,7 @@ message SMFriendBlackList
|
|||||||
//添加黑名单
|
//添加黑名单
|
||||||
message CMFriendAddBlack
|
message CMFriendAddBlack
|
||||||
{
|
{
|
||||||
optional string account_id = 1; //好友id
|
optional MFUserInfo user_info = 1; //好友信息
|
||||||
}
|
}
|
||||||
//添加黑名单回复
|
//添加黑名单回复
|
||||||
message SMFriendAddBlack
|
message SMFriendAddBlack
|
||||||
|
Loading…
x
Reference in New Issue
Block a user