diff --git a/client/builders.go b/client/builders.go index e6c8bd15..1e588ecd 100644 --- a/client/builders.go +++ b/client/builders.go @@ -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() diff --git a/client/client.go b/client/client.go index ca39d596..931a8715 100644 --- a/client/client.go +++ b/client/client.go @@ -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) } } diff --git a/client/system_msg.go b/client/system_msg.go index 491306d7..0dccfee0 100644 --- a/client/system_msg.go +++ b/client/system_msg.go @@ -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{}