summary refs log tree commit diff
path: root/MxApiExtensions
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-03-05 11:20:41 +0100
committerRory& <root@rory.gay>2024-03-05 11:20:41 +0100
commit2d21596eec41cf1669f8064278b3273dc4f4c366 (patch)
treeb5ad7d852fe92beaef4012738fb74af7037e30e6 /MxApiExtensions
parentLibMatrix update (diff)
downloadMxApiExtensions-2d21596eec41cf1669f8064278b3273dc4f4c366.tar.xz
Simpler unix time
Diffstat (limited to 'MxApiExtensions')
-rw-r--r--MxApiExtensions/Controllers/Client/Room/RoomsSendMessageController.cs6
-rw-r--r--MxApiExtensions/Controllers/Client/SyncController.cs8
2 files changed, 4 insertions, 10 deletions
diff --git a/MxApiExtensions/Controllers/Client/Room/RoomsSendMessageController.cs b/MxApiExtensions/Controllers/Client/Room/RoomsSendMessageController.cs
index b800ec6..7ee104a 100644
--- a/MxApiExtensions/Controllers/Client/Room/RoomsSendMessageController.cs
+++ b/MxApiExtensions/Controllers/Client/Room/RoomsSendMessageController.cs
@@ -32,9 +32,7 @@ public class RoomsSendMessageController(ILogger<LoginController> logger, UserCon
 #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
             handleMxaeCommand(uc, roomId, msg);
 #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
-            await Response.WriteAsJsonAsync(new EventIdResponse() {
-                EventId = "$" + string.Join("", Random.Shared.GetItems("abcdefghijklmnopqrstuvwxyzABCDEFGHIJLKMNOPQRSTUVWXYZ0123456789".ToCharArray(), 100))
-            });
+            await Response.WriteAsJsonAsync(new EventIdResponse("$" + string.Join("", Random.Shared.GetItems("abcdefghijklmnopqrstuvwxyzABCDEFGHIJLKMNOPQRSTUVWXYZ0123456789".ToCharArray(), 100))));
             await Response.CompleteAsync();
         }
         else {
@@ -62,7 +60,7 @@ public class RoomsSendMessageController(ILogger<LoginController> logger, UserCon
             Sender = "@mxae:" + Request.Host.Value,
             Type = "m.room.message",
             TypedContent = MessageFormatter.FormatSuccess("Thinking..."),
-            OriginServerTs = (ulong)new DateTimeOffset(DateTime.UtcNow.ToUniversalTime()).ToUnixTimeMilliseconds(),
+            OriginServerTs = DateTimeOffset.Now.ToUnixTimeMilliseconds(),
             Unsigned = new() {
                 Age = 1
             },
diff --git a/MxApiExtensions/Controllers/Client/SyncController.cs b/MxApiExtensions/Controllers/Client/SyncController.cs
index 4a33b92..6568d7e 100644
--- a/MxApiExtensions/Controllers/Client/SyncController.cs
+++ b/MxApiExtensions/Controllers/Client/SyncController.cs
@@ -188,9 +188,7 @@ public class SyncController(ILogger<SyncController> logger, MxApiExtensionsConfi
     //enqueue common account data
     private static async Task EnqueuePreloadAccountData(SyncState syncState) {
         var syncMsg = new SyncResponse() {
-            AccountData = new() {
-                Events = new()
-            }
+            AccountData = new(events: new())
         };
         foreach (var key in CommonAccountDataKeys) {
             try {
@@ -258,9 +256,7 @@ public class SyncController(ILogger<SyncController> logger, MxApiExtensionsConfi
                     {
                         room.RoomId,
                         new SyncResponse.RoomsDataStructure.JoinedRoomDataStructure {
-                            State = new() {
-                                Events = timeline.State
-                            },
+                            State = new(events: timeline.State),
                             Timeline = new() {
                                 Events = timeline.Chunk,
                                 Limited = false,