This commit is contained in:
aozhiwei 2020-06-18 17:34:07 +08:00
parent 5cf022f2f1
commit c0a3b4f7ee
3 changed files with 19 additions and 20 deletions

View File

@ -11,6 +11,7 @@
#include "MSConnMgr.h" #include "MSConnMgr.h"
#include "dbengine.h" #include "dbengine.h"
#include "dbhelper.h" #include "dbhelper.h"
#include "synchelper.h"
#include "app.h" #include "app.h"
#include "typeconvert.h" #include "typeconvert.h"
#include "playermgr.h" #include "playermgr.h"
@ -241,20 +242,12 @@ void Player::_CMFriendAgree(f8::MsgHdr& hdr, const cs::CMFriendAgree& msg)
TypeConvert::Convert(msg.apply().base_data(), friendobj->base_data); TypeConvert::Convert(msg.apply().base_data(), friendobj->base_data);
if (AddFriend(friendobj) == 0) { if (AddFriend(friendobj) == 0) {
NotifyUserInfoUpdate(friendobj); NotifyUserInfoUpdate(friendobj);
SyncHelper::Instance()->SyncNewFriend(this, friendobj->base_data.account_id);
MarkDirty();
} else { } else {
A8_SAFE_DELETE(friendobj); A8_SAFE_DELETE(friendobj);
} }
SendMsg(respmsg); SendMsg(respmsg);
MarkDirty();
#if 1
{
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(friendobj->base_data.account_id);
if (hum) {
hum->AddFriend(&myself);
}
}
#endif
DBHelper::Instance()->SetFriendApplyStatus DBHelper::Instance()->SetFriendApplyStatus
( (
myself.crc32_code, myself.crc32_code,
@ -284,16 +277,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) {
friend_hash_.erase(msg.friend_id()); RemoveFriend(p->base_data.account_id);
MarkDirty();
#if 1
{
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(p->base_data.account_id);
if (hum) {
hum->RemoveFriend(AccountId());
}
}
#endif
} }
respmsg.set_friend_id(msg.friend_id()); respmsg.set_friend_id(msg.friend_id());
SendMsg(respmsg); SendMsg(respmsg);
@ -717,9 +701,11 @@ 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);
PlayerMgr::Instance()->UnWatchPlayer(friendobj); PlayerMgr::Instance()->UnWatchPlayer(friendobj);
friend_hash_.erase(account_id); friend_hash_.erase(account_id);
delete friendobj; delete friendobj;
MarkDirty();
} }
} }

View File

@ -13,3 +13,13 @@ void SyncHelper::Init()
void SyncHelper::UnInit() void SyncHelper::UnInit()
{ {
} }
void SyncHelper::SyncNewFriend(Player* hum, const std::string& target_id)
{
}
void SyncHelper::SyncDeleteFriend(Player* hum, const std::string& target_id)
{
}

View File

@ -10,4 +10,7 @@ class SyncHelper : public a8::Singleton<SyncHelper>
public: public:
void Init(); void Init();
void UnInit(); void UnInit();
void SyncNewFriend(Player* hum, const std::string& target_id);
void SyncDeleteFriend(Player* hum, const std::string& target_id);
}; };