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

try to fix group image again.

This commit is contained in:
Mrs4s 2020-08-22 18:25:58 +08:00
parent 1ff595e6ee
commit 4dc018de2b
8 changed files with 931 additions and 821 deletions

View File

@ -495,7 +495,7 @@ func (c *QQClient) UploadGroupImage(groupCode int64, img []byte) (*message.Group
}
return nil, errors.New("upload failed")
ok:
return message.NewGroupImage(binary.CalculateImageResourceId(h[:]), h[:]), nil
return message.NewGroupImage(binary.CalculateImageResourceId(h[:]), h[:], rsp.FileId), nil
}
func (c *QQClient) UploadPrivateImage(target int64, img []byte) (*message.FriendImageElement, error) {
@ -572,7 +572,7 @@ func (c *QQClient) QueryGroupImage(groupCode int64, hash []byte, size int32) (*m
return nil, errors.New(rsp.Message)
}
if rsp.IsExists {
return message.NewGroupImage(binary.CalculateImageResourceId(hash), hash), nil
return message.NewGroupImage(binary.CalculateImageResourceId(hash), hash, rsp.FileId), nil
}
return nil, errors.New("image not exists")
}

View File

@ -403,9 +403,10 @@ func decodeGroupImageStoreResponse(_ *QQClient, _ uint16, payload []byte) (inter
}, nil
}
if rsp.BoolFileExit {
return imageUploadResponse{IsExists: true}, nil
return imageUploadResponse{IsExists: true, FileId: rsp.Fid}, nil
}
return imageUploadResponse{
FileId: rsp.Fid,
UploadKey: rsp.UpUkey,
UploadIp: rsp.Uint32UpIp,
UploadPort: rsp.Uint32UpPort,

View File

@ -163,6 +163,7 @@ type (
Message string
IsExists bool
FileId int64
ResourceId string
UploadKey []byte

File diff suppressed because it is too large Load Diff

View File

@ -219,7 +219,13 @@ message Elem {
//GroupPostElem? groupPostElem = 50;
LightAppElem lightApp = 51;
//EIMInfo? eimInfo = 52;
//CommonElem? commonElem = 53;
CommonElem commonElem = 53;
}
message CommonElem {
int32 serviceType = 1;
bytes pbElem = 2;
int32 businessType = 3;
}
message RichMsg {

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.12.3
// protoc v3.11.4
// source: objmsg.proto
package msg

View File

@ -21,6 +21,7 @@ type ImageElement struct {
type GroupImageElement struct {
ImageId string
FileId int64
Md5 []byte
Url string
}
@ -101,9 +102,10 @@ func NewImage(data []byte) *ImageElement {
}
}
func NewGroupImage(id string, md5 []byte) *GroupImageElement {
func NewGroupImage(id string, md5 []byte, fid int64) *GroupImageElement {
return &GroupImageElement{
ImageId: id,
FileId: fid,
Md5: md5,
Url: "http://gchat.qpic.cn/gchatpic_new/1/0-0-" + strings.ReplaceAll(id[1:36], "-", "") + "/0?term=2",
}

View File

@ -281,10 +281,14 @@ func ToProtoElems(elems []IMessageElement, generalFlags bool) (r []*msg.Elem) {
case *GroupImageElement:
r = append(r, &msg.Elem{
CustomFace: &msg.CustomFace{
FileType: 66,
Useful: 1,
Origin: 1,
FileId: int32(e.FileId),
FilePath: e.ImageId,
Md5: e.Md5[:],
Flag: make([]byte, 4),
OldData: imgOld,
//OldData: imgOld,
},
})
case *FriendImageElement: