diff --git a/client/builders.go b/client/builders.go index a1287436..32e3732c 100644 --- a/client/builders.go +++ b/client/builders.go @@ -761,37 +761,6 @@ func (c *QQClient) buildImageUploadPacket(data, updKey []byte, commandId int32, return } -// PttStore.GroupPttUp -func (c *QQClient) buildGroupPttStorePacket(groupCode int64, md5 []byte, size, codec, voiceLength int32) (uint16, []byte) { - seq := c.nextSeq() - req := &pb.D388ReqBody{ - NetType: 3, - Subcmd: 3, - MsgTryUpPttReq: []*pb.TryUpPttReq{ - { - GroupCode: groupCode, - SrcUin: c.Uin, - FileMd5: md5, - FileSize: int64(size), - FileName: md5, - SrcTerm: 5, - PlatformType: 9, - BuType: 4, - InnerIp: 0, - BuildVer: "6.5.5.663", - VoiceLength: voiceLength, - Codec: codec, - VoiceType: 1, - BoolNewUpChan: true, - }, - }, - Extension: EmptyBytes, - } - payload, _ := proto.Marshal(req) - packet := packets.BuildUniPacket(c.Uin, seq, "PttStore.GroupPttUp", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload) - return seq, packet -} - // ProfileService.Pb.ReqSystemMsgNew.Group func (c *QQClient) buildSystemMsgNewGroupPacket() (uint16, []byte) { seq := c.nextSeq() @@ -1284,6 +1253,7 @@ func (c *QQClient) buildAppInfoRequestPacket(id string) (uint16, []byte) { packet := packets.BuildUniPacket(c.Uin, seq, "LightAppSvc.mini_app_info.GetAppInfoById", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload) return seq, packet } + func (c *QQClient) buildWordSegmentationPacket(data []byte) (uint16, []byte) { seq := c.nextSeq() body := &oidb.D79ReqBody{ diff --git a/client/decoders.go b/client/decoders.go index 4b4633d4..f91fe918 100644 --- a/client/decoders.go +++ b/client/decoders.go @@ -644,31 +644,6 @@ func decodeGroupImageStoreResponse(_ *QQClient, _ uint16, payload []byte) (inter }, nil } -// PttStore.GroupPttUp -func decodeGroupPttStoreResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) { - pkt := pb.D388RespBody{} - err := proto.Unmarshal(payload, &pkt) - if err != nil { - return nil, err - } - rsp := pkt.MsgTryUpPttRsp[0] - if rsp.Result != 0 { - return pttUploadResponse{ - ResultCode: rsp.Result, - Message: rsp.FailMsg, - }, nil - } - if rsp.BoolFileExit { - return pttUploadResponse{IsExists: true}, nil - } - return pttUploadResponse{ - UploadKey: rsp.UpUkey, - UploadIp: rsp.Uint32UpIp, - UploadPort: rsp.Uint32UpPort, - FileKey: rsp.FileKey, - }, nil -} - // LongConn.OffPicUp func decodeOffPicUpResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) { rsp := cmd0x352.RspBody{} diff --git a/client/ptt.go b/client/ptt.go new file mode 100644 index 00000000..b16984e0 --- /dev/null +++ b/client/ptt.go @@ -0,0 +1,63 @@ +package client + +import ( + "github.com/Mrs4s/MiraiGo/client/pb" + "github.com/Mrs4s/MiraiGo/protocol/packets" + "google.golang.org/protobuf/proto" +) + +// PttStore.GroupPttUp +func (c *QQClient) buildGroupPttStorePacket(groupCode int64, md5 []byte, size, codec, voiceLength int32) (uint16, []byte) { + seq := c.nextSeq() + req := &pb.D388ReqBody{ + NetType: 3, + Subcmd: 3, + MsgTryUpPttReq: []*pb.TryUpPttReq{ + { + GroupCode: groupCode, + SrcUin: c.Uin, + FileMd5: md5, + FileSize: int64(size), + FileName: md5, + SrcTerm: 5, + PlatformType: 9, + BuType: 4, + InnerIp: 0, + BuildVer: "6.5.5.663", + VoiceLength: voiceLength, + Codec: codec, + VoiceType: 1, + BoolNewUpChan: true, + }, + }, + Extension: EmptyBytes, + } + payload, _ := proto.Marshal(req) + packet := packets.BuildUniPacket(c.Uin, seq, "PttStore.GroupPttUp", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload) + return seq, packet +} + +// PttStore.GroupPttUp +func decodeGroupPttStoreResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) { + pkt := pb.D388RespBody{} + err := proto.Unmarshal(payload, &pkt) + if err != nil { + return nil, err + } + rsp := pkt.MsgTryUpPttRsp[0] + if rsp.Result != 0 { + return pttUploadResponse{ + ResultCode: rsp.Result, + Message: rsp.FailMsg, + }, nil + } + if rsp.BoolFileExit { + return pttUploadResponse{IsExists: true}, nil + } + return pttUploadResponse{ + UploadKey: rsp.UpUkey, + UploadIp: rsp.Uint32UpIp, + UploadPort: rsp.Uint32UpPort, + FileKey: rsp.FileKey, + }, nil +}