更新msgid消息协议
This commit is contained in:
parent
5a183f3a90
commit
2d9ff4c1a1
@ -38,12 +38,14 @@ type MsgHandler interface {
|
||||
CMPing(*f5.MsgHdr, *CMPing)
|
||||
CMLogin(*f5.MsgHdr, *CMLogin)
|
||||
CMReconnect(*f5.MsgHdr, *CMReconnect)
|
||||
CMSearchFriend(*f5.MsgHdr, *CMSearchFriend)
|
||||
CMSearchUser(*f5.MsgHdr, *CMSearchUser)
|
||||
CMSearchUserByAccountId(*f5.MsgHdr, *CMSearchUserByAccountId)
|
||||
CMAddFriendRequest(*f5.MsgHdr, *CMAddFriendRequest)
|
||||
CMAcceptFriendRequest(*f5.MsgHdr, *CMAcceptFriendRequest)
|
||||
CMRejectFriendRequest(*f5.MsgHdr, *CMRejectFriendRequest)
|
||||
CMListPendingFriendRequest(*f5.MsgHdr, *CMListPendingFriendRequest)
|
||||
CMListFriend(*f5.MsgHdr, *CMListFriend)
|
||||
CMDeleteFriendShip(*f5.MsgHdr, *CMDeleteFriendShip)
|
||||
}
|
||||
|
||||
func (this *MsgHandlerImpl) CMPing(hdr *f5.MsgHdr, msg *CMPing) {
|
||||
@ -55,7 +57,10 @@ func (this *MsgHandlerImpl) CMLogin(hdr *f5.MsgHdr, msg *CMLogin) {
|
||||
func (this *MsgHandlerImpl) CMReconnect(hdr *f5.MsgHdr, msg *CMReconnect) {
|
||||
}
|
||||
|
||||
func (this *MsgHandlerImpl) CMSearchFriend(hdr *f5.MsgHdr, msg *CMSearchFriend) {
|
||||
func (this *MsgHandlerImpl) CMSearchUser(hdr *f5.MsgHdr, msg *CMSearchUser) {
|
||||
}
|
||||
|
||||
func (this *MsgHandlerImpl) CMSearchUserByAccountId(hdr *f5.MsgHdr, msg *CMSearchUserByAccountId) {
|
||||
}
|
||||
|
||||
func (this *MsgHandlerImpl) CMAddFriendRequest(hdr *f5.MsgHdr, msg *CMAddFriendRequest) {
|
||||
@ -73,6 +78,9 @@ func (this *MsgHandlerImpl) CMListPendingFriendRequest(hdr *f5.MsgHdr, msg *CMLi
|
||||
func (this *MsgHandlerImpl) CMListFriend(hdr *f5.MsgHdr, msg *CMListFriend) {
|
||||
}
|
||||
|
||||
func (this *MsgHandlerImpl) CMDeleteFriendShip(hdr *f5.MsgHdr, msg *CMDeleteFriendShip) {
|
||||
}
|
||||
|
||||
func (this *CMPing) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMPing)
|
||||
}
|
||||
@ -101,12 +109,20 @@ func (this *SMReconnect) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMReconnect)
|
||||
}
|
||||
|
||||
func (this *CMSearchFriend) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMSearchFriend)
|
||||
func (this *CMSearchUser) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMSearchUser)
|
||||
}
|
||||
|
||||
func (this *SMSearchFriend) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMSearchFriend)
|
||||
func (this *SMSearchUser) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMSearchUser)
|
||||
}
|
||||
|
||||
func (this *CMSearchUserByAccountId) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMSearchUserByAccountId)
|
||||
}
|
||||
|
||||
func (this *SMSearchUserByAccountId) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMSearchUserByAccountId)
|
||||
}
|
||||
|
||||
func (this *CMAddFriendRequest) GetNetMsgId() uint16 {
|
||||
@ -149,6 +165,14 @@ func (this *SMListFriend) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMListFriend)
|
||||
}
|
||||
|
||||
func (this *CMDeleteFriendShip) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMDeleteFriendShip)
|
||||
}
|
||||
|
||||
func (this *SMDeleteFriendShip) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMDeleteFriendShip)
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
handlers[int(CMMessageIdE__CMPing)] = &CsNetMsgHandler{
|
||||
@ -187,15 +211,27 @@ func init() {
|
||||
},
|
||||
}
|
||||
|
||||
handlers[int(CMMessageIdE__CMSearchFriend)] = &CsNetMsgHandler{
|
||||
MsgId: int(CMMessageIdE__CMSearchFriend),
|
||||
handlers[int(CMMessageIdE__CMSearchUser)] = &CsNetMsgHandler{
|
||||
MsgId: int(CMMessageIdE__CMSearchUser),
|
||||
ParseCb: func (data []byte) interface{} {
|
||||
msg := &CMSearchFriend{}
|
||||
msg := &CMSearchUser{}
|
||||
proto.Unmarshal(data, msg)
|
||||
return msg
|
||||
},
|
||||
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
|
||||
handler.CMSearchFriend(hdr, hdr.Msg.(*CMSearchFriend))
|
||||
handler.CMSearchUser(hdr, hdr.Msg.(*CMSearchUser))
|
||||
},
|
||||
}
|
||||
|
||||
handlers[int(CMMessageIdE__CMSearchUserByAccountId)] = &CsNetMsgHandler{
|
||||
MsgId: int(CMMessageIdE__CMSearchUserByAccountId),
|
||||
ParseCb: func (data []byte) interface{} {
|
||||
msg := &CMSearchUserByAccountId{}
|
||||
proto.Unmarshal(data, msg)
|
||||
return msg
|
||||
},
|
||||
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
|
||||
handler.CMSearchUserByAccountId(hdr, hdr.Msg.(*CMSearchUserByAccountId))
|
||||
},
|
||||
}
|
||||
|
||||
@ -259,4 +295,16 @@ func init() {
|
||||
},
|
||||
}
|
||||
|
||||
handlers[int(CMMessageIdE__CMDeleteFriendShip)] = &CsNetMsgHandler{
|
||||
MsgId: int(CMMessageIdE__CMDeleteFriendShip),
|
||||
ParseCb: func (data []byte) interface{} {
|
||||
msg := &CMDeleteFriendShip{}
|
||||
proto.Unmarshal(data, msg)
|
||||
return msg
|
||||
},
|
||||
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
|
||||
handler.CMDeleteFriendShip(hdr, hdr.Msg.(*CMDeleteFriendShip))
|
||||
},
|
||||
}
|
||||
|
||||
}
|
@ -27,12 +27,14 @@ const (
|
||||
CMMessageIdE__CMPing CMMessageIdE = 101
|
||||
CMMessageIdE__CMLogin CMMessageIdE = 103
|
||||
CMMessageIdE__CMReconnect CMMessageIdE = 104
|
||||
CMMessageIdE__CMSearchFriend CMMessageIdE = 105
|
||||
CMMessageIdE__CMAddFriendRequest CMMessageIdE = 106
|
||||
CMMessageIdE__CMAcceptFriendRequest CMMessageIdE = 107
|
||||
CMMessageIdE__CMRejectFriendRequest CMMessageIdE = 108
|
||||
CMMessageIdE__CMListPendingFriendRequest CMMessageIdE = 109
|
||||
CMMessageIdE__CMListFriend CMMessageIdE = 110
|
||||
CMMessageIdE__CMSearchUserByAccountId CMMessageIdE = 105
|
||||
CMMessageIdE__CMSearchUser CMMessageIdE = 106
|
||||
CMMessageIdE__CMAddFriendRequest CMMessageIdE = 107
|
||||
CMMessageIdE__CMAcceptFriendRequest CMMessageIdE = 108
|
||||
CMMessageIdE__CMRejectFriendRequest CMMessageIdE = 109
|
||||
CMMessageIdE__CMListPendingFriendRequest CMMessageIdE = 110
|
||||
CMMessageIdE__CMListFriend CMMessageIdE = 111
|
||||
CMMessageIdE__CMDeleteFriendShip CMMessageIdE = 112
|
||||
)
|
||||
|
||||
// Enum value maps for CMMessageIdE.
|
||||
@ -41,23 +43,27 @@ var (
|
||||
101: "_CMPing",
|
||||
103: "_CMLogin",
|
||||
104: "_CMReconnect",
|
||||
105: "_CMSearchFriend",
|
||||
106: "_CMAddFriendRequest",
|
||||
107: "_CMAcceptFriendRequest",
|
||||
108: "_CMRejectFriendRequest",
|
||||
109: "_CMListPendingFriendRequest",
|
||||
110: "_CMListFriend",
|
||||
105: "_CMSearchUserByAccountId",
|
||||
106: "_CMSearchUser",
|
||||
107: "_CMAddFriendRequest",
|
||||
108: "_CMAcceptFriendRequest",
|
||||
109: "_CMRejectFriendRequest",
|
||||
110: "_CMListPendingFriendRequest",
|
||||
111: "_CMListFriend",
|
||||
112: "_CMDeleteFriendShip",
|
||||
}
|
||||
CMMessageIdE_value = map[string]int32{
|
||||
"_CMPing": 101,
|
||||
"_CMLogin": 103,
|
||||
"_CMReconnect": 104,
|
||||
"_CMSearchFriend": 105,
|
||||
"_CMAddFriendRequest": 106,
|
||||
"_CMAcceptFriendRequest": 107,
|
||||
"_CMRejectFriendRequest": 108,
|
||||
"_CMListPendingFriendRequest": 109,
|
||||
"_CMListFriend": 110,
|
||||
"_CMSearchUserByAccountId": 105,
|
||||
"_CMSearchUser": 106,
|
||||
"_CMAddFriendRequest": 107,
|
||||
"_CMAcceptFriendRequest": 108,
|
||||
"_CMRejectFriendRequest": 109,
|
||||
"_CMListPendingFriendRequest": 110,
|
||||
"_CMListFriend": 111,
|
||||
"_CMDeleteFriendShip": 112,
|
||||
}
|
||||
)
|
||||
|
||||
@ -105,12 +111,14 @@ const (
|
||||
SMMessageIdE__SMRpcError SMMessageIdE = 102
|
||||
SMMessageIdE__SMLogin SMMessageIdE = 103
|
||||
SMMessageIdE__SMReconnect SMMessageIdE = 104
|
||||
SMMessageIdE__SMSearchFriend SMMessageIdE = 105
|
||||
SMMessageIdE__SMAddFriendRequest SMMessageIdE = 106
|
||||
SMMessageIdE__SMAcceptFriendRequest SMMessageIdE = 107
|
||||
SMMessageIdE__SMRejectFriendRequest SMMessageIdE = 108
|
||||
SMMessageIdE__SMListPendingFriendRequest SMMessageIdE = 109
|
||||
SMMessageIdE__SMListFriend SMMessageIdE = 110
|
||||
SMMessageIdE__SMSearchUserByAccountId SMMessageIdE = 105
|
||||
SMMessageIdE__SMSearchUser SMMessageIdE = 106
|
||||
SMMessageIdE__SMAddFriendRequest SMMessageIdE = 107
|
||||
SMMessageIdE__SMAcceptFriendRequest SMMessageIdE = 108
|
||||
SMMessageIdE__SMRejectFriendRequest SMMessageIdE = 109
|
||||
SMMessageIdE__SMListPendingFriendRequest SMMessageIdE = 110
|
||||
SMMessageIdE__SMListFriend SMMessageIdE = 111
|
||||
SMMessageIdE__SMDeleteFriendShip SMMessageIdE = 112
|
||||
)
|
||||
|
||||
// Enum value maps for SMMessageIdE.
|
||||
@ -120,24 +128,28 @@ var (
|
||||
102: "_SMRpcError",
|
||||
103: "_SMLogin",
|
||||
104: "_SMReconnect",
|
||||
105: "_SMSearchFriend",
|
||||
106: "_SMAddFriendRequest",
|
||||
107: "_SMAcceptFriendRequest",
|
||||
108: "_SMRejectFriendRequest",
|
||||
109: "_SMListPendingFriendRequest",
|
||||
110: "_SMListFriend",
|
||||
105: "_SMSearchUserByAccountId",
|
||||
106: "_SMSearchUser",
|
||||
107: "_SMAddFriendRequest",
|
||||
108: "_SMAcceptFriendRequest",
|
||||
109: "_SMRejectFriendRequest",
|
||||
110: "_SMListPendingFriendRequest",
|
||||
111: "_SMListFriend",
|
||||
112: "_SMDeleteFriendShip",
|
||||
}
|
||||
SMMessageIdE_value = map[string]int32{
|
||||
"_SMPing": 101,
|
||||
"_SMRpcError": 102,
|
||||
"_SMLogin": 103,
|
||||
"_SMReconnect": 104,
|
||||
"_SMSearchFriend": 105,
|
||||
"_SMAddFriendRequest": 106,
|
||||
"_SMAcceptFriendRequest": 107,
|
||||
"_SMRejectFriendRequest": 108,
|
||||
"_SMListPendingFriendRequest": 109,
|
||||
"_SMListFriend": 110,
|
||||
"_SMSearchUserByAccountId": 105,
|
||||
"_SMSearchUser": 106,
|
||||
"_SMAddFriendRequest": 107,
|
||||
"_SMAcceptFriendRequest": 108,
|
||||
"_SMRejectFriendRequest": 109,
|
||||
"_SMListPendingFriendRequest": 110,
|
||||
"_SMListFriend": 111,
|
||||
"_SMDeleteFriendShip": 112,
|
||||
}
|
||||
)
|
||||
|
||||
@ -182,35 +194,42 @@ 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, 0xd6, 0x01, 0x0a, 0x0d, 0x43, 0x4d, 0x4d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x12, 0x02, 0x63, 0x73, 0x2a, 0x8b, 0x02, 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,
|
||||
0x74, 0x10, 0x68, 0x12, 0x13, 0x0a, 0x0f, 0x5f, 0x43, 0x4d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68,
|
||||
0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x10, 0x69, 0x12, 0x17, 0x0a, 0x13, 0x5f, 0x43, 0x4d, 0x41,
|
||||
0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10,
|
||||
0x6a, 0x12, 0x1a, 0x0a, 0x16, 0x5f, 0x43, 0x4d, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x46, 0x72,
|
||||
0x74, 0x10, 0x68, 0x12, 0x1c, 0x0a, 0x18, 0x5f, 0x43, 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, 0x43, 0x4d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73,
|
||||
0x65, 0x72, 0x10, 0x6a, 0x12, 0x17, 0x0a, 0x13, 0x5f, 0x43, 0x4d, 0x41, 0x64, 0x64, 0x46, 0x72,
|
||||
0x69, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6b, 0x12, 0x1a, 0x0a,
|
||||
0x16, 0x5f, 0x43, 0x4d, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6c, 0x12, 0x1f, 0x0a, 0x1b, 0x5f, 0x43, 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, 0x6d, 0x12, 0x11, 0x0a, 0x0d, 0x5f, 0x43,
|
||||
0x4d, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x10, 0x6e, 0x2a, 0xe7, 0x01,
|
||||
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, 0x13, 0x0a,
|
||||
0x0f, 0x5f, 0x53, 0x4d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64,
|
||||
0x10, 0x69, 0x12, 0x17, 0x0a, 0x13, 0x5f, 0x53, 0x4d, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65,
|
||||
0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x6a, 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, 0x6b, 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, 0x6c, 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, 0x6d, 0x12, 0x11, 0x0a, 0x0d, 0x5f, 0x53, 0x4d, 0x4c, 0x69, 0x73, 0x74, 0x46,
|
||||
0x72, 0x69, 0x65, 0x6e, 0x64, 0x10, 0x6e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x63, 0x73,
|
||||
0x16, 0x5f, 0x43, 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, 0x43, 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, 0x43, 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, 0x43, 0x4d, 0x4c, 0x69, 0x73,
|
||||
0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x10, 0x6f, 0x12, 0x17, 0x0a, 0x13, 0x5f, 0x43, 0x4d,
|
||||
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x68, 0x69, 0x70,
|
||||
0x10, 0x70, 0x2a, 0x9c, 0x02, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x63, 0x73,
|
||||
}
|
||||
|
||||
var (
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -250,10 +250,31 @@ func (fm *FriendsMgr) rejectFriendRequest(account1Id string, account2Id string)
|
||||
}
|
||||
|
||||
// deleteFriendShip 删除好友
|
||||
func (fm *FriendsMgr) deleteFriendShip(account1Id, account2Id string) {
|
||||
fm.findFriendShipIndex(account1Id, account2Id)
|
||||
//if account2Index < 0 {
|
||||
//}
|
||||
func (fm *FriendsMgr) deleteFriendShip(account1ID, account2ID string) error {
|
||||
user1Friendships := fm.friendships[account1ID]
|
||||
user2Friendships := fm.friendships[account2ID]
|
||||
|
||||
var found bool
|
||||
for i, friendship := range user1Friendships {
|
||||
if friendship.User1.Username == account2ID || friendship.User2.Username == account2ID {
|
||||
fm.friendships[account1ID] = append(user1Friendships[:i], user1Friendships[i+1:]...)
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
return errors.New("friendship not found")
|
||||
}
|
||||
|
||||
for i, friendship := range user2Friendships {
|
||||
if friendship.User1.Username == account1ID || friendship.User2.Username == account1ID {
|
||||
fm.friendships[account2ID] = append(user2Friendships[:i], user2Friendships[i+1:]...)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// getFriendCount 好友数量
|
||||
|
@ -14,12 +14,14 @@ func (this *HandlerMgr) init() {
|
||||
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMPing), PLAYER_MGR_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMLogin), PLAYER_MGR_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMSearchFriend), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMSearchUser), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMSearchUserByAccountId), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMAddFriendRequest), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMAcceptFriendRequest), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMRejectFriendRequest), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMListPendingFriendRequest), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMListFriend), PLAYER_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMDeleteFriendShip), PLAYER_HANDLER_ID)
|
||||
}
|
||||
|
||||
func (this *HandlerMgr) unInit() {
|
||||
|
@ -13,23 +13,35 @@ type Player struct {
|
||||
sessionId string
|
||||
}
|
||||
|
||||
// CMAddFriendRequest 搜索用户
|
||||
func (p *Player) CMSearchFriend(hdr *f5.MsgHdr, msg *cs.CMSearchFriend) {
|
||||
rspMsg := new(cs.SMSearchFriend)
|
||||
// CMSearchUser 搜索用户
|
||||
func (p *Player) CMSearchUser(hdr *f5.MsgHdr, msg *cs.CMSearchUser) {
|
||||
rspMsg := new(cs.SMSearchUser)
|
||||
//rspMsg := &cs.SMSearchFriend{}
|
||||
listUsers := friendMgr.searchUsers(msg.GetSearchKeyword())
|
||||
for _, u := range listUsers {
|
||||
friend := &cs.MFFriend{
|
||||
friend := &cs.MFUser{
|
||||
AccountId: &u.AccountId,
|
||||
Username: &u.Username,
|
||||
}
|
||||
rspMsg.Friends = append(rspMsg.Friends, friend)
|
||||
rspMsg.Users = append(rspMsg.Users, friend)
|
||||
}
|
||||
fmt.Printf("length%d \n", len(rspMsg.Friends))
|
||||
fmt.Printf("length%d \n", len(rspMsg.Users))
|
||||
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
}
|
||||
|
||||
// CMSearchUserByAccountId 搜索指定用户
|
||||
func (p *Player) CMSearchUserByAccountId(hdr *f5.MsgHdr, msg *cs.CMSearchUserByAccountId) {
|
||||
rspMsg := new(cs.SMSearchUserByAccountId)
|
||||
user := friendMgr.searchByAccountId(msg.GetSearchKeyword())
|
||||
if user != nil {
|
||||
rspMsg.AccountId = &user.AccountId
|
||||
rspMsg.Username = &user.Username
|
||||
fmt.Printf("search result: accountId:%s \n", *rspMsg.AccountId)
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
}
|
||||
|
||||
// CMAddFriendRequest 添加好友请求
|
||||
func (p *Player) CMAddFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAddFriendRequest) {
|
||||
rspMsg := &cs.SMAddFriendRequest{}
|
||||
@ -111,20 +123,39 @@ func (p *Player) CMListFriend(hdr *f5.MsgHdr, msg *cs.CMListFriend) {
|
||||
accountId := p.accountId
|
||||
for _, friendship := range friendMgr.friendships[accountId] {
|
||||
if friendship.User1.AccountId != accountId {
|
||||
friend := &cs.MFFriend{
|
||||
friend := &cs.MFUser{
|
||||
AccountId: &friendship.User1.AccountId,
|
||||
Username: &friendship.User1.Username,
|
||||
}
|
||||
rspMsg.Friends = append(rspMsg.Friends, friend)
|
||||
rspMsg.Users = append(rspMsg.Users, friend)
|
||||
} else {
|
||||
friend := &cs.MFFriend{
|
||||
friend := &cs.MFUser{
|
||||
AccountId: &friendship.User2.AccountId,
|
||||
Username: &friendship.User2.Username,
|
||||
}
|
||||
rspMsg.Friends = append(rspMsg.Friends, friend)
|
||||
rspMsg.Users = append(rspMsg.Users, friend)
|
||||
}
|
||||
}
|
||||
f5.GetSysLog().Info("CMListFriend friends count:%d\n", len(rspMsg.Friends))
|
||||
f5.GetSysLog().Info("CMListFriend friends count:%d\n", len(rspMsg.Users))
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
}
|
||||
|
||||
// CMDeleteFriendShip 删除好友
|
||||
func (p *Player) CMDeleteFriendShip(hdr *f5.MsgHdr, msg *cs.CMDeleteFriendShip) {
|
||||
rspMsg := &cs.SMDeleteFriendShip{}
|
||||
user1Id := p.accountId
|
||||
user2Id := msg.GetTargetAccountId()
|
||||
err := friendMgr.deleteFriendShip(user1Id, user2Id)
|
||||
if err != nil {
|
||||
reason := err.Error()
|
||||
rspMsg.Reason = &reason
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
f5.GetSysLog().Info("CMDeleteFriendShip: reason:%s, params: %s or %s\n", reason, user1Id, user2Id)
|
||||
return
|
||||
}
|
||||
|
||||
status := "deleted"
|
||||
rspMsg.Status = &status
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,14 @@ enum CMMessageId_e
|
||||
_CMLogin = 103;
|
||||
_CMReconnect = 104;
|
||||
|
||||
_CMSearchFriend = 105;
|
||||
_CMAddFriendRequest = 106;
|
||||
_CMAcceptFriendRequest = 107;
|
||||
_CMRejectFriendRequest = 108;
|
||||
_CMListPendingFriendRequest = 109;
|
||||
_CMListFriend = 110;
|
||||
_CMSearchUserByAccountId = 105;
|
||||
_CMSearchUser = 106;
|
||||
_CMAddFriendRequest = 107;
|
||||
_CMAcceptFriendRequest = 108;
|
||||
_CMRejectFriendRequest = 109;
|
||||
_CMListPendingFriendRequest = 110;
|
||||
_CMListFriend = 111;
|
||||
_CMDeleteFriendShip = 112;
|
||||
}
|
||||
|
||||
enum SMMessageId_e
|
||||
@ -23,12 +25,14 @@ enum SMMessageId_e
|
||||
_SMRpcError = 102;
|
||||
_SMLogin = 103;
|
||||
_SMReconnect = 104;
|
||||
|
||||
_SMSearchFriend = 105;
|
||||
_SMAddFriendRequest = 106;
|
||||
_SMAcceptFriendRequest = 107;
|
||||
_SMRejectFriendRequest = 108;
|
||||
_SMListPendingFriendRequest = 109;
|
||||
_SMListFriend = 110;
|
||||
|
||||
_SMSearchUserByAccountId = 105;
|
||||
_SMSearchUser = 106;
|
||||
_SMAddFriendRequest = 107;
|
||||
_SMAcceptFriendRequest = 108;
|
||||
_SMRejectFriendRequest = 109;
|
||||
_SMListPendingFriendRequest = 110;
|
||||
_SMListFriend = 111;
|
||||
_SMDeleteFriendShip = 112;
|
||||
|
||||
}
|
||||
|
@ -119,15 +119,28 @@ message SMReconnect
|
||||
|
||||
|
||||
// 请求搜索用户
|
||||
message CMSearchFriend
|
||||
message CMSearchUser
|
||||
{
|
||||
optional string search_keyword = 1; //搜索文本关键字
|
||||
}
|
||||
|
||||
// 回复搜索用户
|
||||
message SMSearchFriend
|
||||
message SMSearchUser
|
||||
{
|
||||
repeated MFFriend friends = 1;
|
||||
repeated MFUser users = 1;
|
||||
}
|
||||
|
||||
// 请求搜索用户 CMSearchUserByAccountId
|
||||
message CMSearchUserByAccountId
|
||||
{
|
||||
optional string search_keyword = 1; //搜索account id
|
||||
}
|
||||
|
||||
// 回复搜索用户
|
||||
message SMSearchUserByAccountId
|
||||
{
|
||||
optional string account_id = 1;
|
||||
optional string username = 2;
|
||||
}
|
||||
|
||||
// 请求发送添加好友请求
|
||||
@ -189,10 +202,24 @@ message CMListFriend
|
||||
// 回复我的好友列表
|
||||
message SMListFriend
|
||||
{
|
||||
repeated MFFriend friends = 1;
|
||||
repeated MFUser users = 1;
|
||||
}
|
||||
|
||||
message MFFriend {
|
||||
|
||||
// 请求删除好友
|
||||
message CMDeleteFriendShip
|
||||
{
|
||||
optional string target_account_id = 1; // 账号id
|
||||
}
|
||||
|
||||
// 回复删除好友
|
||||
message SMDeleteFriendShip
|
||||
{
|
||||
optional string reason = 1;
|
||||
optional string status = 2;
|
||||
}
|
||||
|
||||
message MFUser {
|
||||
optional string account_id = 1;
|
||||
optional string username = 2;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user