Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
sisi0318 committed Jan 9, 2025
2 parents 55aa4c6 + 8e3ffc4 commit 804a812
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ private async Task ResolveIncomingChain(MessageChain chain)
case ImageEntity image when !image.ImageUrl.Contains("&rkey=") && image.MsgInfo is not null:
{
var @event = image.IsGroup
? ImageGroupDownloadEvent.Create(image.GroupUin ?? 0, image.MsgInfo)
: ImageDownloadEvent.Create(image.FriendUid ?? string.Empty, image.MsgInfo);
? ImageGroupDownloadEvent.Create(chain.GroupUin ?? 0, image.MsgInfo)
: ImageDownloadEvent.Create(chain.Uid ?? string.Empty, image.MsgInfo);

var results = await Collection.Business.SendEvent(@event);
if (results.Count != 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@ internal class PicExtBizInfo

[ProtoMember(2)] public string TextSummary { get; set; }

[ProtoMember(11)] public byte[] BytesPbReserveC2c { get; set; }
[ProtoMember(11)] public byte[]? BytesPbReserveC2c { get; set; }

[ProtoMember(12)] public byte[] BytesPbReserveTroop { get; set; }
[ProtoMember(12)] public byte[]? BytesPbReserveTroop { get; set; }

[ProtoMember(1001)] public uint FromScene { get; set; }

Expand Down
32 changes: 15 additions & 17 deletions Lagrange.Core/Message/Entity/ImageEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ public class ImageEntity : IMessageEntity
public string ImageUrl { get; set; } = string.Empty;

internal Lazy<Stream>? ImageStream { get; set; }

internal string? Path { get; set; }

internal uint FileId { get; set; }


internal MsgInfo? MsgInfo { get; set; }

internal NotOnlineImage? CompatImage { get; set; }
Expand All @@ -45,11 +41,7 @@ public class ImageEntity : IMessageEntity

public int SubType { get; set; }

internal bool IsGroup => GroupUin.HasValue;

internal uint? GroupUin { get; set; }

internal string? FriendUid { get; set; }
internal bool IsGroup { get; set; }

public ImageEntity() { }

Expand Down Expand Up @@ -113,10 +105,12 @@ IEnumerable<Elem> IMessageEntity.PackElement()
ImageSize = index.Info.FileSize,
MsgInfo = extra,
SubType = (int)extra.ExtBizInfo.Pic.BizType,
GroupUin = msgInfoBody.HashSum.TroopSource?.GroupUin,
FriendUid = msgInfoBody.HashSum.BytesPbReserveC2c?.FriendUid,
// GroupUin = msgInfoBody.HashSum.TroopSource?.GroupUin,
// FriendUid = msgInfoBody.HashSum.BytesPbReserveC2c?.FriendUid,
H = index.Info.Height,
W = index.Info.Width
W = index.Info.Width,
IsGroup = extra.ExtBizInfo.Pic.BytesPbReserveTroop != null,
Summary = string.IsNullOrEmpty(extra.ExtBizInfo.Pic.TextSummary) ? "[图片]" : extra.ExtBizInfo.Pic.TextSummary,
};
}

Expand All @@ -134,7 +128,8 @@ IEnumerable<Elem> IMessageEntity.PackElement()
Summary = image.PbRes.Summary,
SubType = image.PbRes.SubType,
H = image.PicHeight,
W = image.PicWidth
W = image.PicWidth,
IsGroup = false
};
}

Expand All @@ -148,7 +143,8 @@ IEnumerable<Elem> IMessageEntity.PackElement()
Summary = image.PbRes.Summary,
SubType = image.PbRes.SubType,
H = image.PicHeight,
W = image.PicWidth
W = image.PicWidth,
IsGroup = false
};
}

Expand All @@ -166,7 +162,8 @@ IEnumerable<Elem> IMessageEntity.PackElement()
Summary = face.PbReserve?.Summary,
SubType = face.PbReserve?.SubType ?? GetImageTypeFromFaceOldData(face),
H = (uint)face.Height,
W = (uint)face.Width
W = (uint)face.Width,
IsGroup = true
};
}

Expand All @@ -180,7 +177,8 @@ IEnumerable<Elem> IMessageEntity.PackElement()
Summary = face.PbReserve?.Summary,
SubType = face.PbReserve?.SubType ?? GetImageTypeFromFaceOldData(face),
H = (uint)face.Height,
W = (uint)face.Width
W = (uint)face.Width,
IsGroup = true
};
}

Expand Down

0 comments on commit 804a812

Please sign in to comment.