-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85f412b
commit 487d541
Showing
5 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace Lagrange.Core.Internal.Event.Message; | ||
|
||
internal class MarkReadedEvent : ProtocolEvent | ||
{ | ||
public uint GroupUin { get; } | ||
|
||
public string? TargetUid { get; } | ||
|
||
public uint StartSequence { get; } | ||
|
||
public uint Time { get; } | ||
|
||
private MarkReadedEvent(uint groupUin, string? targetUid, uint startSequence, uint time) : base(true) | ||
{ | ||
GroupUin = groupUin; | ||
TargetUid = targetUid; | ||
StartSequence = startSequence; | ||
Time = time; | ||
} | ||
|
||
private MarkReadedEvent(int resultCode) : base(resultCode) { } | ||
|
||
public static MarkReadedEvent Create(uint groupUin, string? targetUid, uint startSequence, uint time) => | ||
new(groupUin, targetUid, startSequence, time); | ||
|
||
public static MarkReadedEvent Result(int resultCode) => new(resultCode); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using ProtoBuf; | ||
|
||
namespace Lagrange.Core.Internal.Packets.Message; | ||
|
||
/// <summary> | ||
/// trpc.msg.msg_svc.MsgService.SsoReadedReport | ||
/// </summary> | ||
[ProtoContract] | ||
internal class SsoReadedReport | ||
{ | ||
[ProtoMember(1)] public SsoReadedReportGroup? Group { get; set; } | ||
|
||
[ProtoMember(2)] public SsoReadedReportC2C? C2C { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class SsoReadedReportC2C | ||
{ | ||
[ProtoMember(2)] public string? TargetUid { get; set; } | ||
|
||
[ProtoMember(3)] public uint Time { get; set; } | ||
|
||
[ProtoMember(4)] public uint StartSequence { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class SsoReadedReportGroup | ||
{ | ||
[ProtoMember(1)] public uint GroupUin { get; set; } | ||
|
||
[ProtoMember(2)] public uint StartSequence { get; set; } | ||
} |
46 changes: 46 additions & 0 deletions
46
Lagrange.Core/Internal/Service/Message/MarkReadedService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using Lagrange.Core.Common; | ||
using Lagrange.Core.Internal.Event; | ||
using Lagrange.Core.Internal.Event.Message; | ||
using Lagrange.Core.Internal.Packets.Message; | ||
using Lagrange.Core.Utility.Binary; | ||
using Lagrange.Core.Utility.Extension; | ||
|
||
namespace Lagrange.Core.Internal.Service.Message; | ||
|
||
[EventSubscribe(typeof(MarkReadedEvent))] | ||
[Service("trpc.msg.msg_svc.MsgService.SsoReadedReport")] | ||
internal class MarkReadedService : BaseService<MarkReadedEvent> | ||
{ | ||
protected override bool Build(MarkReadedEvent input, BotKeystore keystore, BotAppInfo appInfo, BotDeviceInfo device, | ||
out BinaryPacket output, out List<BinaryPacket>? extraPackets) | ||
{ | ||
var packet = input.TargetUid == null ? new SsoReadedReport | ||
{ | ||
Group = new SsoReadedReportGroup | ||
{ | ||
GroupUin = input.GroupUin, | ||
StartSequence = input.StartSequence | ||
} | ||
} : new SsoReadedReport | ||
{ | ||
C2C = new SsoReadedReportC2C | ||
{ | ||
TargetUid = input.TargetUid, | ||
Time = input.Time, | ||
StartSequence = input.StartSequence | ||
} | ||
}; | ||
|
||
output = packet.Serialize(); | ||
extraPackets = null; | ||
return true; | ||
} | ||
|
||
protected override bool Parse(byte[] input, BotKeystore keystore, BotAppInfo appInfo, BotDeviceInfo device, | ||
out MarkReadedEvent output, out List<ProtocolEvent>? extraEvents) | ||
{ | ||
output = MarkReadedEvent.Result(0); | ||
extraEvents = null; | ||
return true; | ||
} | ||
} |