diff --git a/client/pb/msg/msg.pb.go b/client/pb/msg/msg.pb.go index 1285f6520..8e569df9b 100644 --- a/client/pb/msg/msg.pb.go +++ b/client/pb/msg/msg.pb.go @@ -892,3 +892,31 @@ type NotOnlineImage_PbReserve struct { Url proto.Option[string] `protobuf:"bytes,30,opt"` _ [0]func() } + +type PbMultiMediaElement struct { + Elem1 *struct { + Meta *struct { + Data *struct { + FileLen proto.Option[int32] `protobuf:"varint,1,opt"` + PicMd5 []byte `protobuf:"bytes,2,opt"` + } `protobuf:"bytes,1,opt"` + FilePath proto.Option[string] `protobuf:"bytes,2,opt"` + } `protobuf:"bytes,1,opt"` + + Data *struct { + ImgURL proto.Option[string] `protobuf:"bytes,1,opt"` + Domain proto.Option[string] `protobuf:"bytes,3,opt"` + } `protobuf:"bytes,2,opt"` + } `protobuf:"bytes,1,opt"` + + Elem2 *struct { + Data *struct { + Friend *struct { + RKey proto.Option[string] `protobuf:"bytes,30,opt"` + } `protobuf:"bytes,11,opt"` + Group *struct { + RKey proto.Option[string] `protobuf:"bytes,30,opt"` + } `protobuf:"bytes,12,opt"` + } `protobuf:"bytes,1,opt"` + } `protobuf:"bytes,2,opt"` +} diff --git a/client/pb/msg/msg.proto b/client/pb/msg/msg.proto index b2023341e..a200e89e1 100644 --- a/client/pb/msg/msg.proto +++ b/client/pb/msg/msg.proto @@ -877,3 +877,41 @@ message MsgElemInfo_servtype37 { optional bytes surpriseid = 8; optional uint32 randomtype = 9; } + +message PbMultiMediaElement { + message Elem1 { + message Meta { + message Data { + optional int32 FileLen = 1; + optional bytes PicMd5 = 2; + } + optional Data data = 1; + optional string FilePath = 2; + } + optional Meta meta = 1; + + message Data { + optional string ImgURL = 2; + optional string Domain = 3; + } + optional Data data = 2; + } + optional Elem1 elem1 = 1; + + message Elem2 { + message Data { + message Friend { + optional string RKey = 30; + } + optional Friend friend = 11; + message Group { + optional string RKey = 30; + } + optional Group group = 12; + } + optional Data data = 1; + } + optional Elem2 elem2 = 2; +} + + diff --git a/message/message.go b/message/message.go index d5fc6a620..fb983ac80 100644 --- a/message/message.go +++ b/message/message.go @@ -387,6 +387,7 @@ func ToSrcProtoElems(elems []IMessageElement) []*msg.Elem { func ParseMessageElems(elems []*msg.Elem) []IMessageElement { var res []IMessageElement + var newImg = false for _, elem := range elems { if elem.SrcMsg != nil && len(elem.SrcMsg.OrigSeqs) != 0 { r := &ReplyElement{ @@ -537,16 +538,18 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement { bizType = ImageBizType(attr.ImageBizType.Unwrap()) } } - res = append(res, &GroupImageElement{ - FileId: int64(elem.CustomFace.FileId.Unwrap()), - ImageId: elem.CustomFace.FilePath.Unwrap(), - Size: elem.CustomFace.Size.Unwrap(), - Width: elem.CustomFace.Width.Unwrap(), - Height: elem.CustomFace.Height.Unwrap(), - Url: url, - ImageBizType: bizType, - Md5: elem.CustomFace.Md5, - }) + if !newImg { + res = append(res, &GroupImageElement{ + FileId: int64(elem.CustomFace.FileId.Unwrap()), + ImageId: elem.CustomFace.FilePath.Unwrap(), + Size: elem.CustomFace.Size.Unwrap(), + Width: elem.CustomFace.Width.Unwrap(), + Height: elem.CustomFace.Height.Unwrap(), + Url: url, + ImageBizType: bizType, + Md5: elem.CustomFace.Md5, + }) + } } if elem.MarketFace != nil { face := &MarketFaceElement{ @@ -582,6 +585,7 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement { } return []IMessageElement{face} } + if elem.NotOnlineImage != nil { img := elem.NotOnlineImage @@ -603,13 +607,17 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement { url += downloadPath + "/0?term=3" } - res = append(res, &FriendImageElement{ - ImageId: img.FilePath.Unwrap(), - Size: img.FileLen.Unwrap(), - Url: url, - Md5: img.PicMd5, - }) + if !newImg { + res = append(res, &FriendImageElement{ + ImageId: img.FilePath.Unwrap(), + Size: img.FileLen.Unwrap(), + Url: url, + Md5: img.PicMd5, + }) + } + } + if elem.QQWalletMsg != nil && elem.QQWalletMsg.AioBody != nil { // /com/tencent/mobileqq/data/MessageForQQWalletMsg.java#L366 msgType := elem.QQWalletMsg.AioBody.MsgType.Unwrap() @@ -663,7 +671,36 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement { Name: strings.TrimPrefix(string(animatedStickerMsg.Text), "/"), } return []IMessageElement{sticker} // sticker 永远为单独消息 + case 48: + img := &msg.PbMultiMediaElement{} + _ = proto.Unmarshal(elem.CommonElem.PbElem, img) + domain := img.Elem1.Data.Domain.Unwrap() + imgURL := img.Elem1.Data.ImgURL.Unwrap() + + if img.Elem2.Data.Friend != nil { + rKey := img.Elem2.Data.Friend.RKey.Unwrap() + url := fmt.Sprintf("https://%s%s%s&spec=0&rf=naio", domain, imgURL, rKey) + res = append(res, &FriendImageElement{ + ImageId: img.Elem1.Meta.FilePath.Unwrap(), + Size: img.Elem1.Meta.Data.FileLen.Unwrap(), + Url: url, + Md5: img.Elem1.Meta.Data.PicMd5, + }) + newImg = true + } + if img.Elem2.Data.Group != nil { + rKey := img.Elem2.Data.Group.RKey.Unwrap() + url := fmt.Sprintf("https://%s%s%s&spec=0&rf=naio", domain, imgURL, rKey) + res = append(res, &GroupImageElement{ + ImageId: img.Elem1.Meta.FilePath.Unwrap(), + Size: img.Elem1.Meta.Data.FileLen.Unwrap(), + Url: url, + Md5: img.Elem1.Meta.Data.PicMd5, + }) + newImg = true + } } + } } return res