1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00

move ptt.

This commit is contained in:
Mrs4s 2020-10-16 00:13:03 +08:00
parent a27b43378b
commit cee229f738
3 changed files with 64 additions and 56 deletions

View File

@ -761,37 +761,6 @@ func (c *QQClient) buildImageUploadPacket(data, updKey []byte, commandId int32,
return 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 // ProfileService.Pb.ReqSystemMsgNew.Group
func (c *QQClient) buildSystemMsgNewGroupPacket() (uint16, []byte) { func (c *QQClient) buildSystemMsgNewGroupPacket() (uint16, []byte) {
seq := c.nextSeq() 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) packet := packets.BuildUniPacket(c.Uin, seq, "LightAppSvc.mini_app_info.GetAppInfoById", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
return seq, packet return seq, packet
} }
func (c *QQClient) buildWordSegmentationPacket(data []byte) (uint16, []byte) { func (c *QQClient) buildWordSegmentationPacket(data []byte) (uint16, []byte) {
seq := c.nextSeq() seq := c.nextSeq()
body := &oidb.D79ReqBody{ body := &oidb.D79ReqBody{

View File

@ -644,31 +644,6 @@ func decodeGroupImageStoreResponse(_ *QQClient, _ uint16, payload []byte) (inter
}, nil }, 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 // LongConn.OffPicUp
func decodeOffPicUpResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) { func decodeOffPicUpResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
rsp := cmd0x352.RspBody{} rsp := cmd0x352.RspBody{}

63
client/ptt.go Normal file
View 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
}