mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 19:17:38 +08:00
refactor: use new protobuf impl oidb0x6d8
This commit is contained in:
parent
8e5ac24d32
commit
28da394096
@ -4,6 +4,8 @@ import (
|
||||
"crypto/sha1"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"github.com/Mrs4s/MiraiGo/internal/protobuf/data/oidb/oidb0x6d8"
|
||||
"go.dedis.ch/protobuf"
|
||||
"io"
|
||||
"math/rand"
|
||||
"os"
|
||||
@ -85,8 +87,8 @@ func (c *QQClient) GetGroupFileSystem(groupCode int64) (fs *GroupFileSystem, err
|
||||
return nil, e
|
||||
}
|
||||
fs = &GroupFileSystem{
|
||||
FileCount: rsp.(*oidb.D6D8RspBody).FileCountRsp.GetAllFileCount(),
|
||||
LimitCount: rsp.(*oidb.D6D8RspBody).FileCountRsp.GetLimitCount(),
|
||||
FileCount: rsp.(*oidb0x6d8.RspBody).GroupFileCntRsp.GetAllFileCount(),
|
||||
LimitCount: rsp.(*oidb0x6d8.RspBody).GroupFileCntRsp.GetLimitCount(),
|
||||
GroupCode: groupCode,
|
||||
client: c,
|
||||
}
|
||||
@ -94,8 +96,8 @@ func (c *QQClient) GetGroupFileSystem(groupCode int64) (fs *GroupFileSystem, err
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fs.TotalSpace = rsp.(*oidb.D6D8RspBody).GroupSpaceRsp.GetTotalSpace()
|
||||
fs.UsedSpace = rsp.(*oidb.D6D8RspBody).GroupSpaceRsp.GetUsedSpace()
|
||||
fs.TotalSpace = rsp.(*oidb0x6d8.RspBody).GroupSpaceRsp.GetTotalSpace()
|
||||
fs.UsedSpace = rsp.(*oidb0x6d8.RspBody).GroupSpaceRsp.GetUsedSpace()
|
||||
return fs, nil
|
||||
}
|
||||
|
||||
@ -122,7 +124,7 @@ func (fs *GroupFileSystem) GetFilesByFolder(folderID string) ([]*GroupFile, []*G
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
rsp := i.(*oidb.D6D8RspBody)
|
||||
rsp := i.(*oidb0x6d8.RspBody)
|
||||
if rsp.FileListInfoRsp == nil {
|
||||
break
|
||||
}
|
||||
@ -314,7 +316,7 @@ func (c *QQClient) buildGroupFileFeedsRequest(groupCode int64, fileID string, bu
|
||||
// OidbSvc.0x6d8_1
|
||||
func (c *QQClient) buildGroupFileListRequestPacket(groupCode int64, folderID string, startIndex uint32) (uint16, []byte) {
|
||||
seq := c.nextSeq()
|
||||
body := &oidb.D6D8ReqBody{FileListInfoReq: &oidb.GetFileListReqBody{
|
||||
body := &oidb0x6d8.ReqBody{FileListInfoReq: &oidb0x6d8.GetFileListReqBody{
|
||||
GroupCode: proto.Uint64(uint64(groupCode)),
|
||||
AppId: proto.Uint32(3),
|
||||
FolderId: &folderID,
|
||||
@ -327,7 +329,7 @@ func (c *QQClient) buildGroupFileListRequestPacket(groupCode int64, folderID str
|
||||
StartIndex: &startIndex,
|
||||
Context: EmptyBytes,
|
||||
}}
|
||||
b, _ := proto.Marshal(body)
|
||||
b, _ := body.Marshal()
|
||||
req := &oidb.OIDBSSOPkg{
|
||||
Command: 1752,
|
||||
ServiceType: 1,
|
||||
@ -341,12 +343,12 @@ func (c *QQClient) buildGroupFileListRequestPacket(groupCode int64, folderID str
|
||||
|
||||
func (c *QQClient) buildGroupFileCountRequestPacket(groupCode int64) (uint16, []byte) {
|
||||
seq := c.nextSeq()
|
||||
body := &oidb.D6D8ReqBody{GroupFileCountReq: &oidb.GetFileCountReqBody{
|
||||
body := &oidb0x6d8.ReqBody{GroupFileCntReq: &oidb0x6d8.GetFileCountReqBody{
|
||||
GroupCode: proto.Uint64(uint64(groupCode)),
|
||||
AppId: proto.Uint32(3),
|
||||
BusId: proto.Uint32(0),
|
||||
}}
|
||||
b, _ := proto.Marshal(body)
|
||||
b, _ := body.Marshal()
|
||||
req := &oidb.OIDBSSOPkg{
|
||||
Command: 1752,
|
||||
ServiceType: 2,
|
||||
@ -360,11 +362,11 @@ func (c *QQClient) buildGroupFileCountRequestPacket(groupCode int64) (uint16, []
|
||||
|
||||
func (c *QQClient) buildGroupFileSpaceRequestPacket(groupCode int64) (uint16, []byte) {
|
||||
seq := c.nextSeq()
|
||||
body := &oidb.D6D8ReqBody{GroupSpaceReq: &oidb.GetSpaceReqBody{
|
||||
body := &oidb0x6d8.ReqBody{GroupSpaceReq: &oidb0x6d8.GetSpaceReqBody{
|
||||
GroupCode: proto.Uint64(uint64(groupCode)),
|
||||
AppId: proto.Uint32(3),
|
||||
}}
|
||||
b, _ := proto.Marshal(body)
|
||||
b, _ := body.Marshal()
|
||||
req := &oidb.OIDBSSOPkg{
|
||||
Command: 1752,
|
||||
ServiceType: 3,
|
||||
@ -456,11 +458,11 @@ func (c *QQClient) buildGroupFileDeleteReqPacket(groupCode int64, parentFolderId
|
||||
|
||||
func decodeOIDB6d81Response(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
|
||||
pkg := oidb.OIDBSSOPkg{}
|
||||
rsp := oidb.D6D8RspBody{}
|
||||
rsp := oidb0x6d8.RspBody{}
|
||||
if err := proto.Unmarshal(payload, &pkg); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
}
|
||||
if err := proto.Unmarshal(pkg.Bodybuffer, &rsp); err != nil {
|
||||
if err := protobuf.Decode(pkg.Bodybuffer, &rsp); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
|
||||
}
|
||||
return &rsp, nil
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,137 +0,0 @@
|
||||
syntax = "proto2";
|
||||
|
||||
option go_package = "./;oidb";
|
||||
|
||||
message D6D8ReqBody {
|
||||
optional GetFileInfoReqBody fileInfoReq = 1;
|
||||
optional GetFileListReqBody fileListInfoReq = 2;
|
||||
optional GetFileCountReqBody groupFileCountReq = 3;
|
||||
optional GetSpaceReqBody groupSpaceReq = 4;
|
||||
}
|
||||
|
||||
message D6D8RspBody {
|
||||
optional GetFileInfoRspBody fileInfoRsp = 1;
|
||||
optional GetFileListRspBody fileListInfoRsp = 2;
|
||||
optional GetFileCountRspBody fileCountRsp = 3;
|
||||
optional GetSpaceRspBody groupSpaceRsp = 4;
|
||||
}
|
||||
|
||||
message GetFileInfoReqBody {
|
||||
optional uint64 groupCode = 1;
|
||||
optional uint32 appId = 2;
|
||||
optional uint32 busId = 3;
|
||||
optional string fileId = 4;
|
||||
optional uint32 fieldFlag = 5;
|
||||
}
|
||||
|
||||
message GetFileInfoRspBody {
|
||||
optional int32 retCode = 1;
|
||||
optional string retMsg = 2;
|
||||
optional string clientWording = 3;
|
||||
optional GroupFileInfo fileInfo = 4;
|
||||
}
|
||||
|
||||
message GetFileListRspBody {
|
||||
optional int32 retCode = 1;
|
||||
optional string retMsg = 2;
|
||||
optional string clientWording = 3;
|
||||
optional bool isEnd = 4;
|
||||
message Item {
|
||||
optional uint32 type = 1;
|
||||
optional GroupFolderInfo folderInfo = 2;
|
||||
optional GroupFileInfo fileInfo = 3;
|
||||
}
|
||||
repeated Item itemList = 5;
|
||||
optional FileTimeStamp maxTimestamp = 6;
|
||||
optional uint32 allFileCount = 7;
|
||||
optional uint32 filterCode = 8;
|
||||
optional bool safeCheckFlag = 11;
|
||||
optional uint32 safeCheckRes = 12;
|
||||
optional uint32 nextIndex = 13;
|
||||
optional bytes context = 14;
|
||||
optional uint32 role = 15;
|
||||
optional uint32 openFlag = 16;
|
||||
}
|
||||
|
||||
message GroupFileInfo {/* renamed from FileInfo */
|
||||
optional string fileId = 1;
|
||||
optional string fileName = 2;
|
||||
optional uint64 fileSize = 3;
|
||||
optional uint32 busId = 4;
|
||||
optional uint64 uploadedSize = 5;
|
||||
optional uint32 uploadTime = 6;
|
||||
optional uint32 deadTime = 7;
|
||||
optional uint32 modifyTime = 8;
|
||||
optional uint32 downloadTimes = 9;
|
||||
optional bytes sha = 10;
|
||||
optional bytes sha3 = 11;
|
||||
optional bytes md5 = 12;
|
||||
optional string localPath = 13;
|
||||
optional string uploaderName = 14;
|
||||
optional uint64 uploaderUin = 15;
|
||||
optional string parentFolderId = 16;
|
||||
}
|
||||
|
||||
message GroupFolderInfo {/* renamed from FolderInfo */
|
||||
optional string folderId = 1;
|
||||
optional string parentFolderId = 2;
|
||||
optional string folderName = 3;
|
||||
optional uint32 createTime = 4;
|
||||
optional uint32 modifyTime = 5;
|
||||
optional uint64 createUin = 6;
|
||||
optional string creatorName = 7;
|
||||
optional uint32 totalFileCount = 8;
|
||||
}
|
||||
|
||||
|
||||
message GetFileListReqBody {
|
||||
optional uint64 groupCode = 1;
|
||||
optional uint32 appId = 2;
|
||||
optional string folderId = 3;
|
||||
optional FileTimeStamp startTimestamp = 4;
|
||||
optional uint32 fileCount = 5;
|
||||
optional FileTimeStamp maxTimestamp = 6;
|
||||
optional uint32 allFileCount = 7;
|
||||
optional uint32 reqFrom = 8;
|
||||
optional uint32 sortBy = 9;
|
||||
optional uint32 filterCode = 10;
|
||||
optional uint64 uin = 11;
|
||||
optional uint32 fieldFlag = 12;
|
||||
optional uint32 startIndex = 13;
|
||||
optional bytes context = 14;
|
||||
optional uint32 clientVersion = 15;
|
||||
}
|
||||
|
||||
message GetFileCountReqBody {
|
||||
optional uint64 groupCode = 1;
|
||||
optional uint32 appId = 2;
|
||||
optional uint32 busId = 3;
|
||||
}
|
||||
|
||||
message GetSpaceReqBody {
|
||||
optional uint64 groupCode = 1;
|
||||
optional uint32 appId = 2;
|
||||
}
|
||||
|
||||
message GetFileCountRspBody {
|
||||
optional int32 retCode = 1;
|
||||
optional string retMsg = 2;
|
||||
optional string clientWording = 3;
|
||||
optional uint32 allFileCount = 4;
|
||||
optional bool fileTooMany = 5;
|
||||
optional uint32 limitCount = 6;
|
||||
optional bool isFull = 7;
|
||||
}
|
||||
|
||||
message GetSpaceRspBody {
|
||||
optional int32 retCode = 1;
|
||||
optional string retMsg = 2;
|
||||
optional string clientWording = 3;
|
||||
optional uint64 totalSpace = 4;
|
||||
optional uint64 usedSpace = 5;
|
||||
}
|
||||
|
||||
message FileTimeStamp {
|
||||
optional uint32 uploadTime = 1;
|
||||
optional string fileId = 2;
|
||||
}
|
1127
internal/protobuf/data/oidb/oidb0x6d8/oidb0x6d8.go
Normal file
1127
internal/protobuf/data/oidb/oidb0x6d8/oidb0x6d8.go
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user