about summary refs log tree commit diff
diff options
context:
space:
mode:
m---------ArcaneLibs0
-rw-r--r--LibMatrix.EventTypes/EventContent.cs3
-rw-r--r--Utilities/LibMatrix.Utilities.Bot/Services/InviteListenerHostedService.cs9
3 files changed, 9 insertions, 3 deletions
diff --git a/ArcaneLibs b/ArcaneLibs
-Subproject 3d116cf672f881a67732f2cb6cc5c7efa1b8deb
+Subproject 3a2937246ba42cdc2c0ffc1c0c5ed9cddc2ef56
diff --git a/LibMatrix.EventTypes/EventContent.cs b/LibMatrix.EventTypes/EventContent.cs

index a837252..89686ae 100644 --- a/LibMatrix.EventTypes/EventContent.cs +++ b/LibMatrix.EventTypes/EventContent.cs
@@ -6,6 +6,9 @@ using System.Text.Json.Serialization; namespace LibMatrix.EventTypes; public abstract class EventContent { + [JsonExtensionData] + public Dictionary<string, JsonElement>? AdditionalData { get; set; } = []; + public static List<string> GetMatchingEventTypes<T>() where T : EventContent { var type = typeof(T); var eventTypes = new List<string>(); diff --git a/Utilities/LibMatrix.Utilities.Bot/Services/InviteListenerHostedService.cs b/Utilities/LibMatrix.Utilities.Bot/Services/InviteListenerHostedService.cs
index cac9ca4..f819cc3 100644 --- a/Utilities/LibMatrix.Utilities.Bot/Services/InviteListenerHostedService.cs +++ b/Utilities/LibMatrix.Utilities.Bot/Services/InviteListenerHostedService.cs
@@ -1,6 +1,7 @@ using LibMatrix.Filters; using LibMatrix.Helpers; using LibMatrix.Homeservers; +using LibMatrix.Responses; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; @@ -51,7 +52,8 @@ public class InviteHandlerHostedService : IHostedService { var inviteEventArgs = new InviteEventArgs() { RoomId = invite.Key, - MemberEvent = invite.Value.InviteState.Events.First(x => x.Type == "m.room.member" && x.StateKey == _hs.WhoAmI.UserId), + InviteData = invite.Value, + MemberEvent = invite.Value.InviteState?.Events?.First(x => x.Type == "m.room.member" && x.StateKey == _hs.WhoAmI.UserId), Homeserver = _hs }; await _inviteHandler(inviteEventArgs); @@ -74,11 +76,12 @@ public class InviteHandlerHostedService : IHostedService { public class InviteEventArgs { public string RoomId { get; set; } - public StateEventResponse MemberEvent { get; set; } public AuthenticatedHomeserverGeneric Homeserver { get; set; } + public StateEventResponse MemberEvent { get; set; } + public SyncResponse.RoomsDataStructure.InvitedRoomDataStructure InviteData { get; set; } } public interface IInviteHandler { - public Task HandleInviteAsync(InviteEventArgs args); + public Task HandleInviteAsync(InviteEventArgs invite); } } \ No newline at end of file