Skip to content

Commit

Permalink
[Core] Push something incomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
Linwenxuan04 committed Feb 29, 2024
1 parent c5ffdde commit 5b33eba
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Lagrange.Core/Common/Interface/Api/OperationExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ public static Task<bool> RecallGroupMessage(this BotContext bot, MessageChain ch
/// <returns></returns>
public static Task<List<BotGroupRequest>?> FetchGroupRequests(this BotContext bot)
=> bot.ContextCollection.Business.OperationLogic.FetchGroupRequests();

/// <summary>
///
/// </summary>
/// <param name="bot"></param>
/// <returns></returns>
public static Task<List<dynamic>?> FetchFriendRequests(this BotContext bot)
=> bot.ContextCollection.Business.OperationLogic.FetchFriendRequests();

/// <summary>
/// set status
Expand Down
2 changes: 1 addition & 1 deletion Lagrange.Core/Internal/Context/ContextCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ internal class ContextCollection : IDisposable
public ContextCollection(BotKeystore keystore, BotAppInfo appInfo, BotDeviceInfo device, BotConfig config,
EventInvoker invoker, TaskScheduler scheduler)
{
Log = new LogContext(this, keystore, appInfo, device, invoker);
Packet = new PacketContext(this, keystore, appInfo, device, config);
Socket = new SocketContext(this, keystore, appInfo, device, config);
Service = new ServiceContext(this, keystore, appInfo, device);
Business = new BusinessContext(this, keystore, appInfo, device);
Log = new LogContext(this, keystore, appInfo, device, invoker);
Highway = new HighwayContext(this, keystore, appInfo, device, config);

Keystore = keystore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,15 @@ async Task<uint> ResolveUid(string? uid)
}
}

public async Task<List<dynamic>?> FetchFriendRequests()
{
var fetchRequestsEvent = FetchFriendRequestsEvent.Create();
var events = await Collection.Business.SendEvent(fetchRequestsEvent);
if (events.Count == 0) return null;

return null;
}

public async Task<bool> GroupTransfer(uint groupUin, uint targetUin)
{
string? uid = await Collection.Business.CachingLogic.ResolveUid(groupUin, targetUin);
Expand Down
14 changes: 14 additions & 0 deletions Lagrange.Core/Internal/Event/System/FetchFriendRequestsEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Lagrange.Core.Internal.Event.System;

internal class FetchFriendRequestsEvent : ProtocolEvent
{
private FetchFriendRequestsEvent() : base(true)
{
}

private FetchFriendRequestsEvent(int resultCode) : base(resultCode)
{
}

public static FetchFriendRequestsEvent Create() => new();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using ProtoBuf;

#pragma warning disable CS8618
// ReSharper disable InconsistentNaming

namespace Lagrange.Core.Internal.Packets.Service.Oidb.Request;

[ProtoContract]
[OidbSvcTrpcTcp(0x5CF, 11)]
internal class OidbSvcTrpcTcp0x5CF_11
{
[ProtoMember(1)] public int Field1 { get; set; } // 1

[ProtoMember(3)] public int Field3 { get; set; } // 6

[ProtoMember(4)] public string SelfUid { get; set; }

[ProtoMember(5)] public int Field5 { get; set; } // 0

[ProtoMember(6)] public int Field6 { get; set; } // 80

[ProtoMember(8)] public int Field8 { get; set; } // 2

[ProtoMember(9)] public int Field9 { get; set; } // 0

[ProtoMember(12)] public int Field12 { get; set; } // 1

[ProtoMember(22)] public int Field22 { get; set; } // 1
}

0 comments on commit 5b33eba

Please sign in to comment.