about summary refs log tree commit diff
path: root/LibMatrix.EventTypes
diff options
context:
space:
mode:
Diffstat (limited to 'LibMatrix.EventTypes')
-rw-r--r--LibMatrix.EventTypes/Interop/Draupnir/DraupnirWatchedListsData.cs28
-rw-r--r--LibMatrix.EventTypes/Interop/Draupnir/DraupnirZtdManagementRoomData.cs19
-rw-r--r--LibMatrix.EventTypes/LibMatrix.EventTypes.csproj2
-rw-r--r--LibMatrix.EventTypes/Spec/RoomMessageEventContent.cs28
-rw-r--r--LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPolicyServerEventContent.cs3
5 files changed, 78 insertions, 2 deletions
diff --git a/LibMatrix.EventTypes/Interop/Draupnir/DraupnirWatchedListsData.cs b/LibMatrix.EventTypes/Interop/Draupnir/DraupnirWatchedListsData.cs
new file mode 100644

index 0000000..bf5f148 --- /dev/null +++ b/LibMatrix.EventTypes/Interop/Draupnir/DraupnirWatchedListsData.cs
@@ -0,0 +1,28 @@ +using System.Text.Json.Serialization; +using System.Web; + +namespace LibMatrix.EventTypes.Interop.Draupnir; + +[MatrixEvent(EventName = EventId)] +public class DraupnirWatchedListsData : EventContent { + public const string EventId = "org.matrix.mjolnir.watched_lists"; + + [JsonPropertyName("references")] + public List<string> References { get; set; } + + public List<(string RoomId, List<string>? Vias)> GetReferenceRooms() { + List<(string RoomId, List<string>? Vias)> results = []; + foreach (var reference in References) { + var id = HttpUtility.UrlDecode(reference.Split("/#/")[1].Split("?via")[0]); + var vias = + reference.Contains('?') + ? reference.Split('?')[1].Split('&').Select(x => HttpUtility.UrlDecode(x.Replace("via=", ""))) + : id.Contains(':') + ? [id.Split(':')[1]] + : null; + results.Add((id, vias?.ToList())); + } + + return results; + } +} \ No newline at end of file diff --git a/LibMatrix.EventTypes/Interop/Draupnir/DraupnirZtdManagementRoomData.cs b/LibMatrix.EventTypes/Interop/Draupnir/DraupnirZtdManagementRoomData.cs new file mode 100644
index 0000000..33f44a5 --- /dev/null +++ b/LibMatrix.EventTypes/Interop/Draupnir/DraupnirZtdManagementRoomData.cs
@@ -0,0 +1,19 @@ +using System.Diagnostics.CodeAnalysis; +using System.Text.Encodings.Web; +using System.Text.Json.Serialization; +using System.Web; + +namespace LibMatrix.EventTypes.Interop.Draupnir; + +[MatrixEvent(EventName = EventId)] +public class DraupnirZtdManagementRoomData : EventContent { + public const string EventId = "space.draupnir.zero_touch_deploy_room"; + + [JsonPropertyName("room")] + public string? Room { get; set; } + + public string? GetPlainRoomId() { + var val = Room?.Split("/#/")[1].Split("?via")[0]; + return HttpUtility.UrlDecode(val); + } +} \ No newline at end of file diff --git a/LibMatrix.EventTypes/LibMatrix.EventTypes.csproj b/LibMatrix.EventTypes/LibMatrix.EventTypes.csproj
index e633aef..25c9f64 100644 --- a/LibMatrix.EventTypes/LibMatrix.EventTypes.csproj +++ b/LibMatrix.EventTypes/LibMatrix.EventTypes.csproj
@@ -15,7 +15,7 @@ <ItemGroup> <ProjectReference Include="..\ArcaneLibs\ArcaneLibs\ArcaneLibs.csproj" Condition="'$(ContinuousIntegrationBuild)'!='true'"/> - <PackageReference Include="ArcaneLibs" Version="1.0.0-preview.2025*" Condition="'$(ContinuousIntegrationBuild)'=='true'"/> + <PackageReference Include="ArcaneLibs" Version="1.0.1-preview.2026*" Condition="'$(ContinuousIntegrationBuild)'=='true'"/> </ItemGroup> </Project> diff --git a/LibMatrix.EventTypes/Spec/RoomMessageEventContent.cs b/LibMatrix.EventTypes/Spec/RoomMessageEventContent.cs
index d1cf8be..ccb5d42 100644 --- a/LibMatrix.EventTypes/Spec/RoomMessageEventContent.cs +++ b/LibMatrix.EventTypes/Spec/RoomMessageEventContent.cs
@@ -11,6 +11,9 @@ public class RoomMessageEventContent : TimelineEventContent { Body = body ?? ""; } + // TODO: https://spec.matrix.org/v1.16/client-server-api/#mimage + // TODO: add `file` for e2ee files + [JsonPropertyName("body")] public string Body { get; set; } @@ -53,7 +56,7 @@ public class RoomMessageEventContent : TimelineEventContent { public class MentionsStruct { [JsonPropertyName("user_ids")] public List<string>? Users { get; set; } - + [JsonPropertyName("room")] public bool? Room { get; set; } } @@ -68,10 +71,33 @@ public class RoomMessageEventContent : TimelineEventContent { [JsonPropertyName("thumbnail_url")] public string? ThumbnailUrl { get; set; } + [JsonPropertyName("thumbnail_info")] + public ThumbnailInfoStruct? ThumbnailInfo { get; set; } + [JsonPropertyName("w")] public int? Width { get; set; } [JsonPropertyName("h")] public int? Height { get; set; } + + /// <summary> + /// Duration of the audio/video in milliseconds, if applicable + /// </summary> + [JsonPropertyName("duration")] + public long? Duration { get; set; } + + public class ThumbnailInfoStruct { + [JsonPropertyName("w")] + public int? Width { get; set; } + + [JsonPropertyName("h")] + public int? Height { get; set; } + + [JsonPropertyName("mimetype")] + public string? MimeType { get; set; } + + [JsonPropertyName("size")] + public long? Size { get; set; } + } } } \ No newline at end of file diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPolicyServerEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPolicyServerEventContent.cs
index 80e254f..78fdc8e 100644 --- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPolicyServerEventContent.cs +++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomPolicyServerEventContent.cs
@@ -8,4 +8,7 @@ public class RoomPolicyServerEventContent : EventContent { [JsonPropertyName("via")] public string? Via { get; set; } + + [JsonPropertyName("public_key")] + public string? PublicKey { get; set; } } \ No newline at end of file