好友信息
This commit is contained in:
parent
ba703c871b
commit
389d7ebc8f
@ -38,6 +38,7 @@ type MsgHandler interface {
|
||||
CMPing(*f5.MsgHdr, *CMPing)
|
||||
CMLogin(*f5.MsgHdr, *CMLogin)
|
||||
CMReconnect(*f5.MsgHdr, *CMReconnect)
|
||||
CMFriendInfo(*f5.MsgHdr, *CMFriendInfo)
|
||||
CMSearchUser(*f5.MsgHdr, *CMSearchUser)
|
||||
CMSearchUserByAccountId(*f5.MsgHdr, *CMSearchUserByAccountId)
|
||||
CMAddFriendRequest(*f5.MsgHdr, *CMAddFriendRequest)
|
||||
@ -70,6 +71,9 @@ func (this *MsgHandlerImpl) CMLogin(hdr *f5.MsgHdr, msg *CMLogin) {
|
||||
func (this *MsgHandlerImpl) CMReconnect(hdr *f5.MsgHdr, msg *CMReconnect) {
|
||||
}
|
||||
|
||||
func (this *MsgHandlerImpl) CMFriendInfo(hdr *f5.MsgHdr, msg *CMFriendInfo) {
|
||||
}
|
||||
|
||||
func (this *MsgHandlerImpl) CMSearchUser(hdr *f5.MsgHdr, msg *CMSearchUser) {
|
||||
}
|
||||
|
||||
@ -161,6 +165,14 @@ func (this *SMReconnect) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMReconnect)
|
||||
}
|
||||
|
||||
func (this *CMFriendInfo) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMFriendInfo)
|
||||
}
|
||||
|
||||
func (this *SMFriendInfo) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMFriendInfo)
|
||||
}
|
||||
|
||||
func (this *CMSearchUser) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMSearchUser)
|
||||
}
|
||||
@ -367,6 +379,18 @@ func init() {
|
||||
},
|
||||
}
|
||||
|
||||
handlers[int(CMMessageIdE__CMFriendInfo)] = &CsNetMsgHandler{
|
||||
MsgId: int(CMMessageIdE__CMFriendInfo),
|
||||
ParseCb: func (data []byte) interface{} {
|
||||
msg := &CMFriendInfo{}
|
||||
proto.Unmarshal(data, msg)
|
||||
return msg
|
||||
},
|
||||
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
|
||||
handler.CMFriendInfo(hdr, hdr.Msg.(*CMFriendInfo))
|
||||
},
|
||||
}
|
||||
|
||||
handlers[int(CMMessageIdE__CMSearchUser)] = &CsNetMsgHandler{
|
||||
MsgId: int(CMMessageIdE__CMSearchUser),
|
||||
ParseCb: func (data []byte) interface{} {
|
||||
|
@ -38,6 +38,7 @@ const (
|
||||
CMMessageIdE__CMDeleteFriendShip CMMessageIdE = 112
|
||||
CMMessageIdE__CMAddBlacklist CMMessageIdE = 113
|
||||
CMMessageIdE__CMRemoveBlacklist CMMessageIdE = 114
|
||||
CMMessageIdE__CMFriendInfo CMMessageIdE = 115
|
||||
// 公会相关
|
||||
CMMessageIdE__CMGuildInfo CMMessageIdE = 120
|
||||
CMMessageIdE__CMCreateGuild CMMessageIdE = 121
|
||||
@ -68,6 +69,7 @@ var (
|
||||
112: "_CMDeleteFriendShip",
|
||||
113: "_CMAddBlacklist",
|
||||
114: "_CMRemoveBlacklist",
|
||||
115: "_CMFriendInfo",
|
||||
120: "_CMGuildInfo",
|
||||
121: "_CMCreateGuild",
|
||||
122: "_CMApplyToGuild",
|
||||
@ -94,6 +96,7 @@ var (
|
||||
"_CMDeleteFriendShip": 112,
|
||||
"_CMAddBlacklist": 113,
|
||||
"_CMRemoveBlacklist": 114,
|
||||
"_CMFriendInfo": 115,
|
||||
"_CMGuildInfo": 120,
|
||||
"_CMCreateGuild": 121,
|
||||
"_CMApplyToGuild": 122,
|
||||
@ -162,6 +165,7 @@ const (
|
||||
SMMessageIdE__SMDeleteFriendShip SMMessageIdE = 112
|
||||
SMMessageIdE__SMAddBlacklist SMMessageIdE = 113
|
||||
SMMessageIdE__SMRemoveBlacklist SMMessageIdE = 114
|
||||
SMMessageIdE__SMFriendInfo SMMessageIdE = 115
|
||||
// 公会相关
|
||||
SMMessageIdE__SMGuildInfo SMMessageIdE = 120
|
||||
SMMessageIdE__SMCreateGuild SMMessageIdE = 121
|
||||
@ -193,6 +197,7 @@ var (
|
||||
112: "_SMDeleteFriendShip",
|
||||
113: "_SMAddBlacklist",
|
||||
114: "_SMRemoveBlacklist",
|
||||
115: "_SMFriendInfo",
|
||||
120: "_SMGuildInfo",
|
||||
121: "_SMCreateGuild",
|
||||
122: "_SMApplyToGuild",
|
||||
@ -220,6 +225,7 @@ var (
|
||||
"_SMDeleteFriendShip": 112,
|
||||
"_SMAddBlacklist": 113,
|
||||
"_SMRemoveBlacklist": 114,
|
||||
"_SMFriendInfo": 115,
|
||||
"_SMGuildInfo": 120,
|
||||
"_SMCreateGuild": 121,
|
||||
"_SMApplyToGuild": 122,
|
||||
@ -275,7 +281,7 @@ var File_cs_msgid_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_cs_msgid_proto_rawDesc = []byte{
|
||||
0x0a, 0x0e, 0x63, 0x73, 0x5f, 0x6d, 0x73, 0x67, 0x69, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x12, 0x02, 0x63, 0x73, 0x2a, 0x8e, 0x04, 0x0a, 0x0d, 0x43, 0x4d, 0x4d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x12, 0x02, 0x63, 0x73, 0x2a, 0xa1, 0x04, 0x0a, 0x0d, 0x43, 0x4d, 0x4d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x67, 0x65, 0x49, 0x64, 0x5f, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x5f, 0x43, 0x4d, 0x50, 0x69, 0x6e,
|
||||
0x67, 0x10, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x5f, 0x43, 0x4d, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x10,
|
||||
0x67, 0x12, 0x10, 0x0a, 0x0c, 0x5f, 0x43, 0x4d, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
|
||||
@ -295,54 +301,57 @@ var file_cs_msgid_proto_rawDesc = []byte{
|
||||
0x10, 0x70, 0x12, 0x13, 0x0a, 0x0f, 0x5f, 0x43, 0x4d, 0x41, 0x64, 0x64, 0x42, 0x6c, 0x61, 0x63,
|
||||
0x6b, 0x6c, 0x69, 0x73, 0x74, 0x10, 0x71, 0x12, 0x16, 0x0a, 0x12, 0x5f, 0x43, 0x4d, 0x52, 0x65,
|
||||
0x6d, 0x6f, 0x76, 0x65, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x6c, 0x69, 0x73, 0x74, 0x10, 0x72, 0x12,
|
||||
0x10, 0x0a, 0x0c, 0x5f, 0x43, 0x4d, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x10,
|
||||
0x78, 0x12, 0x12, 0x0a, 0x0e, 0x5f, 0x43, 0x4d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x75,
|
||||
0x69, 0x6c, 0x64, 0x10, 0x79, 0x12, 0x13, 0x0a, 0x0f, 0x5f, 0x43, 0x4d, 0x41, 0x70, 0x70, 0x6c,
|
||||
0x79, 0x54, 0x6f, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x10, 0x7a, 0x12, 0x0e, 0x0a, 0x0a, 0x5f, 0x43,
|
||||
0x4d, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x10, 0x7b, 0x12, 0x0d, 0x0a, 0x09, 0x5f, 0x43,
|
||||
0x4d, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x10, 0x7c, 0x12, 0x11, 0x0a, 0x0d, 0x5f, 0x43, 0x4d,
|
||||
0x4c, 0x65, 0x61, 0x76, 0x65, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x10, 0x7d, 0x12, 0x14, 0x0a, 0x10,
|
||||
0x5f, 0x43, 0x4d, 0x44, 0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72,
|
||||
0x10, 0x7e, 0x12, 0x14, 0x0a, 0x10, 0x5f, 0x43, 0x4d, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65,
|
||||
0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10, 0x7f, 0x12, 0x14, 0x0a, 0x0f, 0x5f, 0x43, 0x4d, 0x44,
|
||||
0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10, 0x80, 0x01, 0x12, 0x0f,
|
||||
0x0a, 0x0a, 0x5f, 0x43, 0x4d, 0x44, 0x69, 0x73, 0x62, 0x61, 0x6e, 0x64, 0x10, 0x81, 0x01, 0x12,
|
||||
0x14, 0x0a, 0x0f, 0x5f, 0x43, 0x4d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x47, 0x75, 0x69, 0x6c,
|
||||
0x64, 0x73, 0x10, 0x82, 0x01, 0x2a, 0x9f, 0x04, 0x0a, 0x0d, 0x53, 0x4d, 0x4d, 0x65, 0x73, 0x73,
|
||||
0x61, 0x67, 0x65, 0x49, 0x64, 0x5f, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x5f, 0x53, 0x4d, 0x50, 0x69,
|
||||
0x6e, 0x67, 0x10, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x5f, 0x53, 0x4d, 0x52, 0x70, 0x63, 0x45, 0x72,
|
||||
0x72, 0x6f, 0x72, 0x10, 0x66, 0x12, 0x0c, 0x0a, 0x08, 0x5f, 0x53, 0x4d, 0x4c, 0x6f, 0x67, 0x69,
|
||||
0x6e, 0x10, 0x67, 0x12, 0x10, 0x0a, 0x0c, 0x5f, 0x53, 0x4d, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x6e,
|
||||
0x65, 0x63, 0x74, 0x10, 0x68, 0x12, 0x1c, 0x0a, 0x18, 0x5f, 0x53, 0x4d, 0x53, 0x65, 0x61, 0x72,
|
||||
0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49,
|
||||
0x64, 0x10, 0x69, 0x12, 0x11, 0x0a, 0x0d, 0x5f, 0x53, 0x4d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68,
|
||||
0x55, 0x73, 0x65, 0x72, 0x10, 0x6a, 0x12, 0x17, 0x0a, 0x13, 0x5f, 0x53, 0x4d, 0x41, 0x64, 0x64,
|
||||
0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6b, 0x12,
|
||||
0x1a, 0x0a, 0x16, 0x5f, 0x53, 0x4d, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x46, 0x72, 0x69, 0x65,
|
||||
0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6c, 0x12, 0x1a, 0x0a, 0x16, 0x5f,
|
||||
0x53, 0x4d, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6d, 0x12, 0x1f, 0x0a, 0x1b, 0x5f, 0x53, 0x4d, 0x4c, 0x69,
|
||||
0x73, 0x74, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6e, 0x12, 0x11, 0x0a, 0x0d, 0x5f, 0x53, 0x4d, 0x4c,
|
||||
0x69, 0x73, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x10, 0x6f, 0x12, 0x17, 0x0a, 0x13, 0x5f,
|
||||
0x53, 0x4d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x68,
|
||||
0x69, 0x70, 0x10, 0x70, 0x12, 0x13, 0x0a, 0x0f, 0x5f, 0x53, 0x4d, 0x41, 0x64, 0x64, 0x42, 0x6c,
|
||||
0x61, 0x63, 0x6b, 0x6c, 0x69, 0x73, 0x74, 0x10, 0x71, 0x12, 0x16, 0x0a, 0x12, 0x5f, 0x53, 0x4d,
|
||||
0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x6c, 0x69, 0x73, 0x74, 0x10,
|
||||
0x72, 0x12, 0x10, 0x0a, 0x0c, 0x5f, 0x53, 0x4d, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x6e, 0x66,
|
||||
0x6f, 0x10, 0x78, 0x12, 0x12, 0x0a, 0x0e, 0x5f, 0x53, 0x4d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
|
||||
0x47, 0x75, 0x69, 0x6c, 0x64, 0x10, 0x79, 0x12, 0x13, 0x0a, 0x0f, 0x5f, 0x53, 0x4d, 0x41, 0x70,
|
||||
0x70, 0x6c, 0x79, 0x54, 0x6f, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x10, 0x7a, 0x12, 0x0e, 0x0a, 0x0a,
|
||||
0x5f, 0x53, 0x4d, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x10, 0x7b, 0x12, 0x0d, 0x0a, 0x09,
|
||||
0x5f, 0x53, 0x4d, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x10, 0x7c, 0x12, 0x11, 0x0a, 0x0d, 0x5f,
|
||||
0x53, 0x4d, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x10, 0x7d, 0x12, 0x14,
|
||||
0x0a, 0x10, 0x5f, 0x53, 0x4d, 0x44, 0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x4d, 0x65, 0x6d, 0x62,
|
||||
0x65, 0x72, 0x10, 0x7e, 0x12, 0x14, 0x0a, 0x10, 0x5f, 0x53, 0x4d, 0x50, 0x72, 0x6f, 0x6d, 0x6f,
|
||||
0x74, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10, 0x7f, 0x12, 0x14, 0x0a, 0x0f, 0x5f, 0x53,
|
||||
0x4d, 0x44, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10, 0x80, 0x01,
|
||||
0x12, 0x0f, 0x0a, 0x0a, 0x5f, 0x53, 0x4d, 0x44, 0x69, 0x73, 0x62, 0x61, 0x6e, 0x64, 0x10, 0x81,
|
||||
0x01, 0x12, 0x14, 0x0a, 0x0f, 0x5f, 0x53, 0x4d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x47, 0x75,
|
||||
0x69, 0x6c, 0x64, 0x73, 0x10, 0x82, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x63, 0x73,
|
||||
0x11, 0x0a, 0x0d, 0x5f, 0x43, 0x4d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x10, 0x73, 0x12, 0x10, 0x0a, 0x0c, 0x5f, 0x43, 0x4d, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x10, 0x78, 0x12, 0x12, 0x0a, 0x0e, 0x5f, 0x43, 0x4d, 0x43, 0x72, 0x65, 0x61, 0x74,
|
||||
0x65, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x10, 0x79, 0x12, 0x13, 0x0a, 0x0f, 0x5f, 0x43, 0x4d, 0x41,
|
||||
0x70, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x10, 0x7a, 0x12, 0x0e, 0x0a,
|
||||
0x0a, 0x5f, 0x43, 0x4d, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x10, 0x7b, 0x12, 0x0d, 0x0a,
|
||||
0x09, 0x5f, 0x43, 0x4d, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x10, 0x7c, 0x12, 0x11, 0x0a, 0x0d,
|
||||
0x5f, 0x43, 0x4d, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x10, 0x7d, 0x12,
|
||||
0x14, 0x0a, 0x10, 0x5f, 0x43, 0x4d, 0x44, 0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x4d, 0x65, 0x6d,
|
||||
0x62, 0x65, 0x72, 0x10, 0x7e, 0x12, 0x14, 0x0a, 0x10, 0x5f, 0x43, 0x4d, 0x50, 0x72, 0x6f, 0x6d,
|
||||
0x6f, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10, 0x7f, 0x12, 0x14, 0x0a, 0x0f, 0x5f,
|
||||
0x43, 0x4d, 0x44, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10, 0x80,
|
||||
0x01, 0x12, 0x0f, 0x0a, 0x0a, 0x5f, 0x43, 0x4d, 0x44, 0x69, 0x73, 0x62, 0x61, 0x6e, 0x64, 0x10,
|
||||
0x81, 0x01, 0x12, 0x14, 0x0a, 0x0f, 0x5f, 0x43, 0x4d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x47,
|
||||
0x75, 0x69, 0x6c, 0x64, 0x73, 0x10, 0x82, 0x01, 0x2a, 0xb2, 0x04, 0x0a, 0x0d, 0x53, 0x4d, 0x4d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x5f, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x5f, 0x53,
|
||||
0x4d, 0x50, 0x69, 0x6e, 0x67, 0x10, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x5f, 0x53, 0x4d, 0x52, 0x70,
|
||||
0x63, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x66, 0x12, 0x0c, 0x0a, 0x08, 0x5f, 0x53, 0x4d, 0x4c,
|
||||
0x6f, 0x67, 0x69, 0x6e, 0x10, 0x67, 0x12, 0x10, 0x0a, 0x0c, 0x5f, 0x53, 0x4d, 0x52, 0x65, 0x63,
|
||||
0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x10, 0x68, 0x12, 0x1c, 0x0a, 0x18, 0x5f, 0x53, 0x4d, 0x53,
|
||||
0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x41, 0x63, 0x63, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x49, 0x64, 0x10, 0x69, 0x12, 0x11, 0x0a, 0x0d, 0x5f, 0x53, 0x4d, 0x53, 0x65, 0x61,
|
||||
0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x10, 0x6a, 0x12, 0x17, 0x0a, 0x13, 0x5f, 0x53, 0x4d,
|
||||
0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x10, 0x6b, 0x12, 0x1a, 0x0a, 0x16, 0x5f, 0x53, 0x4d, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x46,
|
||||
0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6c, 0x12, 0x1a,
|
||||
0x0a, 0x16, 0x5f, 0x53, 0x4d, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e,
|
||||
0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6d, 0x12, 0x1f, 0x0a, 0x1b, 0x5f, 0x53,
|
||||
0x4d, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x46, 0x72, 0x69, 0x65,
|
||||
0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6e, 0x12, 0x11, 0x0a, 0x0d, 0x5f,
|
||||
0x53, 0x4d, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x10, 0x6f, 0x12, 0x17,
|
||||
0x0a, 0x13, 0x5f, 0x53, 0x4d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e,
|
||||
0x64, 0x53, 0x68, 0x69, 0x70, 0x10, 0x70, 0x12, 0x13, 0x0a, 0x0f, 0x5f, 0x53, 0x4d, 0x41, 0x64,
|
||||
0x64, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x6c, 0x69, 0x73, 0x74, 0x10, 0x71, 0x12, 0x16, 0x0a, 0x12,
|
||||
0x5f, 0x53, 0x4d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x6c, 0x69,
|
||||
0x73, 0x74, 0x10, 0x72, 0x12, 0x11, 0x0a, 0x0d, 0x5f, 0x53, 0x4d, 0x46, 0x72, 0x69, 0x65, 0x6e,
|
||||
0x64, 0x49, 0x6e, 0x66, 0x6f, 0x10, 0x73, 0x12, 0x10, 0x0a, 0x0c, 0x5f, 0x53, 0x4d, 0x47, 0x75,
|
||||
0x69, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x10, 0x78, 0x12, 0x12, 0x0a, 0x0e, 0x5f, 0x53, 0x4d,
|
||||
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x10, 0x79, 0x12, 0x13, 0x0a,
|
||||
0x0f, 0x5f, 0x53, 0x4d, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x47, 0x75, 0x69, 0x6c, 0x64,
|
||||
0x10, 0x7a, 0x12, 0x0e, 0x0a, 0x0a, 0x5f, 0x53, 0x4d, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65,
|
||||
0x10, 0x7b, 0x12, 0x0d, 0x0a, 0x09, 0x5f, 0x53, 0x4d, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x10,
|
||||
0x7c, 0x12, 0x11, 0x0a, 0x0d, 0x5f, 0x53, 0x4d, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x47, 0x75, 0x69,
|
||||
0x6c, 0x64, 0x10, 0x7d, 0x12, 0x14, 0x0a, 0x10, 0x5f, 0x53, 0x4d, 0x44, 0x69, 0x73, 0x6d, 0x69,
|
||||
0x73, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10, 0x7e, 0x12, 0x14, 0x0a, 0x10, 0x5f, 0x53,
|
||||
0x4d, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10, 0x7f,
|
||||
0x12, 0x14, 0x0a, 0x0f, 0x5f, 0x53, 0x4d, 0x44, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x4d, 0x65, 0x6d,
|
||||
0x62, 0x65, 0x72, 0x10, 0x80, 0x01, 0x12, 0x0f, 0x0a, 0x0a, 0x5f, 0x53, 0x4d, 0x44, 0x69, 0x73,
|
||||
0x62, 0x61, 0x6e, 0x64, 0x10, 0x81, 0x01, 0x12, 0x14, 0x0a, 0x0f, 0x5f, 0x53, 0x4d, 0x53, 0x65,
|
||||
0x61, 0x72, 0x63, 0x68, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x10, 0x82, 0x01, 0x42, 0x06, 0x5a,
|
||||
0x04, 0x2e, 0x3b, 0x63, 0x73,
|
||||
}
|
||||
|
||||
var (
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -197,7 +197,7 @@ func (fm *FriendsMgr) loadPendingRequestsResult(err error, rows *f5.DataSet) {
|
||||
senderAccountId := q5.ToString(*rows.GetByIndex(0))
|
||||
receiverAccountId := q5.ToString(*rows.GetByIndex(1))
|
||||
fm.pendingReqs[receiverAccountId] = make(map[string]bool)
|
||||
fm.pendingReqs[receiverAccountId][senderAccountId] = true
|
||||
fm.pendingReqs[receiverAccountId][senderAccountId] = false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"cs"
|
||||
"errors"
|
||||
"fmt"
|
||||
"q5"
|
||||
"strings"
|
||||
@ -16,8 +15,8 @@ type FriendsMgr struct {
|
||||
users map[string]*User // AccountId -> 用户
|
||||
searchCaches map[string]SearchCache // SearchKeyword -> 好友搜索结果 []*User
|
||||
friendships map[string][]*Friendship // AccountId -> 好友关系列表 []*Friendship
|
||||
pendingReqs map[string]map[string]bool // AccountId -> 等待请求列表 map[account2Id]true
|
||||
blackList map[string]map[string]bool // AccountId -> 黑名单列表 map[account2Id]true
|
||||
pendingReqs map[string]map[string]bool // AccountId -> 等待请求列表 map[account2Id]false default false, isFriendShip
|
||||
blackList map[string]map[string]bool // AccountId -> 黑名单列表 map[account2Id]false default: false, isRemoved
|
||||
userCount int // 用户总数
|
||||
}
|
||||
|
||||
@ -97,7 +96,7 @@ func (fm *FriendsMgr) addFriendRequest(account1Id string, account2Id string) err
|
||||
_, exists1 := fm.users[account1Id]
|
||||
_, exists2 := fm.users[account2Id]
|
||||
if !exists1 || !exists2 {
|
||||
return errors.New("users not exist")
|
||||
return fmt.Errorf("users not exist")
|
||||
}
|
||||
|
||||
err := fm.checkInBlackList(account1Id, account2Id)
|
||||
@ -128,12 +127,12 @@ func (fm *FriendsMgr) addFriendRequest(account1Id string, account2Id string) err
|
||||
if fm.pendingReqs[account1Id] == nil {
|
||||
fm.pendingReqs[account1Id] = make(map[string]bool, MaxPendingFriendReqs)
|
||||
}
|
||||
fm.pendingReqs[account1Id][account2Id] = true
|
||||
fm.pendingReqs[account1Id][account2Id] = false
|
||||
|
||||
if fm.pendingReqs[account2Id] == nil {
|
||||
fm.pendingReqs[account2Id] = make(map[string]bool, MaxPendingFriendReqs)
|
||||
}
|
||||
fm.pendingReqs[account2Id][account1Id] = true
|
||||
fm.pendingReqs[account2Id][account1Id] = false
|
||||
|
||||
// persist to db
|
||||
fm.upsertFriendRequest(account1Id, account2Id, "0")
|
||||
@ -144,7 +143,7 @@ func (fm *FriendsMgr) addFriendRequest(account1Id string, account2Id string) err
|
||||
// acceptFriendRequest 接受好友请求
|
||||
func (fm *FriendsMgr) acceptFriendRequest(account1Id string, account2Id string) error {
|
||||
if _, ok := fm.pendingReqs[account1Id][account2Id]; !ok {
|
||||
return errors.New("no pending friend request from account1Id to account2Id")
|
||||
return fmt.Errorf("no pending friend request from account1Id to account2Id")
|
||||
}
|
||||
|
||||
if fm.getFriendCount(account1Id) >= MaxFriendMembers {
|
||||
@ -178,10 +177,10 @@ func (fm *FriendsMgr) acceptFriendRequest(account1Id string, account2Id string)
|
||||
// rejectFriendRequest 拒绝好友请求
|
||||
func (fm *FriendsMgr) rejectFriendRequest(account1Id string, account2Id string) error {
|
||||
if fm.pendingReqs[account1Id] == nil {
|
||||
return errors.New("no pending friend request to reject")
|
||||
return fmt.Errorf("no pending friend request to reject")
|
||||
}
|
||||
if _, ok := fm.pendingReqs[account1Id][account2Id]; !ok {
|
||||
return errors.New("no pending friend request from user1 to user2")
|
||||
return fmt.Errorf("no pending friend request from user1 to user2")
|
||||
}
|
||||
|
||||
// 申请表,申请者,目标者,
|
||||
@ -198,6 +197,11 @@ func (fm *FriendsMgr) deleteFriendShip(account1Id, account2Id string) error {
|
||||
fm.mu.Lock()
|
||||
defer fm.mu.Unlock()
|
||||
|
||||
user2 := fm.getUser(account2Id)
|
||||
if user2 == nil {
|
||||
return fmt.Errorf("user not found, accountId:%s", account2Id)
|
||||
}
|
||||
|
||||
user1Friendships := fm.friendships[account1Id]
|
||||
user2Friendships := fm.friendships[account2Id]
|
||||
|
||||
@ -213,7 +217,7 @@ func (fm *FriendsMgr) deleteFriendShip(account1Id, account2Id string) error {
|
||||
}
|
||||
|
||||
if !found {
|
||||
return errors.New("friendship not found")
|
||||
return fmt.Errorf("friendship not found")
|
||||
}
|
||||
|
||||
for i, friendship := range user2Friendships {
|
||||
@ -275,7 +279,7 @@ func (fm *FriendsMgr) listFriend(accountId string) []*User {
|
||||
func (fm *FriendsMgr) addBlacklist(account1Id string, account2Id string) error {
|
||||
user2 := fm.getUser(account2Id)
|
||||
if user2 == nil {
|
||||
return nil
|
||||
return fmt.Errorf("user not found, accountId:%s", account2Id)
|
||||
}
|
||||
|
||||
if fm.blackList[account1Id] == nil {
|
||||
@ -299,6 +303,11 @@ func (fm *FriendsMgr) addBlacklist(account1Id string, account2Id string) error {
|
||||
|
||||
// removeBlacklist 移除黑名单
|
||||
func (fm *FriendsMgr) removeBlacklist(account1Id string, account2Id string) error {
|
||||
user2 := fm.getUser(account2Id)
|
||||
if user2 == nil {
|
||||
return fmt.Errorf("user not found, accountId:%s", account2Id)
|
||||
}
|
||||
|
||||
if fm.blackList[account1Id] == nil {
|
||||
return fmt.Errorf("your blacklist is emtpy")
|
||||
}
|
||||
@ -357,13 +366,6 @@ func (fm *FriendsMgr) findFriendShipIndex(Account1Id, Account2Id string) int {
|
||||
return -1
|
||||
}
|
||||
|
||||
func (fm *FriendsMgr) getUser(accountId string) *User {
|
||||
if user, ok := fm.users[accountId]; ok {
|
||||
return user
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fm *FriendsMgr) checkInBlackList(account1Id, account2Id string) error {
|
||||
if fm.blackList[account1Id] == nil {
|
||||
fm.blackList[account1Id] = make(map[string]bool, MaxBlockedMembers)
|
||||
@ -392,3 +394,31 @@ func swapMiniAccount(account1Id, account2Id string) (string, string) {
|
||||
}
|
||||
return account1Id, account2Id
|
||||
}
|
||||
|
||||
func (fm *FriendsMgr) getUser(accountId string) *User {
|
||||
if user, ok := fm.users[accountId]; ok {
|
||||
return user
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fm *FriendsMgr) getFriendships(accountId string) []*Friendship {
|
||||
if ships, ok := fm.friendships[accountId]; ok {
|
||||
return ships
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fm *FriendsMgr) getPendingReqs(accountId string) map[string]bool {
|
||||
if reqs, ok := fm.pendingReqs[accountId]; ok {
|
||||
return reqs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fm *FriendsMgr) getBlacklist(accountId string) map[string]bool {
|
||||
if b, ok := fm.blackList[accountId]; ok {
|
||||
return b
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ func (this *HandlerMgr) init() {
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMDeleteFriendShip), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMAddBlacklist), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMRemoveBlacklist), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMFriendInfo), PLAYER_HANDLER_ID)
|
||||
// 公会
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMGuildInfo), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMCreateGuild), PLAYER_HANDLER_ID)
|
||||
|
@ -198,9 +198,33 @@ func (p *Player) CMRemoveBlacklist(hdr *f5.MsgHdr, msg *cs.CMRemoveBlacklist) {
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
}
|
||||
|
||||
//func (fm *Player) FillFriend(rspMsg) {
|
||||
// //
|
||||
//}
|
||||
// CMFriendInfo 我的好友信息
|
||||
func (p *Player) CMFriendInfo(hdr *f5.MsgHdr, msg *cs.CMFriendInfo) {
|
||||
rspMsg := new(cs.SMFriendInfo)
|
||||
accountId := p.accountId
|
||||
|
||||
// friendships
|
||||
users := friendMgr.listFriend(accountId)
|
||||
for _, user := range users {
|
||||
rspMsg.FriendshipsAccountIds = append(rspMsg.FriendshipsAccountIds, user.AccountId)
|
||||
}
|
||||
|
||||
// pending reqs
|
||||
reqs := friendMgr.getPendingReqs(accountId)
|
||||
for reqAccountId, _ := range reqs {
|
||||
rspMsg.PendingReqsAccountIds = append(rspMsg.PendingReqsAccountIds, reqAccountId)
|
||||
}
|
||||
|
||||
// blacklist
|
||||
blacklist := friendMgr.getBlacklist(accountId)
|
||||
for blockedAccountId, isRemoved := range blacklist {
|
||||
if isRemoved == false {
|
||||
rspMsg.BlacklistAccountIds = append(rspMsg.BlacklistAccountIds, blockedAccountId)
|
||||
}
|
||||
}
|
||||
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
}
|
||||
|
||||
// CMGuildInfo 我的公会信息
|
||||
func (p *Player) CMGuildInfo(hdr *f5.MsgHdr, msg *cs.CMGuildInfo) {
|
||||
|
@ -20,6 +20,7 @@ enum CMMessageId_e
|
||||
_CMDeleteFriendShip = 112;
|
||||
_CMAddBlacklist = 113;
|
||||
_CMRemoveBlacklist = 114;
|
||||
_CMFriendInfo = 115;
|
||||
|
||||
// 公会相关
|
||||
_CMGuildInfo = 120;
|
||||
@ -52,6 +53,7 @@ enum SMMessageId_e
|
||||
_SMDeleteFriendShip = 112;
|
||||
_SMAddBlacklist = 113;
|
||||
_SMRemoveBlacklist = 114;
|
||||
_SMFriendInfo = 115;
|
||||
|
||||
// 公会相关
|
||||
_SMGuildInfo = 120;
|
||||
|
@ -118,6 +118,19 @@ message SMReconnect
|
||||
}
|
||||
|
||||
|
||||
// 请求好友信息
|
||||
message CMFriendInfo
|
||||
{
|
||||
}
|
||||
|
||||
// 回复好友信息
|
||||
message SMFriendInfo
|
||||
{
|
||||
repeated string friendships_account_ids = 1;
|
||||
repeated string pending_reqs_account_ids = 2;
|
||||
repeated string blacklist_account_ids = 3;
|
||||
}
|
||||
|
||||
// 请求搜索用户
|
||||
message CMSearchUser
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user