This commit is contained in:
aozhiwei 2024-03-23 14:13:25 +08:00
parent f80a0c21c9
commit bc954f51df
3 changed files with 42 additions and 0 deletions

View File

@ -59,6 +59,12 @@ type FriendMgr interface {
GetFriendList(string) []string
GetBlackList(string) []string
AsyncGetApplyList(int64, string, func(int32, string, int64, []string))
AsyncAddFriend(string, string, func(int32, string))
AsyncAccpetApply(string, string, func(int32, string))
AsyncRejectApply(string, string, func(int32, string))
AsynDeleteFriend(string, string, func(int32, string))
AsyncAddBlack(string, string, func(int32, string))
AsyncRemoveBlack(string, string, func(int32, string))
}
type Guild interface {

View File

@ -93,3 +93,27 @@ func (this *FriendMgr) getFriends(accountId string) *map[string]int32 {
func (this *FriendMgr) AsyncGetApplyList(int64, string, func(int32, string, int64, []string)) {
}
func (this *FriendMgr) AsyncAddFriend(senderId string, targetId string, cb func(int32, string)) {
}
func (this *FriendMgr) AsyncAccpetApply(senderId string, targetId string, cb func(int32, string)) {
}
func (this *FriendMgr) AsyncRejectApply(senderId string, targetId string, cb func(int32, string)) {
}
func (this *FriendMgr) AsynDeleteFriend(senderId string, targetId string, cb func(int32, string)) {
}
func (this *FriendMgr) AsyncAddBlack(senderId string, targetId string, cb func(int32, string)) {
}
func (this *FriendMgr) AsyncRemoveBlack(senderId string, targetId string, cb func(int32, string)) {
}

View File

@ -162,6 +162,18 @@ func (this *player) CMBlacklist(hdr *f5.MsgHdr, msg *cs.CMBlacklist) {
}
func (this *player) CMAddFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAddFriendRequest) {
rspMsg := new(cs.SMAddFriendRequest)
if GetFriendMgr().IsFriend(this.GetAccountId(), msg.GetTargetAccountId()) {
rspMsg.IsFriendship = proto.Int32(1)
this.SendMsg(rspMsg)
return
}
GetFriendMgr().AsyncAddFriend(
this.GetAccountId(),
msg.GetTargetAccountId(),
func (errCode int32, errMsg string) {
})
}
func (this *player) CMAcceptFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAcceptFriendRequest) {