-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Core] Replaced trpc.qq_new_tech.status_svc.StatusService.Register to…
… trpc.msg.register_proxy.RegisterProxy.SsoInfoSync
- Loading branch information
1 parent
ae400c0
commit a5e8e10
Showing
9 changed files
with
209 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
#pragma warning disable CS8618 | ||
|
||
namespace Lagrange.Core.Internal.Event.System; | ||
|
||
internal class InfoSyncEvent : ProtocolEvent | ||
{ | ||
public uint Random { get; set; } | ||
|
||
private InfoSyncEvent() : base(true) | ||
{ | ||
Random = (uint) new Random().Next(); | ||
} | ||
public string Message { get; set; } | ||
|
||
private InfoSyncEvent(int resultCode) : base(resultCode) { } | ||
private InfoSyncEvent() : base(true) { } | ||
|
||
private InfoSyncEvent(string result) : base(0) => Message = result; | ||
|
||
public static InfoSyncEvent Create() => new(); | ||
public static InfoSyncEvent Result(int resultCode) => new(resultCode); | ||
|
||
public static InfoSyncEvent Result(string result) => new(result); | ||
} |
11 changes: 11 additions & 0 deletions
11
Lagrange.Core/Internal/Packets/System/OnlineBusinessInfo.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,11 @@ | ||
using ProtoBuf; | ||
|
||
namespace Lagrange.Core.Internal.Packets.System; | ||
|
||
[ProtoContract] | ||
internal class OnlineBusinessInfo | ||
{ | ||
[ProtoMember(1)] public uint NotifySwitch { get; set; } | ||
|
||
[ProtoMember(2)] public uint BindUinNotifySwitch { get; set; } | ||
} |
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,68 @@ | ||
using ProtoBuf; | ||
|
||
namespace Lagrange.Core.Internal.Packets.System; | ||
|
||
/// <summary> | ||
/// trpc.msg.register_proxy.RegisterProxy.SsoInfoSync | ||
/// </summary> | ||
[ProtoContract] | ||
internal class SsoInfoSyncRequest | ||
{ | ||
[ProtoMember(1)] public uint SyncFlag { get; set; } | ||
|
||
[ProtoMember(2)] public uint? ReqRandom { get; set; } | ||
|
||
[ProtoMember(4)] public uint? CurActiveStatus { get; set; } | ||
|
||
[ProtoMember(5)] public ulong? GroupLastMsgTime { get; set; } | ||
|
||
[ProtoMember(6)] public SsoC2CInfoSync? C2CInfoSync { get; set; } | ||
|
||
[ProtoMember(8)] public NormalConfig? NormalConfig { get; set; } | ||
|
||
[ProtoMember(9)] public RegisterInfo? RegisterInfo { get; set; } | ||
|
||
[ProtoMember(10)] public UnknownStructure? UnknownStructure { get; set; } | ||
|
||
[ProtoMember(11)] public CurAppState? AppState { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class SsoC2CMsgCookie | ||
{ | ||
[ProtoMember(1)] public ulong C2CLastMsgTime { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class SsoC2CInfoSync | ||
{ | ||
[ProtoMember(1)] public SsoC2CMsgCookie? C2CMsgCookie { get; set; } | ||
|
||
[ProtoMember(2)] public ulong C2CLastMsgTime { get; set; } | ||
|
||
[ProtoMember(3)] public SsoC2CMsgCookie? LastC2CMsgCookie { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class NormalConfig | ||
{ | ||
[ProtoMember(1)] public Dictionary<uint, int>? IntCfg { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class CurAppState | ||
{ | ||
[ProtoMember(1)] public uint? IsDelayRequest { get; set; } | ||
|
||
[ProtoMember(2)] public uint? AppStatus { get; set; } | ||
|
||
[ProtoMember(3)] public uint? SilenceStatus { get; set; } | ||
} | ||
|
||
[ProtoContract] | ||
internal class UnknownStructure | ||
{ | ||
[ProtoMember(1)] public uint? GroupCode { get; set; } | ||
|
||
[ProtoMember(2)] public uint Flag2 { get; set; } | ||
} |
17 changes: 17 additions & 0 deletions
17
Lagrange.Core/Internal/Packets/System/SsoInfoSyncResponse.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,17 @@ | ||
using ProtoBuf; | ||
|
||
namespace Lagrange.Core.Internal.Packets.System; | ||
|
||
[ProtoContract] | ||
internal class SsoInfoSyncResponse | ||
{ | ||
[ProtoMember(3)] public uint Field3 { get; set; } | ||
|
||
[ProtoMember(4)] public uint Field4 { get; set; } | ||
|
||
[ProtoMember(6)] public uint Field6 { get; set; } | ||
|
||
[ProtoMember(7)] public RegisterInfoResponse? RegisterInfoResponse { get; set; } | ||
|
||
[ProtoMember(9)] public uint Field9 { get; set; } | ||
} |
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,92 @@ | ||
using Lagrange.Core.Common; | ||
using Lagrange.Core.Internal.Event; | ||
using Lagrange.Core.Internal.Event.System; | ||
using Lagrange.Core.Internal.Packets.System; | ||
using Lagrange.Core.Utility.Extension; | ||
using ProtoBuf; | ||
|
||
namespace Lagrange.Core.Internal.Service.System; | ||
|
||
[EventSubscribe(typeof(InfoSyncEvent))] | ||
[Service("trpc.msg.register_proxy.RegisterProxy.SsoInfoSync")] | ||
internal class InfoSyncService : BaseService<InfoSyncEvent> | ||
{ | ||
protected override bool Build(InfoSyncEvent input, BotKeystore keystore, BotAppInfo appInfo, | ||
BotDeviceInfo device, out Span<byte> output, out List<Memory<byte>>? extraPackets) | ||
{ | ||
var packet = new SsoInfoSyncRequest | ||
{ | ||
SyncFlag = 735, | ||
ReqRandom = (uint)Random.Shared.Next(), | ||
CurActiveStatus = 2, | ||
GroupLastMsgTime = 0, | ||
C2CInfoSync = new SsoC2CInfoSync | ||
{ | ||
C2CMsgCookie = new SsoC2CMsgCookie | ||
{ | ||
C2CLastMsgTime = 0 | ||
}, | ||
C2CLastMsgTime = 0, | ||
LastC2CMsgCookie = new SsoC2CMsgCookie | ||
{ | ||
C2CLastMsgTime = 0 | ||
} | ||
}, | ||
NormalConfig = new NormalConfig | ||
{ | ||
IntCfg = new Dictionary<uint, int>() | ||
}, | ||
RegisterInfo = new RegisterInfo | ||
{ | ||
Guid = device.Guid.ToByteArray().Hex(true), | ||
KickPC = 0, | ||
CurrentVersion = appInfo.CurrentVersion, | ||
IsFirstRegisterProxyOnline = 1, | ||
LocaleId = 2052, | ||
Device = new OnlineDeviceInfo() | ||
{ | ||
User = device.DeviceName, | ||
Os = appInfo.Kernel, | ||
OsVer = device.SystemKernel, | ||
VendorName = "", | ||
OsLower = appInfo.VendorOs, | ||
}, | ||
SetMute = 0, | ||
RegisterVendorType = 6, | ||
RegType = 0, | ||
BusinessInfo = new OnlineBusinessInfo | ||
{ | ||
NotifySwitch = 1, | ||
BindUinNotifySwitch = 1 | ||
}, | ||
BatteryStatus = 0, | ||
Field12 = 1 | ||
}, | ||
UnknownStructure = new UnknownStructure | ||
{ | ||
GroupCode = 0, | ||
Flag2 = 2 | ||
}, | ||
AppState = new CurAppState | ||
{ | ||
IsDelayRequest = 0, | ||
AppStatus = 0, | ||
SilenceStatus = 0 | ||
} | ||
}; | ||
|
||
output = packet.Serialize(); | ||
extraPackets = null; | ||
return true; | ||
} | ||
|
||
protected override bool Parse(Span<byte> input, BotKeystore keystore, BotAppInfo appInfo, BotDeviceInfo device, | ||
out InfoSyncEvent output, out List<ProtocolEvent>? extraEvents) | ||
{ | ||
var response = Serializer.Deserialize<SsoInfoSyncResponse>(input); | ||
|
||
output = InfoSyncEvent.Result(response?.RegisterInfoResponse?.Message ?? "IDK"); | ||
extraEvents = null; | ||
return true; | ||
} | ||
} |
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