1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

fix suspicious system msg action.

This commit is contained in:
Mrs4s 2021-02-11 10:25:53 +08:00
parent 800bf525ed
commit 9054bf96ff
3 changed files with 74 additions and 68 deletions

View File

@ -648,72 +648,6 @@ func (c *QQClient) buildSystemMsgNewFriendPacket() (uint16, []byte) {
return seq, packet
}
// ProfileService.Pb.ReqSystemMsgAction.Group
func (c *QQClient) buildSystemMsgGroupActionPacket(reqId, requester, group int64, isInvite, accept, block bool, reason string) (uint16, []byte) {
seq := c.nextSeq()
req := &structmsg.ReqSystemMsgAction{
MsgType: 1,
MsgSeq: reqId,
ReqUin: requester,
SubType: 1,
SrcId: 3,
SubSrcId: func() int32 {
if isInvite {
return 10016
}
return 31
}(),
GroupMsgType: func() int32 {
if isInvite {
return 2
}
return 1
}(),
ActionInfo: &structmsg.SystemMsgActionInfo{
Type: func() int32 {
if accept {
return 11
}
return 12
}(),
GroupCode: group,
Blacklist: block,
Msg: reason,
Sig: EmptyBytes,
},
Language: 1000,
}
payload, _ := proto.Marshal(req)
packet := packets.BuildUniPacket(c.Uin, seq, "ProfileService.Pb.ReqSystemMsgAction.Group", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
return seq, packet
}
// ProfileService.Pb.ReqSystemMsgAction.Friend
func (c *QQClient) buildSystemMsgFriendActionPacket(reqId, requester int64, accept bool) (uint16, []byte) {
seq := c.nextSeq()
req := &structmsg.ReqSystemMsgAction{
MsgType: 1,
MsgSeq: reqId,
ReqUin: requester,
SubType: 1,
SrcId: 6,
SubSrcId: 7,
ActionInfo: &structmsg.SystemMsgActionInfo{
Type: func() int32 {
if accept {
return 2
}
return 3
}(),
Blacklist: false,
AddFrdSNInfo: &structmsg.AddFrdSNInfo{},
},
}
payload, _ := proto.Marshal(req)
packet := packets.BuildUniPacket(c.Uin, seq, "ProfileService.Pb.ReqSystemMsgAction.Friend", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
return seq, packet
}
// friendlist.ModifyGroupCardReq
func (c *QQClient) buildEditGroupTagPacket(groupCode, memberUin int64, newTag string) (uint16, []byte) {
seq := c.nextSeq()

View File

@ -609,10 +609,16 @@ func (c *QQClient) SolveGroupJoinRequest(i interface{}, accept, block bool, reas
switch req := i.(type) {
case *UserJoinGroupRequest:
_, pkt := c.buildSystemMsgGroupActionPacket(req.RequestId, req.RequesterUin, req.GroupCode, false, accept, block, reason)
_, pkt := c.buildSystemMsgGroupActionPacket(req.RequestId, req.RequesterUin, req.GroupCode, func() int32 {
if req.Suspicious {
return 2
} else {
return 1
}
}(), false, accept, block, reason)
_ = c.send(pkt)
case *GroupInvitedRequest:
_, pkt := c.buildSystemMsgGroupActionPacket(req.RequestId, req.InvitorUin, req.GroupCode, true, accept, block, reason)
_, pkt := c.buildSystemMsgGroupActionPacket(req.RequestId, req.InvitorUin, req.GroupCode, 1, true, accept, block, reason)
_ = c.send(pkt)
}
}

View File

@ -133,6 +133,72 @@ func (c *QQClient) buildSystemMsgNewGroupPacket(suspicious bool) (uint16, []byte
return seq, packet
}
// ProfileService.Pb.ReqSystemMsgAction.Group
func (c *QQClient) buildSystemMsgGroupActionPacket(reqId, requester, group int64, msgType int32, isInvite, accept, block bool, reason string) (uint16, []byte) {
seq := c.nextSeq()
req := &structmsg.ReqSystemMsgAction{
MsgType: msgType,
MsgSeq: reqId,
ReqUin: requester,
SubType: 1,
SrcId: 3,
SubSrcId: func() int32 {
if isInvite {
return 10016
}
return 31
}(),
GroupMsgType: func() int32 {
if isInvite {
return 2
}
return 1
}(),
ActionInfo: &structmsg.SystemMsgActionInfo{
Type: func() int32 {
if accept {
return 11
}
return 12
}(),
GroupCode: group,
Blacklist: block,
Msg: reason,
Sig: EmptyBytes,
},
Language: 1000,
}
payload, _ := proto.Marshal(req)
packet := packets.BuildUniPacket(c.Uin, seq, "ProfileService.Pb.ReqSystemMsgAction.Group", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
return seq, packet
}
// ProfileService.Pb.ReqSystemMsgAction.Friend
func (c *QQClient) buildSystemMsgFriendActionPacket(reqId, requester int64, accept bool) (uint16, []byte) {
seq := c.nextSeq()
req := &structmsg.ReqSystemMsgAction{
MsgType: 1,
MsgSeq: reqId,
ReqUin: requester,
SubType: 1,
SrcId: 6,
SubSrcId: 7,
ActionInfo: &structmsg.SystemMsgActionInfo{
Type: func() int32 {
if accept {
return 2
}
return 3
}(),
Blacklist: false,
AddFrdSNInfo: &structmsg.AddFrdSNInfo{},
},
}
payload, _ := proto.Marshal(req)
packet := packets.BuildUniPacket(c.Uin, seq, "ProfileService.Pb.ReqSystemMsgAction.Friend", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
return seq, packet
}
// ProfileService.Pb.ReqSystemMsgNew.Group
func decodeSystemMsgGroupPacket(c *QQClient, _ uint16, payload []byte) (interface{}, error) {
rsp := structmsg.RspSystemMsgNew{}