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

refactor: move c.nextSeq to c.uniPacket

This commit is contained in:
wdvxdr 2021-12-17 23:50:30 +08:00
parent 1c29ac7d96
commit 6b5ba9f9c4
No known key found for this signature in database
GPG Key ID: 703F8C071DE7A1B6
22 changed files with 97 additions and 230 deletions

View File

@ -509,7 +509,7 @@ func (c *QQClient) buildStatusSetPacket(status, extStatus int32) (uint16, []byte
Context: make(map[string]string), Context: make(map[string]string),
Status: make(map[string]string), Status: make(map[string]string),
} }
return c.uniPacketWithSeq("StatSvc.SetStatusFromClient", pkt.ToBytes()) return c.uniPacket("StatSvc.SetStatusFromClient", pkt.ToBytes())
} }
// ConfigPushSvc.PushResp // ConfigPushSvc.PushResp
@ -529,7 +529,7 @@ func (c *QQClient) buildConfPushRespPacket(t int32, pktSeq int64, jceBuf []byte)
Context: make(map[string]string), Context: make(map[string]string),
Status: make(map[string]string), Status: make(map[string]string),
} }
return c.uniPacketWithSeq("ConfigPushSvc.PushResp", pkt.ToBytes()) return c.uniPacket("ConfigPushSvc.PushResp", pkt.ToBytes())
} }
// friendlist.getFriendGroupList // friendlist.getFriendGroupList
@ -585,7 +585,7 @@ func (c *QQClient) buildFriendGroupListRequestPacket(friendStartIndex, friendLis
Context: make(map[string]string), Context: make(map[string]string),
Status: make(map[string]string), Status: make(map[string]string),
} }
return c.uniPacketWithSeq("friendlist.getFriendGroupList", pkt.ToBytes()) return c.uniPacket("friendlist.getFriendGroupList", pkt.ToBytes())
} }
// SummaryCard.ReqSummaryCard // SummaryCard.ReqSummaryCard
@ -669,12 +669,11 @@ func (c *QQClient) buildSummaryCardRequestPacket(target int64) (uint16, []byte)
Context: make(map[string]string), Context: make(map[string]string),
Status: make(map[string]string), Status: make(map[string]string),
} }
return seq, c.uniPacket(seq, "SummaryCard.ReqSummaryCard", pkt.ToBytes()) return seq, c.uniPacketWithSeq(seq, "SummaryCard.ReqSummaryCard", pkt.ToBytes())
} }
// friendlist.delFriend // friendlist.delFriend
func (c *QQClient) buildFriendDeletePacket(target int64) (uint16, []byte) { func (c *QQClient) buildFriendDeletePacket(target int64) (uint16, []byte) {
seq := c.nextSeq()
req := &jce.DelFriendReq{ req := &jce.DelFriendReq{
Uin: c.Uin, Uin: c.Uin,
DelUin: target, DelUin: target,
@ -693,13 +692,11 @@ func (c *QQClient) buildFriendDeletePacket(target int64) (uint16, []byte) {
Context: make(map[string]string), Context: make(map[string]string),
Status: make(map[string]string), Status: make(map[string]string),
} }
packet := c.uniPacket(seq, "friendlist.delFriend", pkt.ToBytes()) return c.uniPacket("friendlist.delFriend", pkt.ToBytes())
return seq, packet
} }
// friendlist.GetTroopListReqV2 // friendlist.GetTroopListReqV2
func (c *QQClient) buildGroupListRequestPacket(vecCookie []byte) (uint16, []byte) { func (c *QQClient) buildGroupListRequestPacket(vecCookie []byte) (uint16, []byte) {
seq := c.nextSeq()
req := &jce.TroopListRequest{ req := &jce.TroopListRequest{
Uin: c.Uin, Uin: c.Uin,
GetMSFMsgFlag: 1, GetMSFMsgFlag: 1,
@ -724,13 +721,11 @@ func (c *QQClient) buildGroupListRequestPacket(vecCookie []byte) (uint16, []byte
Context: make(map[string]string), Context: make(map[string]string),
Status: make(map[string]string), Status: make(map[string]string),
} }
packet := c.uniPacket(seq, "friendlist.GetTroopListReqV2", pkt.ToBytes()) return c.uniPacket("friendlist.GetTroopListReqV2", pkt.ToBytes())
return seq, packet
} }
// friendlist.GetTroopMemberListReq // friendlist.GetTroopMemberListReq
func (c *QQClient) buildGroupMemberListRequestPacket(groupUin, groupCode, nextUin int64) (uint16, []byte) { func (c *QQClient) buildGroupMemberListRequestPacket(groupUin, groupCode, nextUin int64) (uint16, []byte) {
seq := c.nextSeq()
req := &jce.TroopMemberListRequest{ req := &jce.TroopMemberListRequest{
Uin: c.Uin, Uin: c.Uin,
GroupCode: groupCode, GroupCode: groupCode,
@ -752,13 +747,11 @@ func (c *QQClient) buildGroupMemberListRequestPacket(groupUin, groupCode, nextUi
Context: make(map[string]string), Context: make(map[string]string),
Status: make(map[string]string), Status: make(map[string]string),
} }
packet := c.uniPacket(seq, "friendlist.GetTroopMemberListReq", pkt.ToBytes()) return c.uniPacket("friendlist.GetTroopMemberListReq", pkt.ToBytes())
return seq, packet
} }
// group_member_card.get_group_member_card_info // group_member_card.get_group_member_card_info
func (c *QQClient) buildGroupMemberInfoRequestPacket(groupCode, uin int64) (uint16, []byte) { func (c *QQClient) buildGroupMemberInfoRequestPacket(groupCode, uin int64) (uint16, []byte) {
seq := c.nextSeq()
req := &pb.GroupMemberReqBody{ req := &pb.GroupMemberReqBody{
GroupCode: groupCode, GroupCode: groupCode,
Uin: uin, Uin: uin,
@ -767,13 +760,11 @@ func (c *QQClient) buildGroupMemberInfoRequestPacket(groupCode, uin int64) (uint
RichCardNameVer: 1, RichCardNameVer: 1,
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "group_member_card.get_group_member_card_info", payload) return c.uniPacket("group_member_card.get_group_member_card_info", payload)
return seq, packet
} }
// MessageSvc.PbGetMsg // MessageSvc.PbGetMsg
func (c *QQClient) buildGetMessageRequestPacket(flag msg.SyncFlag, msgTime int64) (uint16, []byte) { func (c *QQClient) buildGetMessageRequestPacket(flag msg.SyncFlag, msgTime int64) (uint16, []byte) {
seq := c.nextSeq()
cook := c.syncCookie cook := c.syncCookie
if cook == nil { if cook == nil {
cook, _ = proto.Marshal(&msg.SyncCookie{ cook, _ = proto.Marshal(&msg.SyncCookie{
@ -798,17 +789,14 @@ func (c *QQClient) buildGetMessageRequestPacket(flag msg.SyncFlag, msgTime int64
ServerBuf: EmptyBytes, ServerBuf: EmptyBytes,
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "MessageSvc.PbGetMsg", payload) return c.uniPacket("MessageSvc.PbGetMsg", payload)
return seq, packet
} }
// MessageSvc.PbDeleteMsg // MessageSvc.PbDeleteMsg
func (c *QQClient) buildDeleteMessageRequestPacket(msg []*pb.MessageItem) (uint16, []byte) { func (c *QQClient) buildDeleteMessageRequestPacket(msg []*pb.MessageItem) (uint16, []byte) {
seq := c.nextSeq()
req := &pb.DeleteMessageRequest{Items: msg} req := &pb.DeleteMessageRequest{Items: msg}
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "MessageSvc.PbDeleteMsg", payload) return c.uniPacket("MessageSvc.PbDeleteMsg", payload)
return seq, packet
} }
// OnlinePush.RespPush // OnlinePush.RespPush
@ -835,12 +823,11 @@ func (c *QQClient) buildDeleteOnlinePushPacket(uin int64, svrip int32, pushToken
Context: make(map[string]string), Context: make(map[string]string),
Status: make(map[string]string), Status: make(map[string]string),
} }
return c.uniPacket(seq, "OnlinePush.RespPush", pkt.ToBytes()) return c.uniPacketWithSeq(seq, "OnlinePush.RespPush", pkt.ToBytes())
} }
// LongConn.OffPicUp // LongConn.OffPicUp
func (c *QQClient) buildOffPicUpPacket(target int64, md5 []byte, size int32) (uint16, []byte) { func (c *QQClient) buildOffPicUpPacket(target int64, md5 []byte, size int32) (uint16, []byte) {
seq := c.nextSeq()
req := &cmd0x352.ReqBody{ req := &cmd0x352.ReqBody{
Subcmd: proto.Uint32(1), Subcmd: proto.Uint32(1),
TryupImgReq: []*cmd0x352.D352TryUpImgReq{ TryupImgReq: []*cmd0x352.D352TryUpImgReq{
@ -863,13 +850,11 @@ func (c *QQClient) buildOffPicUpPacket(target int64, md5 []byte, size int32) (ui
}, },
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "LongConn.OffPicUp", payload) return c.uniPacket("LongConn.OffPicUp", payload)
return seq, packet
} }
// ProfileService.Pb.ReqSystemMsgNew.Friend // ProfileService.Pb.ReqSystemMsgNew.Friend
func (c *QQClient) buildSystemMsgNewFriendPacket() (uint16, []byte) { func (c *QQClient) buildSystemMsgNewFriendPacket() (uint16, []byte) {
seq := c.nextSeq()
req := &structmsg.ReqSystemMsgNew{ req := &structmsg.ReqSystemMsgNew{
MsgNum: 20, MsgNum: 20,
Version: 1000, Version: 1000,
@ -884,13 +869,11 @@ func (c *QQClient) buildSystemMsgNewFriendPacket() (uint16, []byte) {
FriendMsgTypeFlag: 1, FriendMsgTypeFlag: 1,
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "ProfileService.Pb.ReqSystemMsgNew.Friend", payload) return c.uniPacket("ProfileService.Pb.ReqSystemMsgNew.Friend", payload)
return seq, packet
} }
// friendlist.ModifyGroupCardReq // friendlist.ModifyGroupCardReq
func (c *QQClient) buildEditGroupTagPacket(groupCode, memberUin int64, newTag string) (uint16, []byte) { func (c *QQClient) buildEditGroupTagPacket(groupCode, memberUin int64, newTag string) (uint16, []byte) {
seq := c.nextSeq()
req := &jce.ModifyGroupCardRequest{ req := &jce.ModifyGroupCardRequest{
GroupCode: groupCode, GroupCode: groupCode,
UinInfo: []jce.IJceStruct{ UinInfo: []jce.IJceStruct{
@ -911,13 +894,11 @@ func (c *QQClient) buildEditGroupTagPacket(groupCode, memberUin int64, newTag st
Context: map[string]string{}, Context: map[string]string{},
Status: map[string]string{}, Status: map[string]string{},
} }
packet := c.uniPacket(seq, "friendlist.ModifyGroupCardReq", pkt.ToBytes()) return c.uniPacket("friendlist.ModifyGroupCardReq", pkt.ToBytes())
return seq, packet
} }
// OidbSvc.0x8fc_2 // OidbSvc.0x8fc_2
func (c *QQClient) buildEditSpecialTitlePacket(groupCode, memberUin int64, newTitle string) (uint16, []byte) { func (c *QQClient) buildEditSpecialTitlePacket(groupCode, memberUin int64, newTitle string) (uint16, []byte) {
seq := c.nextSeq()
body := &oidb.D8FCReqBody{ body := &oidb.D8FCReqBody{
GroupCode: &groupCode, GroupCode: &groupCode,
MemLevelInfo: []*oidb.D8FCMemberInfo{ MemLevelInfo: []*oidb.D8FCMemberInfo{
@ -931,17 +912,14 @@ func (c *QQClient) buildEditSpecialTitlePacket(groupCode, memberUin int64, newTi
} }
b, _ := proto.Marshal(body) b, _ := proto.Marshal(body)
payload := c.packOIDBPackage(2300, 2, b) payload := c.packOIDBPackage(2300, 2, b)
packet := c.uniPacket(seq, "OidbSvc.0x8fc_2", payload) return c.uniPacket("OidbSvc.0x8fc_2", payload)
return seq, packet
} }
// OidbSvc.0x89a_0 // OidbSvc.0x89a_0
func (c *QQClient) buildGroupOperationPacket(body *oidb.D89AReqBody) (uint16, []byte) { func (c *QQClient) buildGroupOperationPacket(body *oidb.D89AReqBody) (uint16, []byte) {
seq := c.nextSeq()
b, _ := proto.Marshal(body) b, _ := proto.Marshal(body)
payload := c.packOIDBPackage(2202, 0, b) payload := c.packOIDBPackage(2202, 0, b)
packet := c.uniPacket(seq, "OidbSvc.0x89a_0", payload) return c.uniPacket("OidbSvc.0x89a_0", payload)
return seq, packet
} }
// OidbSvc.0x89a_0 // OidbSvc.0x89a_0
@ -982,7 +960,6 @@ func (c *QQClient) buildGroupMuteAllPacket(groupCode int64, mute bool) (uint16,
// OidbSvc.0x8a0_0 // OidbSvc.0x8a0_0
func (c *QQClient) buildGroupKickPacket(groupCode, memberUin int64, kickMsg string, block bool) (uint16, []byte) { func (c *QQClient) buildGroupKickPacket(groupCode, memberUin int64, kickMsg string, block bool) (uint16, []byte) {
seq := c.nextSeq()
flagBlock := 0 flagBlock := 0
if block { if block {
flagBlock = 1 flagBlock = 1
@ -1000,13 +977,11 @@ func (c *QQClient) buildGroupKickPacket(groupCode, memberUin int64, kickMsg stri
} }
b, _ := proto.Marshal(body) b, _ := proto.Marshal(body)
payload := c.packOIDBPackage(2208, 0, b) payload := c.packOIDBPackage(2208, 0, b)
packet := c.uniPacket(seq, "OidbSvc.0x8a0_0", payload) return c.uniPacket("OidbSvc.0x8a0_0", payload)
return seq, packet
} }
// OidbSvc.0x570_8 // OidbSvc.0x570_8
func (c *QQClient) buildGroupMutePacket(groupCode, memberUin int64, time uint32) (uint16, []byte) { func (c *QQClient) buildGroupMutePacket(groupCode, memberUin int64, time uint32) (uint16, []byte) {
seq := c.nextSeq()
b, cl := binary.OpenWriterF(func(w *binary.Writer) { b, cl := binary.OpenWriterF(func(w *binary.Writer) {
w.WriteUInt32(uint32(groupCode)) w.WriteUInt32(uint32(groupCode))
w.WriteByte(32) w.WriteByte(32)
@ -1016,39 +991,33 @@ func (c *QQClient) buildGroupMutePacket(groupCode, memberUin int64, time uint32)
}) })
payload := c.packOIDBPackage(1392, 8, b) payload := c.packOIDBPackage(1392, 8, b)
cl() cl()
packet := c.uniPacket(seq, "OidbSvc.0x570_8", payload) return c.uniPacket("OidbSvc.0x570_8", payload)
return seq, packet
} }
// OidbSvc.0xed3 // OidbSvc.0xed3
func (c *QQClient) buildGroupPokePacket(groupCode, target int64) (uint16, []byte) { func (c *QQClient) buildGroupPokePacket(groupCode, target int64) (uint16, []byte) {
seq := c.nextSeq()
body := &oidb.DED3ReqBody{ body := &oidb.DED3ReqBody{
ToUin: target, ToUin: target,
GroupCode: groupCode, GroupCode: groupCode,
} }
b, _ := proto.Marshal(body) b, _ := proto.Marshal(body)
payload := c.packOIDBPackage(3795, 1, b) payload := c.packOIDBPackage(3795, 1, b)
packet := c.uniPacket(seq, "OidbSvc.0xed3", payload) return c.uniPacket("OidbSvc.0xed3", payload)
return seq, packet
} }
// OidbSvc.0xed3 // OidbSvc.0xed3
func (c *QQClient) buildFriendPokePacket(target int64) (uint16, []byte) { func (c *QQClient) buildFriendPokePacket(target int64) (uint16, []byte) {
seq := c.nextSeq()
body := &oidb.DED3ReqBody{ body := &oidb.DED3ReqBody{
ToUin: target, ToUin: target,
AioUin: target, AioUin: target,
} }
b, _ := proto.Marshal(body) b, _ := proto.Marshal(body)
payload := c.packOIDBPackage(3795, 1, b) payload := c.packOIDBPackage(3795, 1, b)
packet := c.uniPacket(seq, "OidbSvc.0xed3", payload) return c.uniPacket("OidbSvc.0xed3", payload)
return seq, packet
} }
// OidbSvc.0x55c_1 // OidbSvc.0x55c_1
func (c *QQClient) buildGroupAdminSetPacket(groupCode, member int64, flag bool) (uint16, []byte) { func (c *QQClient) buildGroupAdminSetPacket(groupCode, member int64, flag bool) (uint16, []byte) {
seq := c.nextSeq()
b, cl := binary.OpenWriterF(func(w *binary.Writer) { b, cl := binary.OpenWriterF(func(w *binary.Writer) {
w.WriteUInt32(uint32(groupCode)) w.WriteUInt32(uint32(groupCode))
w.WriteUInt32(uint32(member)) w.WriteUInt32(uint32(member))
@ -1061,13 +1030,11 @@ func (c *QQClient) buildGroupAdminSetPacket(groupCode, member int64, flag bool)
}) })
payload := c.packOIDBPackage(1372, 1, b) payload := c.packOIDBPackage(1372, 1, b)
cl() cl()
packet := c.uniPacket(seq, "OidbSvc.0x55c_1", payload) return c.uniPacket("OidbSvc.0x55c_1", payload)
return seq, packet
} }
// ProfileService.GroupMngReq // ProfileService.GroupMngReq
func (c *QQClient) buildQuitGroupPacket(groupCode int64) (uint16, []byte) { func (c *QQClient) buildQuitGroupPacket(groupCode int64) (uint16, []byte) {
seq := c.nextSeq()
jw := jce.NewJceWriter() jw := jce.NewJceWriter()
jw.WriteInt32(2, 0) jw.WriteInt32(2, 0)
jw.WriteInt64(c.Uin, 1) jw.WriteInt64(c.Uin, 1)
@ -1087,8 +1054,7 @@ func (c *QQClient) buildQuitGroupPacket(groupCode int64) (uint16, []byte) {
Context: map[string]string{}, Context: map[string]string{},
Status: map[string]string{}, Status: map[string]string{},
} }
packet := c.uniPacket(seq, "ProfileService.GroupMngReq", pkt.ToBytes()) return c.uniPacket("ProfileService.GroupMngReq", pkt.ToBytes())
return seq, packet
} }
/* this function is unused /* this function is unused
@ -1114,12 +1080,10 @@ func (c *QQClient) buildAppInfoRequestPacket(id string) (uint16, []byte) {
*/ */
func (c *QQClient) buildWordSegmentationPacket(data []byte) (uint16, []byte) { func (c *QQClient) buildWordSegmentationPacket(data []byte) (uint16, []byte) {
seq := c.nextSeq()
payload := c.packOIDBPackageProto(3449, 1, &oidb.D79ReqBody{ payload := c.packOIDBPackageProto(3449, 1, &oidb.D79ReqBody{
Uin: uint64(c.Uin), Uin: uint64(c.Uin),
Content: data, Content: data,
Qua: []byte("and_537065262_8.4.5"), Qua: []byte("and_537065262_8.4.5"),
}) })
packet := c.uniPacket(seq, "OidbSvc.0xd79", payload) return c.uniPacket("OidbSvc.0xd79", payload)
return seq, packet
} }

View File

@ -802,7 +802,7 @@ func decodeSidExpiredPacket(c *QQClient, i *incomingPacketInfo, _ []byte) (inter
if err = c.registerClient(); err != nil { if err = c.registerClient(); err != nil {
return nil, errors.Wrap(err, "register error") return nil, errors.Wrap(err, "register error")
} }
_ = c.sendPacket(c.uniPacket(i.SequenceId, "OnlinePush.SidTicketExpired", EmptyBytes)) _ = c.sendPacket(c.uniPacketWithSeq(i.SequenceId, "OnlinePush.SidTicketExpired", EmptyBytes))
return nil, nil return nil, nil
} }

View File

@ -27,7 +27,6 @@ func (c *QQClient) GetCustomFaces() ([]*CustomFace, error) {
} }
func (c *QQClient) buildFaceroamRequestPacket() (uint16, []byte) { func (c *QQClient) buildFaceroamRequestPacket() (uint16, []byte) {
seq := c.nextSeq()
payload, _ := proto.Marshal(&faceroam.FaceroamReqBody{ payload, _ := proto.Marshal(&faceroam.FaceroamReqBody{
Comm: &faceroam.PlatInfo{ Comm: &faceroam.PlatInfo{
Implat: proto.Int64(109), Implat: proto.Int64(109),
@ -38,8 +37,7 @@ func (c *QQClient) buildFaceroamRequestPacket() (uint16, []byte) {
SubCmd: proto.Uint32(1), SubCmd: proto.Uint32(1),
ReqUserInfo: &faceroam.ReqUserInfo{}, ReqUserInfo: &faceroam.ReqUserInfo{},
}) })
packet := c.uniPacket(seq, "Faceroam.OpReq", payload) return c.uniPacket("Faceroam.OpReq", payload)
return seq, packet
} }
func decodeFaceroamResponse(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) { func decodeFaceroamResponse(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {

View File

@ -275,7 +275,6 @@ func (fs *GroupFileSystem) DeleteFile(parentFolderID, fileId string, busId int32
} }
func (c *QQClient) buildGroupFileUploadReqPacket(parentFolderID, fileName string, groupCode, fileSize int64, md5, sha1 []byte) (uint16, []byte) { func (c *QQClient) buildGroupFileUploadReqPacket(parentFolderID, fileName string, groupCode, fileSize int64, md5, sha1 []byte) (uint16, []byte) {
seq := c.nextSeq()
b, _ := proto.Marshal(&oidb.D6D6ReqBody{UploadFileReq: &oidb.UploadFileReqBody{ b, _ := proto.Marshal(&oidb.D6D6ReqBody{UploadFileReq: &oidb.UploadFileReqBody{
GroupCode: &groupCode, GroupCode: &groupCode,
AppId: proto.Int32(3), AppId: proto.Int32(3),
@ -296,12 +295,10 @@ func (c *QQClient) buildGroupFileUploadReqPacket(parentFolderID, fileName string
ClientVersion: "android 8.4.8", ClientVersion: "android 8.4.8",
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "OidbSvc.0x6d6_0", payload) return c.uniPacket("OidbSvc.0x6d6_0", payload)
return seq, packet
} }
func (c *QQClient) buildGroupFileFeedsRequest(groupCode int64, fileID string, busId, msgRand int32) (uint16, []byte) { func (c *QQClient) buildGroupFileFeedsRequest(groupCode int64, fileID string, busId, msgRand int32) (uint16, []byte) {
seq := c.nextSeq()
req := c.packOIDBPackageProto(1753, 4, &oidb.D6D9ReqBody{FeedsInfoReq: &oidb.FeedsReqBody{ req := c.packOIDBPackageProto(1753, 4, &oidb.D6D9ReqBody{FeedsInfoReq: &oidb.FeedsReqBody{
GroupCode: proto.Uint64(uint64(groupCode)), GroupCode: proto.Uint64(uint64(groupCode)),
AppId: proto.Uint32(3), AppId: proto.Uint32(3),
@ -312,13 +309,11 @@ func (c *QQClient) buildGroupFileFeedsRequest(groupCode int64, fileID string, bu
MsgRandom: proto.Uint32(uint32(msgRand)), MsgRandom: proto.Uint32(uint32(msgRand)),
}}, }},
}}) }})
packet := c.uniPacket(seq, "OidbSvc.0x6d9_4", req) return c.uniPacket("OidbSvc.0x6d9_4", req)
return seq, packet
} }
// OidbSvc.0x6d8_1 // OidbSvc.0x6d8_1
func (c *QQClient) buildGroupFileListRequestPacket(groupCode int64, folderID string, startIndex uint32) (uint16, []byte) { func (c *QQClient) buildGroupFileListRequestPacket(groupCode int64, folderID string, startIndex uint32) (uint16, []byte) {
seq := c.nextSeq()
body := &oidb.D6D8ReqBody{FileListInfoReq: &oidb.GetFileListReqBody{ body := &oidb.D6D8ReqBody{FileListInfoReq: &oidb.GetFileListReqBody{
GroupCode: proto.Uint64(uint64(groupCode)), GroupCode: proto.Uint64(uint64(groupCode)),
AppId: proto.Uint32(3), AppId: proto.Uint32(3),
@ -340,12 +335,10 @@ func (c *QQClient) buildGroupFileListRequestPacket(groupCode int64, folderID str
ClientVersion: "android 8.4.8", ClientVersion: "android 8.4.8",
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "OidbSvc.0x6d8_1", payload) return c.uniPacket("OidbSvc.0x6d8_1", payload)
return seq, packet
} }
func (c *QQClient) buildGroupFileCountRequestPacket(groupCode int64) (uint16, []byte) { func (c *QQClient) buildGroupFileCountRequestPacket(groupCode int64) (uint16, []byte) {
seq := c.nextSeq()
body := &oidb.D6D8ReqBody{GroupFileCountReq: &oidb.GetFileCountReqBody{ body := &oidb.D6D8ReqBody{GroupFileCountReq: &oidb.GetFileCountReqBody{
GroupCode: proto.Uint64(uint64(groupCode)), GroupCode: proto.Uint64(uint64(groupCode)),
AppId: proto.Uint32(3), AppId: proto.Uint32(3),
@ -359,12 +352,10 @@ func (c *QQClient) buildGroupFileCountRequestPacket(groupCode int64) (uint16, []
ClientVersion: "android 8.4.8", ClientVersion: "android 8.4.8",
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "OidbSvc.0x6d8_1", payload) return c.uniPacket("OidbSvc.0x6d8_1", payload)
return seq, packet
} }
func (c *QQClient) buildGroupFileSpaceRequestPacket(groupCode int64) (uint16, []byte) { func (c *QQClient) buildGroupFileSpaceRequestPacket(groupCode int64) (uint16, []byte) {
seq := c.nextSeq()
body := &oidb.D6D8ReqBody{GroupSpaceReq: &oidb.GetSpaceReqBody{ body := &oidb.D6D8ReqBody{GroupSpaceReq: &oidb.GetSpaceReqBody{
GroupCode: proto.Uint64(uint64(groupCode)), GroupCode: proto.Uint64(uint64(groupCode)),
AppId: proto.Uint32(3), AppId: proto.Uint32(3),
@ -377,48 +368,40 @@ func (c *QQClient) buildGroupFileSpaceRequestPacket(groupCode int64) (uint16, []
ClientVersion: "android 8.4.8", ClientVersion: "android 8.4.8",
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "OidbSvc.0x6d8_1", payload) return c.uniPacket("OidbSvc.0x6d8_1", payload)
return seq, packet
} }
func (c *QQClient) buildGroupFileCreateFolderPacket(groupCode int64, parentFolder, name string) (uint16, []byte) { func (c *QQClient) buildGroupFileCreateFolderPacket(groupCode int64, parentFolder, name string) (uint16, []byte) {
seq := c.nextSeq()
payload := c.packOIDBPackageProto(1751, 0, &oidb.D6D7ReqBody{CreateFolderReq: &oidb.CreateFolderReqBody{ payload := c.packOIDBPackageProto(1751, 0, &oidb.D6D7ReqBody{CreateFolderReq: &oidb.CreateFolderReqBody{
GroupCode: proto.Uint64(uint64(groupCode)), GroupCode: proto.Uint64(uint64(groupCode)),
AppId: proto.Uint32(3), AppId: proto.Uint32(3),
ParentFolderId: &parentFolder, ParentFolderId: &parentFolder,
FolderName: &name, FolderName: &name,
}}) }})
packet := c.uniPacket(seq, "OidbSvc.0x6d7_0", payload) return c.uniPacket("OidbSvc.0x6d7_0", payload)
return seq, packet
} }
func (c *QQClient) buildGroupFileRenameFolderPacket(groupCode int64, folderId, newName string) (uint16, []byte) { func (c *QQClient) buildGroupFileRenameFolderPacket(groupCode int64, folderId, newName string) (uint16, []byte) {
seq := c.nextSeq()
payload := c.packOIDBPackageProto(1751, 2, &oidb.D6D7ReqBody{RenameFolderReq: &oidb.RenameFolderReqBody{ payload := c.packOIDBPackageProto(1751, 2, &oidb.D6D7ReqBody{RenameFolderReq: &oidb.RenameFolderReqBody{
GroupCode: proto.Uint64(uint64(groupCode)), GroupCode: proto.Uint64(uint64(groupCode)),
AppId: proto.Uint32(3), AppId: proto.Uint32(3),
FolderId: proto.String(folderId), FolderId: proto.String(folderId),
NewFolderName: proto.String(newName), NewFolderName: proto.String(newName),
}}) }})
packet := c.uniPacket(seq, "OidbSvc.0x6d7_2", payload) return c.uniPacket("OidbSvc.0x6d7_2", payload)
return seq, packet
} }
func (c *QQClient) buildGroupFileDeleteFolderPacket(groupCode int64, folderId string) (uint16, []byte) { func (c *QQClient) buildGroupFileDeleteFolderPacket(groupCode int64, folderId string) (uint16, []byte) {
seq := c.nextSeq()
payload := c.packOIDBPackageProto(1751, 1, &oidb.D6D7ReqBody{DeleteFolderReq: &oidb.DeleteFolderReqBody{ payload := c.packOIDBPackageProto(1751, 1, &oidb.D6D7ReqBody{DeleteFolderReq: &oidb.DeleteFolderReqBody{
GroupCode: proto.Uint64(uint64(groupCode)), GroupCode: proto.Uint64(uint64(groupCode)),
AppId: proto.Uint32(3), AppId: proto.Uint32(3),
FolderId: proto.String(folderId), FolderId: proto.String(folderId),
}}) }})
packet := c.uniPacket(seq, "OidbSvc.0x6d7_1", payload) return c.uniPacket("OidbSvc.0x6d7_1", payload)
return seq, packet
} }
// OidbSvc.0x6d6_2 // OidbSvc.0x6d6_2
func (c *QQClient) buildGroupFileDownloadReqPacket(groupCode int64, fileId string, busId int32) (uint16, []byte) { func (c *QQClient) buildGroupFileDownloadReqPacket(groupCode int64, fileId string, busId int32) (uint16, []byte) {
seq := c.nextSeq()
body := &oidb.D6D6ReqBody{ body := &oidb.D6D6ReqBody{
DownloadFileReq: &oidb.DownloadFileReqBody{ DownloadFileReq: &oidb.DownloadFileReqBody{
GroupCode: &groupCode, GroupCode: &groupCode,
@ -434,12 +417,10 @@ func (c *QQClient) buildGroupFileDownloadReqPacket(groupCode int64, fileId strin
Bodybuffer: b, Bodybuffer: b,
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "OidbSvc.0x6d6_2", payload) return c.uniPacket("OidbSvc.0x6d6_2", payload)
return seq, packet
} }
func (c *QQClient) buildGroupFileDeleteReqPacket(groupCode int64, parentFolderId, fileId string, busId int32) (uint16, []byte) { func (c *QQClient) buildGroupFileDeleteReqPacket(groupCode int64, parentFolderId, fileId string, busId int32) (uint16, []byte) {
seq := c.nextSeq()
body := &oidb.D6D6ReqBody{DeleteFileReq: &oidb.DeleteFileReqBody{ body := &oidb.D6D6ReqBody{DeleteFileReq: &oidb.DeleteFileReqBody{
GroupCode: &groupCode, GroupCode: &groupCode,
AppId: proto.Int32(3), AppId: proto.Int32(3),
@ -455,8 +436,7 @@ func (c *QQClient) buildGroupFileDeleteReqPacket(groupCode int64, parentFolderId
ClientVersion: "android 8.4.8", ClientVersion: "android 8.4.8",
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "OidbSvc.0x6d6_3", payload) return c.uniPacket("OidbSvc.0x6d6_3", payload)
return seq, packet
} }
func decodeOIDB6d81Response(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) { func decodeOIDB6d81Response(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {

View File

@ -79,7 +79,6 @@ func (c *QQClient) GetGroupInfo(groupCode int64) (*GroupInfo, error) {
// OidbSvc.0x88d_0 // OidbSvc.0x88d_0
func (c *QQClient) buildGroupInfoRequestPacket(groupCode int64) (uint16, []byte) { func (c *QQClient) buildGroupInfoRequestPacket(groupCode int64) (uint16, []byte) {
seq := c.nextSeq()
body := &oidb.D88DReqBody{ body := &oidb.D88DReqBody{
AppId: proto.Uint32(c.version.AppId), AppId: proto.Uint32(c.version.AppId),
ReqGroupInfo: []*oidb.ReqGroupInfo{ ReqGroupInfo: []*oidb.ReqGroupInfo{
@ -122,8 +121,7 @@ func (c *QQClient) buildGroupInfoRequestPacket(groupCode int64) (uint16, []byte)
Bodybuffer: b, Bodybuffer: b,
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "OidbSvc.0x88d_0", payload) return c.uniPacket("OidbSvc.0x88d_0", payload)
return seq, packet
} }
// SearchGroupByKeyword 通过关键词搜索陌生群组 // SearchGroupByKeyword 通过关键词搜索陌生群组
@ -137,7 +135,6 @@ func (c *QQClient) SearchGroupByKeyword(keyword string) ([]GroupSearchInfo, erro
// SummaryCard.ReqSearch // SummaryCard.ReqSearch
func (c *QQClient) buildGroupSearchPacket(keyword string) (uint16, []byte) { func (c *QQClient) buildGroupSearchPacket(keyword string) (uint16, []byte) {
seq := c.nextSeq()
comm, _ := proto.Marshal(&profilecard.BusiComm{ comm, _ := proto.Marshal(&profilecard.BusiComm{
Ver: proto.Int32(1), Ver: proto.Int32(1),
Seq: proto.Int32(rand.Int31()), Seq: proto.Int32(rand.Int31()),
@ -186,8 +183,7 @@ func (c *QQClient) buildGroupSearchPacket(keyword string) (uint16, []byte) {
Context: make(map[string]string), Context: make(map[string]string),
Status: make(map[string]string), Status: make(map[string]string),
} }
packet := c.uniPacket(seq, "SummaryCard.ReqSearch", pkt.ToBytes()) return c.uniPacket("SummaryCard.ReqSearch", pkt.ToBytes())
return seq, packet
} }
// SummaryCard.ReqSearch // SummaryCard.ReqSearch

View File

@ -237,7 +237,6 @@ func (c *QQClient) multiMsgApplyUp(groupCode int64, data []byte, hash []byte, bu
// MessageSvc.PbSendMsg // MessageSvc.PbSendMsg
func (c *QQClient) buildGroupSendingPacket(groupCode int64, r, pkgNum, pkgIndex, pkgDiv int32, forward bool, m []message.IMessageElement) (uint16, []byte) { func (c *QQClient) buildGroupSendingPacket(groupCode int64, r, pkgNum, pkgIndex, pkgDiv int32, forward bool, m []message.IMessageElement) (uint16, []byte) {
seq := c.nextSeq()
var ptt *message.GroupVoiceElement var ptt *message.GroupVoiceElement
if len(m) > 0 { if len(m) > 0 {
if p, ok := m[0].(*message.GroupVoiceElement); ok { if p, ok := m[0].(*message.GroupVoiceElement); ok {
@ -271,12 +270,10 @@ func (c *QQClient) buildGroupSendingPacket(groupCode int64, r, pkgNum, pkgIndex,
}(), }(),
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "MessageSvc.PbSendMsg", payload) return c.uniPacket("MessageSvc.PbSendMsg", payload)
return seq, packet
} }
func (c *QQClient) buildGetGroupMsgRequest(groupCode, beginSeq, endSeq int64) (uint16, []byte) { func (c *QQClient) buildGetGroupMsgRequest(groupCode, beginSeq, endSeq int64) (uint16, []byte) {
seq := c.nextSeq()
req := &msg.GetGroupMsgReq{ req := &msg.GetGroupMsgReq{
GroupCode: proto.Uint64(uint64(groupCode)), GroupCode: proto.Uint64(uint64(groupCode)),
BeginSeq: proto.Uint64(uint64(beginSeq)), BeginSeq: proto.Uint64(uint64(beginSeq)),
@ -284,12 +281,10 @@ func (c *QQClient) buildGetGroupMsgRequest(groupCode, beginSeq, endSeq int64) (u
PublicGroup: proto.Bool(false), PublicGroup: proto.Bool(false),
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "MessageSvc.PbGetGroupMsg", payload) return c.uniPacket("MessageSvc.PbGetGroupMsg", payload)
return seq, packet
} }
func (c *QQClient) buildAtAllRemainRequestPacket(groupCode int64) (uint16, []byte) { func (c *QQClient) buildAtAllRemainRequestPacket(groupCode int64) (uint16, []byte) {
seq := c.nextSeq()
payload := c.packOIDBPackageProto(2215, 0, &oidb.D8A7ReqBody{ payload := c.packOIDBPackageProto(2215, 0, &oidb.D8A7ReqBody{
SubCmd: proto.Uint32(1), SubCmd: proto.Uint32(1),
LimitIntervalTypeForUin: proto.Uint32(2), LimitIntervalTypeForUin: proto.Uint32(2),
@ -297,8 +292,7 @@ func (c *QQClient) buildAtAllRemainRequestPacket(groupCode int64) (uint16, []byt
Uin: proto.Uint64(uint64(c.Uin)), Uin: proto.Uint64(uint64(c.Uin)),
GroupCode: proto.Uint64(uint64(groupCode)), GroupCode: proto.Uint64(uint64(groupCode)),
}) })
packet := c.uniPacket(seq, "OidbSvc.0x8a7_0", payload) return c.uniPacket("OidbSvc.0x8a7_0", payload)
return seq, packet
} }
// OnlinePush.PbPushGroupMsg // OnlinePush.PbPushGroupMsg
@ -593,15 +587,13 @@ func (c *QQClient) DeleteEssenceMessage(groupCode int64, msgID, msgInternalId in
} }
func (c *QQClient) buildEssenceMsgOperatePacket(groupCode int64, msgSeq, msgRand, opType uint32) (uint16, []byte) { func (c *QQClient) buildEssenceMsgOperatePacket(groupCode int64, msgSeq, msgRand, opType uint32) (uint16, []byte) {
seq := c.nextSeq()
commandName := "OidbSvc.0xeac_" + strconv.FormatInt(int64(opType), 10) commandName := "OidbSvc.0xeac_" + strconv.FormatInt(int64(opType), 10)
payload := c.packOIDBPackageProto(3756, int32(opType), &oidb.EACReqBody{ // serviceType 2 取消 payload := c.packOIDBPackageProto(3756, int32(opType), &oidb.EACReqBody{ // serviceType 2 取消
GroupCode: proto.Uint64(uint64(groupCode)), GroupCode: proto.Uint64(uint64(groupCode)),
Seq: proto.Uint32(msgSeq), Seq: proto.Uint32(msgSeq),
Random: proto.Uint32(msgRand), Random: proto.Uint32(msgRand),
}) })
packet := c.uniPacket(seq, commandName, payload) return c.uniPacket(commandName, payload)
return seq, packet
} }
// OidbSvc.0xeac_1/2 // OidbSvc.0xeac_1/2

View File

@ -175,7 +175,6 @@ func (g *GuildInfo) removeChannel(id uint64) {
} }
func (s *GuildService) GetUserProfile(tinyId uint64) (*GuildUserProfile, error) { func (s *GuildService) GetUserProfile(tinyId uint64) (*GuildUserProfile, error) {
seq := s.c.nextSeq()
flags := binary.DynamicProtoMessage{} flags := binary.DynamicProtoMessage{}
for i := 3; i <= 29; i++ { for i := 3; i <= 29; i++ {
flags[uint64(i)] = uint32(1) flags[uint64(i)] = uint32(1)
@ -187,8 +186,7 @@ func (s *GuildService) GetUserProfile(tinyId uint64) (*GuildUserProfile, error)
3: tinyId, 3: tinyId,
4: uint32(0), 4: uint32(0),
}) })
packet := s.c.uniPacket(seq, "OidbSvcTrpcTcp.0xfc9_1", payload) rsp, err := s.c.sendAndWaitDynamic(s.c.uniPacket("OidbSvcTrpcTcp.0xfc9_1", payload))
rsp, err := s.c.sendAndWaitDynamic(seq, packet)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "send packet error") return nil, errors.Wrap(err, "send packet error")
} }
@ -226,7 +224,7 @@ func (s *GuildService) FetchGuildMemberListWithRole(guildId, channelId uint64, s
m[13] = param m[13] = param
} }
m[14] = roleIdIndex m[14] = roleIdIndex
packet := s.c.uniPacket(seq, "OidbSvcTrpcTcp.0xf5b_1", s.c.packOIDBPackageDynamically(3931, 1, m)) packet := s.c.uniPacketWithSeq(seq, "OidbSvcTrpcTcp.0xf5b_1", s.c.packOIDBPackageDynamically(3931, 1, m))
rsp, err := s.c.sendAndWaitDynamic(seq, packet) rsp, err := s.c.sendAndWaitDynamic(seq, packet)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "send packet error") return nil, errors.Wrap(err, "send packet error")
@ -281,7 +279,7 @@ func (s *GuildService) FetchGuildMemberProfileInfo(guildId, tinyId uint64) (*Gui
3: tinyId, 3: tinyId,
4: guildId, 4: guildId,
}) })
packet := s.c.uniPacket(seq, "OidbSvcTrpcTcp.0xf88_1", payload) packet := s.c.uniPacketWithSeq(seq, "OidbSvcTrpcTcp.0xf88_1", payload)
rsp, err := s.c.sendAndWaitDynamic(seq, packet) rsp, err := s.c.sendAndWaitDynamic(seq, packet)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "send packet error") return nil, errors.Wrap(err, "send packet error")
@ -305,8 +303,8 @@ func (s *GuildService) FetchGuildMemberProfileInfo(guildId, tinyId uint64) (*Gui
} }
func (s *GuildService) GetGuildRoles(guildId uint64) ([]*GuildRole, error) { func (s *GuildService) GetGuildRoles(guildId uint64) ([]*GuildRole, error) {
seq := s.c.nextSeq() seq, packet := s.c.uniPacket("OidbSvcTrpcTcp.0x1019_1",
packet := s.c.uniPacket(seq, "OidbSvcTrpcTcp.0x1019_1", s.c.packOIDBPackageDynamically(4121, 1, binary.DynamicProtoMessage{1: guildId})) s.c.packOIDBPackageDynamically(4121, 1, binary.DynamicProtoMessage{1: guildId}))
rsp, err := s.c.sendAndWaitDynamic(seq, packet) rsp, err := s.c.sendAndWaitDynamic(seq, packet)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "send packet error") return nil, errors.Wrap(err, "send packet error")
@ -332,9 +330,8 @@ func (s *GuildService) GetGuildRoles(guildId uint64) ([]*GuildRole, error) {
} }
func (s *GuildService) CreateGuildRole(guildId uint64, name string, color uint32, independent bool, initialUsers []uint64) (uint64, error) { func (s *GuildService) CreateGuildRole(guildId uint64, name string, color uint32, independent bool, initialUsers []uint64) (uint64, error) {
seq := s.c.nextSeq()
u1 := uint32(1) u1 := uint32(1)
packet := s.c.uniPacket(seq, "OidbSvcTrpcTcp.0x1016_1", s.c.packOIDBPackageDynamically(4118, 1, binary.DynamicProtoMessage{ seq, packet := s.c.uniPacket("OidbSvcTrpcTcp.0x1016_1", s.c.packOIDBPackageDynamically(4118, 1, binary.DynamicProtoMessage{
1: guildId, 1: guildId,
2: binary.DynamicProtoMessage{ // todo: 未知参数 2: binary.DynamicProtoMessage{ // todo: 未知参数
1: u1, 1: u1,
@ -360,8 +357,7 @@ func (s *GuildService) CreateGuildRole(guildId uint64, name string, color uint32
} }
func (s *GuildService) DeleteGuildRole(guildId uint64, roleId uint64) error { func (s *GuildService) DeleteGuildRole(guildId uint64, roleId uint64) error {
seq := s.c.nextSeq() seq, packet := s.c.uniPacket("OidbSvcTrpcTcp.0x100e_1", s.c.packOIDBPackageDynamically(4110, 1, binary.DynamicProtoMessage{
packet := s.c.uniPacket(seq, "OidbSvcTrpcTcp.0x100e_1", s.c.packOIDBPackageDynamically(4110, 1, binary.DynamicProtoMessage{
1: guildId, 1: guildId,
2: roleId, 2: roleId,
})) }))
@ -373,7 +369,6 @@ func (s *GuildService) DeleteGuildRole(guildId uint64, roleId uint64) error {
} }
func (s *GuildService) SetUserRoleInGuild(guildId uint64, set bool, roleId uint64, user []uint64) error { // remove => p2 = false func (s *GuildService) SetUserRoleInGuild(guildId uint64, set bool, roleId uint64, user []uint64) error { // remove => p2 = false
seq := s.c.nextSeq()
setOrRemove := binary.DynamicProtoMessage{ setOrRemove := binary.DynamicProtoMessage{
1: roleId, 1: roleId,
} }
@ -382,7 +377,7 @@ func (s *GuildService) SetUserRoleInGuild(guildId uint64, set bool, roleId uint6
} else { } else {
setOrRemove[3] = user setOrRemove[3] = user
} }
packet := s.c.uniPacket(seq, "OidbSvcTrpcTcp.0x101a_1", s.c.packOIDBPackageDynamically(4122, 1, binary.DynamicProtoMessage{ seq, packet := s.c.uniPacket("OidbSvcTrpcTcp.0x101a_1", s.c.packOIDBPackageDynamically(4122, 1, binary.DynamicProtoMessage{
1: guildId, 1: guildId,
2: setOrRemove, 2: setOrRemove,
})) }))
@ -394,10 +389,8 @@ func (s *GuildService) SetUserRoleInGuild(guildId uint64, set bool, roleId uint6
} }
func (s *GuildService) ModifyRoleInGuild(guildId uint64, roleId uint64, name string, color uint32, indepedent bool) error { func (s *GuildService) ModifyRoleInGuild(guildId uint64, roleId uint64, name string, color uint32, indepedent bool) error {
seq := s.c.nextSeq()
var packet []byte
u1 := uint32(1) u1 := uint32(1)
packet = s.c.uniPacket(seq, "OidbSvcTrpcTcp.0x100d_1", s.c.packOIDBPackageDynamically(4109, 1, binary.DynamicProtoMessage{ seq, packet := s.c.uniPacket("OidbSvcTrpcTcp.0x100d_1", s.c.packOIDBPackageDynamically(4109, 1, binary.DynamicProtoMessage{
1: guildId, 1: guildId,
2: roleId, 2: roleId,
3: binary.DynamicProtoMessage{ 3: binary.DynamicProtoMessage{
@ -419,7 +412,6 @@ func (s *GuildService) ModifyRoleInGuild(guildId uint64, roleId uint64, name str
} }
func (s *GuildService) FetchGuestGuild(guildId uint64) (*GuildMeta, error) { func (s *GuildService) FetchGuestGuild(guildId uint64) (*GuildMeta, error) {
seq := s.c.nextSeq()
u1 := uint32(1) u1 := uint32(1)
payload := s.c.packOIDBPackageDynamically(3927, 9, binary.DynamicProtoMessage{ payload := s.c.packOIDBPackageDynamically(3927, 9, binary.DynamicProtoMessage{
1: binary.DynamicProtoMessage{ 1: binary.DynamicProtoMessage{
@ -435,7 +427,7 @@ func (s *GuildService) FetchGuestGuild(guildId uint64) (*GuildMeta, error) {
1: guildId, 1: guildId,
}, },
}) })
packet := s.c.uniPacket(seq, "OidbSvcTrpcTcp.0xf57_9", payload) seq, packet := s.c.uniPacket("OidbSvcTrpcTcp.0xf57_9", payload)
rsp, err := s.c.sendAndWaitDynamic(seq, packet) rsp, err := s.c.sendAndWaitDynamic(seq, packet)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "send packet error") return nil, errors.Wrap(err, "send packet error")
@ -457,8 +449,14 @@ func (s *GuildService) FetchGuestGuild(guildId uint64) (*GuildMeta, error) {
} }
func (s *GuildService) FetchChannelList(guildId uint64) (r []*ChannelInfo, e error) { func (s *GuildService) FetchChannelList(guildId uint64) (r []*ChannelInfo, e error) {
seq := s.c.nextSeq() seq, packet := s.c.uniPacket("OidbSvcTrpcTcp.0xf5d_1",
packet := s.c.uniPacket(seq, "OidbSvcTrpcTcp.0xf5d_1", s.c.packOIDBPackageDynamically(3933, 1, binary.DynamicProtoMessage{1: guildId, 3: binary.DynamicProtoMessage{1: uint32(1)}})) s.c.packOIDBPackageDynamically(3933, 1,
binary.DynamicProtoMessage{
1: guildId,
3: binary.DynamicProtoMessage{
1: uint32(1),
},
}))
rsp, err := s.c.sendAndWaitDynamic(seq, packet) rsp, err := s.c.sendAndWaitDynamic(seq, packet)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "send packet error") return nil, errors.Wrap(err, "send packet error")
@ -474,8 +472,7 @@ func (s *GuildService) FetchChannelList(guildId uint64) (r []*ChannelInfo, e err
} }
func (s *GuildService) FetchChannelInfo(guildId, channelId uint64) (*ChannelInfo, error) { func (s *GuildService) FetchChannelInfo(guildId, channelId uint64) (*ChannelInfo, error) {
seq := s.c.nextSeq() seq, packet := s.c.uniPacket("OidbSvcTrpcTcp.0xf55_1", s.c.packOIDBPackageDynamically(3925, 1, binary.DynamicProtoMessage{1: guildId, 2: channelId}))
packet := s.c.uniPacket(seq, "OidbSvcTrpcTcp.0xf55_1", s.c.packOIDBPackageDynamically(3925, 1, binary.DynamicProtoMessage{1: guildId, 2: channelId}))
rsp, err := s.c.sendAndWaitDynamic(seq, packet) rsp, err := s.c.sendAndWaitDynamic(seq, packet)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "send packet error") return nil, errors.Wrap(err, "send packet error")
@ -529,8 +526,7 @@ func (s *GuildService) GetTopicChannelFeeds(guildId, channelId uint64) ([]*topic
}, },
}, },
}) })
seq := s.c.nextSeq() seq, packet := s.c.uniPacket("QChannelSvr.trpc.qchannel.commreader.ComReader.GetChannelTimelineFeeds", payload)
packet := s.c.uniPacket(seq, "QChannelSvr.trpc.qchannel.commreader.ComReader.GetChannelTimelineFeeds", payload)
rsp, err := s.c.sendAndWaitDynamic(seq, packet) rsp, err := s.c.sendAndWaitDynamic(seq, packet)
if err != nil { if err != nil {
return nil, errors.New("send packet error") return nil, errors.New("send packet error")
@ -600,8 +596,7 @@ func (s *GuildService) PostTopicChannelFeed(guildId, channelId uint64, feed *top
}, },
}, },
}) })
seq := s.c.nextSeq() seq, packet := s.c.uniPacket("QChannelSvr.trpc.qchannel.commwriter.ComWriter.PublishFeed", payload)
packet := s.c.uniPacket(seq, "QChannelSvr.trpc.qchannel.commwriter.ComWriter.PublishFeed", payload)
rsp, err := s.c.sendAndWaitDynamic(seq, packet) rsp, err := s.c.sendAndWaitDynamic(seq, packet)
if err != nil { if err != nil {
return errors.New("send packet error") return errors.New("send packet error")
@ -621,9 +616,8 @@ func (s *GuildService) PostTopicChannelFeed(guildId, channelId uint64, feed *top
} }
func (s *GuildService) fetchMemberRoles(guildId uint64, tinyId uint64) ([]*GuildRole, error) { func (s *GuildService) fetchMemberRoles(guildId uint64, tinyId uint64) ([]*GuildRole, error) {
seq := s.c.nextSeq()
u1 := uint32(1) u1 := uint32(1)
packet := s.c.uniPacket(seq, "OidbSvcTrpcTcp.0x1017_1", s.c.packOIDBPackageDynamically(4119, 1, binary.DynamicProtoMessage{ seq, packet := s.c.uniPacket("OidbSvcTrpcTcp.0x1017_1", s.c.packOIDBPackageDynamically(4119, 1, binary.DynamicProtoMessage{
1: guildId, 1: guildId,
2: tinyId, 2: tinyId,
4: binary.DynamicProtoMessage{ 4: binary.DynamicProtoMessage{
@ -734,15 +728,13 @@ func (c *QQClient) syncChannelFirstView() {
} }
func (c *QQClient) buildSyncChannelFirstViewPacket() (uint16, []byte) { func (c *QQClient) buildSyncChannelFirstViewPacket() (uint16, []byte) {
seq := c.nextSeq()
req := &channel.FirstViewReq{ req := &channel.FirstViewReq{
LastMsgTime: proto.Uint64(0), LastMsgTime: proto.Uint64(0),
Seq: proto.Uint32(0), Seq: proto.Uint32(0),
DirectMessageFlag: proto.Uint32(1), DirectMessageFlag: proto.Uint32(1),
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "trpc.group_pro.synclogic.SyncLogic.SyncFirstView", payload) return c.uniPacket("trpc.group_pro.synclogic.SyncLogic.SyncFirstView", payload)
return seq, packet
} }
func decodeGuildPushFirstView(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) { func decodeGuildPushFirstView(c *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {

View File

@ -66,9 +66,8 @@ func (s *GuildService) SendGuildChannelMessage(guildId, channelId uint64, m *mes
}, },
}, },
}} }}
seq := s.c.nextSeq()
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := s.c.uniPacket(seq, "MsgProxy.SendMsg", payload) seq, packet := s.c.uniPacket("MsgProxy.SendMsg", payload)
rsp, err := s.c.sendAndWaitDynamic(seq, packet) rsp, err := s.c.sendAndWaitDynamic(seq, packet)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "send packet error") return nil, errors.Wrap(err, "send packet error")
@ -215,8 +214,7 @@ func (s *GuildService) pullChannelMessages(guildId, channelId, beginSeq, endSeq,
WithVersionFlag: &withVersionFlag, WithVersionFlag: &withVersionFlag,
DirectMessageFlag: &directFlag, DirectMessageFlag: &directFlag,
}) })
seq := s.c.nextSeq() seq, packet := s.c.uniPacket("trpc.group_pro.synclogic.SyncLogic.GetChannelMsg", payload)
packet := s.c.uniPacket(seq, "trpc.group_pro.synclogic.SyncLogic.GetChannelMsg", payload)
rsp, err := s.c.sendAndWaitDynamic(seq, packet) rsp, err := s.c.sendAndWaitDynamic(seq, packet)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "send packet error") return nil, errors.Wrap(err, "send packet error")
@ -229,7 +227,6 @@ func (s *GuildService) pullChannelMessages(guildId, channelId, beginSeq, endSeq,
} }
func (c *QQClient) buildGuildImageStorePacket(guildId, channelId uint64, hash []byte, size uint64) (uint16, []byte) { func (c *QQClient) buildGuildImageStorePacket(guildId, channelId uint64, hash []byte, size uint64) (uint16, []byte) {
seq := c.nextSeq()
payload, _ := proto.Marshal(&cmd0x388.D388ReqBody{ payload, _ := proto.Marshal(&cmd0x388.D388ReqBody{
NetType: proto.Uint32(3), NetType: proto.Uint32(3),
Subcmd: proto.Uint32(1), Subcmd: proto.Uint32(1),
@ -254,8 +251,7 @@ func (c *QQClient) buildGuildImageStorePacket(guildId, channelId uint64, hash []
}, },
CommandId: proto.Uint32(83), CommandId: proto.Uint32(83),
}) })
packet := c.uniPacket(seq, "ImgStore.QQMeetPicUp", payload) return c.uniPacket("ImgStore.QQMeetPicUp", payload)
return seq, packet
} }
func decodeGuildMessageEmojiReactions(content *channel.ChannelMsgContent) (r []*message.GuildMessageEmojiReaction) { func decodeGuildMessageEmojiReactions(content *channel.ChannelMsgContent) (r []*message.GuildMessageEmojiReaction) {
@ -349,14 +345,12 @@ func (s *GuildService) parseGuildChannelMessage(msg *channel.ChannelMsgContent)
// PttCenterSvr.GroupShortVideoUpReq // PttCenterSvr.GroupShortVideoUpReq
func (c *QQClient) buildPttGuildVideoUpReq(videoHash, thumbHash []byte, guildId, channelId int64, videoSize, thumbSize int64) (uint16, []byte) { func (c *QQClient) buildPttGuildVideoUpReq(videoHash, thumbHash []byte, guildId, channelId int64, videoSize, thumbSize int64) (uint16, []byte) {
seq := c.nextSeq()
pb := c.buildPttGroupShortVideoProto(videoHash, thumbHash, guildId, videoSize, thumbSize, 4) pb := c.buildPttGroupShortVideoProto(videoHash, thumbHash, guildId, videoSize, thumbSize, 4)
pb.PttShortVideoUploadReq.BusinessType = 4601 pb.PttShortVideoUploadReq.BusinessType = 4601
pb.PttShortVideoUploadReq.ToUin = channelId pb.PttShortVideoUploadReq.ToUin = channelId
pb.ExtensionReq[0].SubBusiType = 4601 pb.ExtensionReq[0].SubBusiType = 4601
payload, _ := proto.Marshal(pb) payload, _ := proto.Marshal(pb)
packet := c.uniPacket(seq, "PttCenterSvr.GroupShortVideoUpReq", payload) return c.uniPacket("PttCenterSvr.GroupShortVideoUpReq", payload)
return seq, packet
} }
func (c *QQClient) UploadGuildShortVideo(guildId, channelId uint64, video, thumb io.ReadSeeker) (*message.ShortVideoElement, error) { func (c *QQClient) UploadGuildShortVideo(guildId, channelId uint64, video, thumb io.ReadSeeker) (*message.ShortVideoElement, error) {

View File

@ -239,7 +239,6 @@ func (c *QQClient) QueryFriendImage(target int64, hash []byte, size int32) (*mes
// ImgStore.GroupPicUp // ImgStore.GroupPicUp
func (c *QQClient) buildGroupImageStorePacket(groupCode int64, md5 []byte, size int32) (uint16, []byte) { func (c *QQClient) buildGroupImageStorePacket(groupCode int64, md5 []byte, size int32) (uint16, []byte) {
seq := c.nextSeq()
name := utils.RandomString(16) + ".gif" name := utils.RandomString(16) + ".gif"
req := &cmd0x388.D388ReqBody{ req := &cmd0x388.D388ReqBody{
NetType: proto.Uint32(3), NetType: proto.Uint32(3),
@ -264,12 +263,10 @@ func (c *QQClient) buildGroupImageStorePacket(groupCode int64, md5 []byte, size
Extension: EmptyBytes, Extension: EmptyBytes,
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "ImgStore.GroupPicUp", payload) return c.uniPacket("ImgStore.GroupPicUp", payload)
return seq, packet
} }
func (c *QQClient) buildGroupImageDownloadPacket(fileId, groupCode int64, fileMd5 []byte) (uint16, []byte) { func (c *QQClient) buildGroupImageDownloadPacket(fileId, groupCode int64, fileMd5 []byte) (uint16, []byte) {
seq := c.nextSeq()
req := &cmd0x388.D388ReqBody{ req := &cmd0x388.D388ReqBody{
NetType: proto.Uint32(3), NetType: proto.Uint32(3),
Subcmd: proto.Uint32(2), Subcmd: proto.Uint32(2),
@ -290,8 +287,7 @@ func (c *QQClient) buildGroupImageDownloadPacket(fileId, groupCode int64, fileMd
}, },
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "ImgStore.GroupPicDown", payload) return c.uniPacket("ImgStore.GroupPicDown", payload)
return seq, packet
} }
func (c *QQClient) uploadOcrImage(img io.Reader) (string, error) { func (c *QQClient) uploadOcrImage(img io.Reader) (string, error) {
@ -322,7 +318,6 @@ func (c *QQClient) uploadOcrImage(img io.Reader) (string, error) {
// OidbSvc.0xe07_0 // OidbSvc.0xe07_0
func (c *QQClient) buildImageOcrRequestPacket(url, md5 string, size, weight, height int32) (uint16, []byte) { func (c *QQClient) buildImageOcrRequestPacket(url, md5 string, size, weight, height int32) (uint16, []byte) {
seq := c.nextSeq()
body := &oidb.DE07ReqBody{ body := &oidb.DE07ReqBody{
Version: 1, Version: 1,
Entrance: 3, Entrance: 3,
@ -338,8 +333,7 @@ func (c *QQClient) buildImageOcrRequestPacket(url, md5 string, size, weight, hei
} }
b, _ := proto.Marshal(body) b, _ := proto.Marshal(body)
payload := c.packOIDBPackage(3591, 0, b) payload := c.packOIDBPackage(3591, 0, b)
packet := c.uniPacket(seq, "OidbSvc.0xe07_0", payload) return c.uniPacket("OidbSvc.0xe07_0", payload)
return seq, packet
} }
// ImgStore.GroupPicUp // ImgStore.GroupPicUp

View File

@ -23,7 +23,6 @@ func init() {
// MultiMsg.ApplyUp // MultiMsg.ApplyUp
func (c *QQClient) buildMultiApplyUpPacket(data, hash []byte, buType int32, groupUin int64) (uint16, []byte) { func (c *QQClient) buildMultiApplyUpPacket(data, hash []byte, buType int32, groupUin int64) (uint16, []byte) {
seq := c.nextSeq()
req := &multimsg.MultiReqBody{ req := &multimsg.MultiReqBody{
Subcmd: 1, Subcmd: 1,
TermType: 5, TermType: 5,
@ -41,8 +40,7 @@ func (c *QQClient) buildMultiApplyUpPacket(data, hash []byte, buType int32, grou
BuType: buType, BuType: buType,
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "MultiMsg.ApplyUp", payload) return c.uniPacket("MultiMsg.ApplyUp", payload)
return seq, packet
} }
// MultiMsg.ApplyUp // MultiMsg.ApplyUp
@ -66,7 +64,6 @@ func decodeMultiApplyUpResponse(_ *QQClient, _ *incomingPacketInfo, payload []by
// MultiMsg.ApplyDown // MultiMsg.ApplyDown
func (c *QQClient) buildMultiApplyDownPacket(resID string) (uint16, []byte) { func (c *QQClient) buildMultiApplyDownPacket(resID string) (uint16, []byte) {
seq := c.nextSeq()
req := &multimsg.MultiReqBody{ req := &multimsg.MultiReqBody{
Subcmd: 2, Subcmd: 2,
TermType: 5, TermType: 5,
@ -83,8 +80,7 @@ func (c *QQClient) buildMultiApplyDownPacket(resID string) (uint16, []byte) {
ReqChannelType: 2, ReqChannelType: 2,
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "MultiMsg.ApplyDown", payload) return c.uniPacket("MultiMsg.ApplyDown", payload)
return seq, packet
} }
// MultiMsg.ApplyDown // MultiMsg.ApplyDown

View File

@ -28,7 +28,7 @@ func (c *QQClient) buildOfflineFileDownloadRequestPacket(uuid []byte) (uint16, [
}, },
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "OfflineFilleHandleSvr.pb_ftn_CMD_REQ_APPLY_DOWNLOAD-1200", payload) packet := c.uniPacketWithSeq(seq, "OfflineFilleHandleSvr.pb_ftn_CMD_REQ_APPLY_DOWNLOAD-1200", payload)
return seq, packet return seq, packet
} }

View File

@ -17,7 +17,7 @@ func (c *QQClient) buildOicqRequestPacket(uin int64, command uint16, body []byte
} }
//go:noinline //go:noinline
func (c *QQClient) uniPacketWithSeq(command string, body []byte) (uint16, []byte) { func (c *QQClient) uniPacket(command string, body []byte) (uint16, []byte) {
seq := c.nextSeq() seq := c.nextSeq()
req := codec.Uni{ req := codec.Uni{
Uin: c.Uin, Uin: c.Uin,
@ -33,7 +33,7 @@ func (c *QQClient) uniPacketWithSeq(command string, body []byte) (uint16, []byte
} }
//go:noinline //go:noinline
func (c *QQClient) uniPacket(seq uint16, command string, body []byte) []byte { func (c *QQClient) uniPacketWithSeq(seq uint16, command string, body []byte) []byte {
req := codec.Uni{ req := codec.Uni{
Uin: c.Uin, Uin: c.Uin,
Seq: seq, Seq: seq,

View File

@ -146,7 +146,6 @@ func (c *QQClient) buildGetOneDayRoamMsgRequest(target, lastMsgTime, random int6
// MessageSvc.PbSendMsg // MessageSvc.PbSendMsg
func (c *QQClient) buildFriendSendingPacket(target int64, msgSeq, r, pkgNum, pkgIndex, pkgDiv int32, time int64, m []message.IMessageElement) (uint16, []byte) { func (c *QQClient) buildFriendSendingPacket(target int64, msgSeq, r, pkgNum, pkgIndex, pkgDiv int32, time int64, m []message.IMessageElement) (uint16, []byte) {
seq := c.nextSeq()
var ptt *msg.Ptt var ptt *msg.Ptt
if len(m) > 0 { if len(m) > 0 {
if p, ok := m[0].(*message.PrivateVoiceElement); ok { if p, ok := m[0].(*message.PrivateVoiceElement); ok {
@ -179,13 +178,11 @@ func (c *QQClient) buildFriendSendingPacket(target int64, msgSeq, r, pkgNum, pkg
}(), }(),
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "MessageSvc.PbSendMsg", payload) return c.uniPacket("MessageSvc.PbSendMsg", payload)
return seq, packet
} }
// MessageSvc.PbSendMsg // MessageSvc.PbSendMsg
func (c *QQClient) buildGroupTempSendingPacket(groupUin, target int64, msgSeq, r int32, time int64, m *message.SendingMessage) (uint16, []byte) { func (c *QQClient) buildGroupTempSendingPacket(groupUin, target int64, msgSeq, r int32, time int64, m *message.SendingMessage) (uint16, []byte) {
seq := c.nextSeq()
req := &msg.SendMessageRequest{ req := &msg.SendMessageRequest{
RoutingHead: &msg.RoutingHead{GrpTmp: &msg.GrpTmp{ RoutingHead: &msg.RoutingHead{GrpTmp: &msg.GrpTmp{
GroupUin: &groupUin, GroupUin: &groupUin,
@ -213,12 +210,10 @@ func (c *QQClient) buildGroupTempSendingPacket(groupUin, target int64, msgSeq, r
}(), }(),
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "MessageSvc.PbSendMsg", payload) return c.uniPacket("MessageSvc.PbSendMsg", payload)
return seq, packet
} }
func (c *QQClient) buildWPATempSendingPacket(uin int64, sig []byte, msgSeq, r int32, time int64, m *message.SendingMessage) (uint16, []byte) { func (c *QQClient) buildWPATempSendingPacket(uin int64, sig []byte, msgSeq, r int32, time int64, m *message.SendingMessage) (uint16, []byte) {
seq := c.nextSeq()
req := &msg.SendMessageRequest{ req := &msg.SendMessageRequest{
RoutingHead: &msg.RoutingHead{WpaTmp: &msg.WPATmp{ RoutingHead: &msg.RoutingHead{WpaTmp: &msg.WPATmp{
ToUin: proto.Uint64(uint64(uin)), ToUin: proto.Uint64(uint64(uin)),
@ -246,6 +241,5 @@ func (c *QQClient) buildWPATempSendingPacket(uin int64, sig []byte, msgSeq, r in
}(), }(),
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "MessageSvc.PbSendMsg", payload) return c.uniPacket("MessageSvc.PbSendMsg", payload)
return seq, packet
} }

View File

@ -247,7 +247,7 @@ func (c *QQClient) buildPttShortVideoDownReqPacket(uuid, md5 []byte) (uint16, []
}, },
} }
payload, _ := proto.Marshal(body) payload, _ := proto.Marshal(body)
packet := c.uniPacket(seq, "PttCenterSvr.ShortVideoDownReq", payload) packet := c.uniPacketWithSeq(seq, "PttCenterSvr.ShortVideoDownReq", payload)
return seq, packet return seq, packet
} }
@ -286,10 +286,8 @@ func (c *QQClient) buildPttGroupShortVideoProto(videoHash, thumbHash []byte, toU
// PttCenterSvr.GroupShortVideoUpReq // PttCenterSvr.GroupShortVideoUpReq
func (c *QQClient) buildPttGroupShortVideoUploadReqPacket(videoHash, thumbHash []byte, toUin, videoSize, thumbSize int64) (uint16, []byte) { func (c *QQClient) buildPttGroupShortVideoUploadReqPacket(videoHash, thumbHash []byte, toUin, videoSize, thumbSize int64) (uint16, []byte) {
seq := c.nextSeq()
payload, _ := proto.Marshal(c.buildPttGroupShortVideoProto(videoHash, thumbHash, toUin, videoSize, thumbSize, 1)) payload, _ := proto.Marshal(c.buildPttGroupShortVideoProto(videoHash, thumbHash, toUin, videoSize, thumbSize, 1))
packet := c.uniPacket(seq, "PttCenterSvr.GroupShortVideoUpReq", payload) return c.uniPacket("PttCenterSvr.GroupShortVideoUpReq", payload)
return seq, packet
} }
// PttCenterSvr.pb_pttCenter_CMD_REQ_APPLY_UPLOAD-500 // PttCenterSvr.pb_pttCenter_CMD_REQ_APPLY_UPLOAD-500

View File

@ -63,7 +63,6 @@ func (c *QQClient) getQiDianAddressDetailList() ([]*FriendInfo, error) {
} }
func (c *QQClient) buildLoginExtraPacket() (uint16, []byte) { func (c *QQClient) buildLoginExtraPacket() (uint16, []byte) {
seq := c.nextSeq()
req := &cmd0x3f6.C3F6ReqBody{ req := &cmd0x3f6.C3F6ReqBody{
SubCmd: proto.Uint32(69), SubCmd: proto.Uint32(69),
CrmCommonHead: &cmd0x3f6.C3F6CRMMsgHead{ CrmCommonHead: &cmd0x3f6.C3F6CRMMsgHead{
@ -86,12 +85,10 @@ func (c *QQClient) buildLoginExtraPacket() (uint16, []byte) {
}, },
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "qidianservice.69", payload) return c.uniPacket("qidianservice.69", payload)
return seq, packet
} }
func (c *QQClient) buildConnKeyRequestPacket() (uint16, []byte) { func (c *QQClient) buildConnKeyRequestPacket() (uint16, []byte) {
seq := c.nextSeq()
req := &cmd0x6ff.C501ReqBody{ req := &cmd0x6ff.C501ReqBody{
ReqBody: &cmd0x6ff.SubCmd0X501ReqBody{ ReqBody: &cmd0x6ff.SubCmd0X501ReqBody{
Uin: proto.Uint64(uint64(c.Uin)), Uin: proto.Uint64(uint64(c.Uin)),
@ -103,8 +100,7 @@ func (c *QQClient) buildConnKeyRequestPacket() (uint16, []byte) {
}, },
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "HttpConn.0x6ff_501", payload) return c.uniPacket("HttpConn.0x6ff_501", payload)
return seq, packet
} }
func (c *QQClient) bigDataRequest(subCmd uint32, req proto.Message) ([]byte, error) { func (c *QQClient) bigDataRequest(subCmd uint32, req proto.Message) ([]byte, error) {

View File

@ -44,7 +44,6 @@ func (c *QQClient) RecallPrivateMessage(uin, ts int64, msgID, msgInternalId int3
// PbMessageSvc.PbMsgWithDraw // PbMessageSvc.PbMsgWithDraw
func (c *QQClient) buildGroupRecallPacket(groupCode int64, msgSeq, msgRan int32) (uint16, []byte) { func (c *QQClient) buildGroupRecallPacket(groupCode int64, msgSeq, msgRan int32) (uint16, []byte) {
seq := c.nextSeq()
req := &msg.MsgWithDrawReq{ req := &msg.MsgWithDrawReq{
GroupWithDraw: []*msg.GroupMsgWithDrawReq{ GroupWithDraw: []*msg.GroupMsgWithDrawReq{
{ {
@ -62,12 +61,10 @@ func (c *QQClient) buildGroupRecallPacket(groupCode int64, msgSeq, msgRan int32)
}, },
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "PbMessageSvc.PbMsgWithDraw", payload) return c.uniPacket("PbMessageSvc.PbMsgWithDraw", payload)
return seq, packet
} }
func (c *QQClient) buildPrivateRecallPacket(uin, ts int64, msgSeq, random int32) (uint16, []byte) { func (c *QQClient) buildPrivateRecallPacket(uin, ts int64, msgSeq, random int32) (uint16, []byte) {
seq := c.nextSeq()
req := &msg.MsgWithDrawReq{C2CWithDraw: []*msg.C2CMsgWithDrawReq{ req := &msg.MsgWithDrawReq{C2CWithDraw: []*msg.C2CMsgWithDrawReq{
{ {
MsgInfo: []*msg.C2CMsgInfo{ MsgInfo: []*msg.C2CMsgInfo{
@ -91,8 +88,7 @@ func (c *QQClient) buildPrivateRecallPacket(uin, ts int64, msgSeq, random int32)
}, },
}} }}
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "PbMessageSvc.PbMsgWithDraw", payload) return c.uniPacket("PbMessageSvc.PbMsgWithDraw", payload)
return seq, packet
} }
func decodeMsgWithDrawResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) { func decodeMsgWithDrawResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {

View File

@ -98,7 +98,6 @@ func (c *QQClient) SendGuildMusicShare(guildID, channelID uint64, msg *message.M
// OidbSvc.0xb77_9 // OidbSvc.0xb77_9
func (c *QQClient) buildRichMsgSendingPacket(guild uint64, target int64, msg *message.MusicShareElement, sendType uint32) (uint16, []byte) { func (c *QQClient) buildRichMsgSendingPacket(guild uint64, target int64, msg *message.MusicShareElement, sendType uint32) (uint16, []byte) {
seq := c.nextSeq()
tp := musicType[msg.MusicType] // MusicType tp := musicType[msg.MusicType] // MusicType
msgStyle := uint32(0) msgStyle := uint32(0)
if msg.MusicUrl != "" { if msg.MusicUrl != "" {
@ -129,6 +128,5 @@ func (c *QQClient) buildRichMsgSendingPacket(guild uint64, target int64, msg *me
} }
b, _ := proto.Marshal(body) b, _ := proto.Marshal(body)
payload := c.packOIDBPackage(2935, 9, b) payload := c.packOIDBPackage(2935, 9, b)
packet := c.uniPacket(seq, "OidbSvc.0xb77_9", payload) return c.uniPacket("OidbSvc.0xb77_9", payload)
return seq, packet
} }

View File

@ -29,7 +29,6 @@ func (c *QQClient) CheckUrlSafely(url string) UrlSecurityLevel {
} }
func (c *QQClient) buildUrlCheckRequest(url string) (uint16, []byte) { func (c *QQClient) buildUrlCheckRequest(url string) (uint16, []byte) {
seq := c.nextSeq()
payload := c.packOIDBPackageProto(3019, 0, &oidb.DBCBReqBody{ payload := c.packOIDBPackageProto(3019, 0, &oidb.DBCBReqBody{
CheckUrlReq: &oidb.CheckUrlReq{ CheckUrlReq: &oidb.CheckUrlReq{
Url: []string{url}, Url: []string{url},
@ -45,8 +44,7 @@ func (c *QQClient) buildUrlCheckRequest(url string) (uint16, []byte) {
Qua: proto.String("AQQ_2013 4.6/2013 8.4.184945&NA_0/000000&ADR&null18&linux&2017&C2293D02BEE31158&7.1.2&V3"), Qua: proto.String("AQQ_2013 4.6/2013 8.4.184945&NA_0/000000&ADR&null18&linux&2017&C2293D02BEE31158&7.1.2&V3"),
}, },
}) })
packet := c.uniPacket(seq, "OidbSvc.0xbcb_0", payload) return c.uniPacket("OidbSvc.0xbcb_0", payload)
return seq, packet
} }
func decodeUrlCheckResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) { func decodeUrlCheckResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {

View File

@ -119,7 +119,6 @@ func (c *QQClient) MarkPrivateMessageReaded(uin, time int64) {
// StatSvc.GetDevLoginInfo // StatSvc.GetDevLoginInfo
func (c *QQClient) buildDeviceListRequestPacket() (uint16, []byte) { func (c *QQClient) buildDeviceListRequestPacket() (uint16, []byte) {
seq := c.nextSeq()
req := &jce.SvcReqGetDevLoginInfo{ req := &jce.SvcReqGetDevLoginInfo{
Guid: c.deviceInfo.Guid, Guid: c.deviceInfo.Guid,
LoginType: 1, LoginType: 1,
@ -136,13 +135,11 @@ func (c *QQClient) buildDeviceListRequestPacket() (uint16, []byte) {
Context: make(map[string]string), Context: make(map[string]string),
Status: make(map[string]string), Status: make(map[string]string),
} }
packet := c.uniPacket(seq, "StatSvc.GetDevLoginInfo", pkt.ToBytes()) return c.uniPacket("StatSvc.GetDevLoginInfo", pkt.ToBytes())
return seq, packet
} }
// RegPrxySvc.getOffMsg // RegPrxySvc.getOffMsg
func (c *QQClient) buildGetOfflineMsgRequestPacket() (uint16, []byte) { func (c *QQClient) buildGetOfflineMsgRequestPacket() (uint16, []byte) {
seq := c.nextSeq()
regReq := &jce.SvcReqRegisterNew{ regReq := &jce.SvcReqRegisterNew{
RequestOptional: 0x101C2 | 32, RequestOptional: 0x101C2 | 32,
C2CMsg: &jce.SvcReqGetMsgV2{ C2CMsg: &jce.SvcReqGetMsgV2{
@ -192,13 +189,11 @@ func (c *QQClient) buildGetOfflineMsgRequestPacket() (uint16, []byte) {
Context: make(map[string]string), Context: make(map[string]string),
Status: make(map[string]string), Status: make(map[string]string),
} }
packet := c.uniPacket(seq, "RegPrxySvc.getOffMsg", pkt.ToBytes()) return c.uniPacket("RegPrxySvc.getOffMsg", pkt.ToBytes())
return seq, packet
} }
// RegPrxySvc.PbSyncMsg // RegPrxySvc.PbSyncMsg
func (c *QQClient) buildSyncMsgRequestPacket() (uint16, []byte) { func (c *QQClient) buildSyncMsgRequestPacket() (uint16, []byte) {
seq := c.nextSeq()
oidbReq, _ := proto.Marshal(&oidb.D769RspBody{ oidbReq, _ := proto.Marshal(&oidb.D769RspBody{
ConfigList: []*oidb.D769ConfigSeq{ ConfigList: []*oidb.D769ConfigSeq{
{ {
@ -266,31 +261,26 @@ func (c *QQClient) buildSyncMsgRequestPacket() (uint16, []byte) {
Context: make(map[string]string), Context: make(map[string]string),
Status: make(map[string]string), Status: make(map[string]string),
} }
packet := c.uniPacket(seq, "RegPrxySvc.infoSync", pkt.ToBytes()) return c.uniPacket("RegPrxySvc.infoSync", pkt.ToBytes())
return seq, packet
} }
// PbMessageSvc.PbMsgReadedReport // PbMessageSvc.PbMsgReadedReport
func (c *QQClient) buildGroupMsgReadedPacket(groupCode, msgSeq int64) (uint16, []byte) { func (c *QQClient) buildGroupMsgReadedPacket(groupCode, msgSeq int64) (uint16, []byte) {
seq := c.nextSeq()
req, _ := proto.Marshal(&msg.PbMsgReadedReportReq{GrpReadReport: []*msg.PbGroupReadedReportReq{{ req, _ := proto.Marshal(&msg.PbMsgReadedReportReq{GrpReadReport: []*msg.PbGroupReadedReportReq{{
GroupCode: proto.Uint64(uint64(groupCode)), GroupCode: proto.Uint64(uint64(groupCode)),
LastReadSeq: proto.Uint64(uint64(msgSeq)), LastReadSeq: proto.Uint64(uint64(msgSeq)),
}}}) }}})
packet := c.uniPacket(seq, "PbMessageSvc.PbMsgReadedReport", req) return c.uniPacket("PbMessageSvc.PbMsgReadedReport", req)
return seq, packet
} }
func (c *QQClient) buildPrivateMsgReadedPacket(uin, time int64) (uint16, []byte) { func (c *QQClient) buildPrivateMsgReadedPacket(uin, time int64) (uint16, []byte) {
seq := c.nextSeq()
req, _ := proto.Marshal(&msg.PbMsgReadedReportReq{C2CReadReport: &msg.PbC2CReadedReportReq{PairInfo: []*msg.UinPairReadInfo{ req, _ := proto.Marshal(&msg.PbMsgReadedReportReq{C2CReadReport: &msg.PbC2CReadedReportReq{PairInfo: []*msg.UinPairReadInfo{
{ {
PeerUin: proto.Uint64(uint64(uin)), PeerUin: proto.Uint64(uint64(uin)),
LastReadTime: proto.Uint32(uint32(time)), LastReadTime: proto.Uint32(uint32(time)),
}, },
}, SyncCookie: c.syncCookie}}) }, SyncCookie: c.syncCookie}})
packet := c.uniPacket(seq, "PbMessageSvc.PbMsgReadedReport", req) return c.uniPacket("PbMessageSvc.PbMsgReadedReport", req)
return seq, packet
} }
// StatSvc.GetDevLoginInfo // StatSvc.GetDevLoginInfo

View File

@ -98,7 +98,6 @@ func (c *QQClient) exceptAndDispatchGroupSysMsg() {
// ProfileService.Pb.ReqSystemMsgNew.Group // ProfileService.Pb.ReqSystemMsgNew.Group
func (c *QQClient) buildSystemMsgNewGroupPacket(suspicious bool) (uint16, []byte) { func (c *QQClient) buildSystemMsgNewGroupPacket(suspicious bool) (uint16, []byte) {
seq := c.nextSeq()
req := &structmsg.ReqSystemMsgNew{ req := &structmsg.ReqSystemMsgNew{
MsgNum: 100, MsgNum: 100,
Version: 1000, Version: 1000,
@ -130,13 +129,11 @@ func (c *QQClient) buildSystemMsgNewGroupPacket(suspicious bool) (uint16, []byte
}(), }(),
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "ProfileService.Pb.ReqSystemMsgNew.Group", payload) return c.uniPacket("ProfileService.Pb.ReqSystemMsgNew.Group", payload)
return seq, packet
} }
// ProfileService.Pb.ReqSystemMsgAction.Group // ProfileService.Pb.ReqSystemMsgAction.Group
func (c *QQClient) buildSystemMsgGroupActionPacket(reqID, requester, group int64, msgType int32, isInvite, accept, block bool, reason string) (uint16, []byte) { func (c *QQClient) buildSystemMsgGroupActionPacket(reqID, requester, group int64, msgType int32, isInvite, accept, block bool, reason string) (uint16, []byte) {
seq := c.nextSeq()
subSrcId := int32(31) subSrcId := int32(31)
groupMsgType := int32(1) groupMsgType := int32(1)
if isInvite { if isInvite {
@ -165,13 +162,11 @@ func (c *QQClient) buildSystemMsgGroupActionPacket(reqID, requester, group int64
Language: 1000, Language: 1000,
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "ProfileService.Pb.ReqSystemMsgAction.Group", payload) return c.uniPacket("ProfileService.Pb.ReqSystemMsgAction.Group", payload)
return seq, packet
} }
// ProfileService.Pb.ReqSystemMsgAction.Friend // ProfileService.Pb.ReqSystemMsgAction.Friend
func (c *QQClient) buildSystemMsgFriendActionPacket(reqID, requester int64, accept bool) (uint16, []byte) { func (c *QQClient) buildSystemMsgFriendActionPacket(reqID, requester int64, accept bool) (uint16, []byte) {
seq := c.nextSeq()
infoType := int32(3) infoType := int32(3)
if accept { if accept {
infoType = 2 infoType = 2
@ -190,8 +185,7 @@ func (c *QQClient) buildSystemMsgFriendActionPacket(reqID, requester int64, acce
}, },
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "ProfileService.Pb.ReqSystemMsgAction.Friend", payload) return c.uniPacket("ProfileService.Pb.ReqSystemMsgAction.Friend", payload)
return seq, packet
} }
// ProfileService.Pb.ReqSystemMsgNew.Group // ProfileService.Pb.ReqSystemMsgNew.Group

View File

@ -8,7 +8,6 @@ import (
) )
func (c *QQClient) buildTranslatePacket(src, dst, text string) (uint16, []byte) { func (c *QQClient) buildTranslatePacket(src, dst, text string) (uint16, []byte) {
seq := c.nextSeq()
body := &oidb.TranslateReqBody{ body := &oidb.TranslateReqBody{
BatchTranslateReq: &oidb.BatchTranslateReq{ BatchTranslateReq: &oidb.BatchTranslateReq{
SrcLanguage: src, SrcLanguage: src,
@ -23,8 +22,7 @@ func (c *QQClient) buildTranslatePacket(src, dst, text string) (uint16, []byte)
Bodybuffer: b, Bodybuffer: b,
} }
payload, _ := proto.Marshal(req) payload, _ := proto.Marshal(req)
packet := c.uniPacket(seq, "OidbSvc.0x990", payload) return c.uniPacket("OidbSvc.0x990", payload)
return seq, packet
} }
func (c *QQClient) Translate(src, dst, text string) (string, error) { func (c *QQClient) Translate(src, dst, text string) (string, error) {

View File

@ -90,8 +90,7 @@ func (c *QQClient) webSsoRequest(host, webCmd, data string) (string, error) {
Type: proto.Uint32(0), Type: proto.Uint32(0),
Data: &data, Data: &data,
}) })
seq := c.nextSeq() rspData, err := c.sendAndWaitDynamic(c.uniPacket(cmd, req))
rspData, err := c.sendAndWaitDynamic(seq, c.uniPacket(seq, cmd, req))
if err != nil { if err != nil {
return "", errors.Wrap(err, "send web sso request error") return "", errors.Wrap(err, "send web sso request error")
} }