mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
move ptt.
This commit is contained in:
parent
a27b43378b
commit
cee229f738
@ -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{
|
||||
|
@ -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{}
|
||||
|
63
client/ptt.go
Normal file
63
client/ptt.go
Normal file
@ -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
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user