diff --git a/server/imserver_new/common/types.go b/server/imserver_new/common/types.go index 79d0452a..783e04c4 100644 --- a/server/imserver_new/common/types.go +++ b/server/imserver_new/common/types.go @@ -62,7 +62,7 @@ type FriendMgr interface { AsyncApplyFriend(string, string, func(int32, string)) AsyncAcceptApply(string, string, func(int32, string)) AsyncRejectApply(string, string, func(int32, string)) - AsynDeleteFriend(string, string, func(int32, string)) + AsyncDeleteFriend(string, string, func(int32, string)) AsyncAddBlack(string, string, func(int32, string)) AsyncRemoveBlack(string, string, func(int32, string)) } @@ -85,6 +85,7 @@ type GuildMgr interface { AsyncApplyJoin(string, string, func(int32, string)) AsyncAcceptApply(string, string, func(int32, string)) AsyncRejectApply(string, string, func(int32, string)) + AsyncLeave(string, func(int32, string)) AsyncKickout(string, string, func(int32, string)) AsyncDisband(string, string, func(int32, string)) diff --git a/server/imserver_new/friend/friendmgr.go b/server/imserver_new/friend/friendmgr.go index 1bc62dcb..1345755e 100644 --- a/server/imserver_new/friend/friendmgr.go +++ b/server/imserver_new/friend/friendmgr.go @@ -314,7 +314,6 @@ func (this *friendMgr) AsynDeleteFriend(senderId string, targetId string, cb fun } this.removeFriendShip(accountId1, accountId2) cb(0, "") - }) } diff --git a/server/imserver_new/player/player.go b/server/imserver_new/player/player.go index c8167c9a..9ebc8192 100644 --- a/server/imserver_new/player/player.go +++ b/server/imserver_new/player/player.go @@ -284,6 +284,24 @@ func (this *player) CMRejectFriendRequest(hdr *f5.MsgHdr, msg *cs.CMRejectFriend } func (this *player) CMDeleteFriendShip(hdr *f5.MsgHdr, msg *cs.CMDeleteFriendShip) { + rspMsg := new(cs.SMDeleteFriendShip) + f5.NewLockAsyncTask( + [][]string{ + {constant.MEMBER_LOCK_KEY, this.GetAccountId()}, + {constant.MEMBER_LOCK_KEY, msg.GetTargetAccountId()}, + }, + func (cb *f5.LockAsyncTask) { + GetFriendMgr().AsyncDeleteFriend( + this.GetAccountId(), + msg.GetTargetAccountId(), + func (errCode int32, errMsg string) { + if errCode != 0 { + this.SendMsg(rspMsg.Err(500, "server internal error")) + return + } + this.SendMsg(rspMsg) + }) + }) } func (this *player) CMAddBlacklist(hdr *f5.MsgHdr, msg *cs.CMAddBlacklist) {