diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-09-19 00:16:36 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-09-19 00:16:36 +0200 |
commit | f5447484512d726f4403f0d7725777d0a95601fb (patch) | |
tree | 47fe88a4c021f62ff42663f6d8c5229e71d21813 /LibMatrix/Helpers | |
parent | Improve README (diff) | |
download | LibMatrix-f5447484512d726f4403f0d7725777d0a95601fb.tar.xz |
Add more stuff, add unit tests
Diffstat (limited to '')
-rw-r--r-- | LibMatrix/Helpers/MediaResolver.cs | 7 | ||||
-rw-r--r-- | LibMatrix/Helpers/MessageFormatter.cs | 2 | ||||
-rw-r--r-- | LibMatrix/Helpers/SyncHelper.cs | 18 |
3 files changed, 10 insertions, 17 deletions
diff --git a/LibMatrix/Helpers/MediaResolver.cs b/LibMatrix/Helpers/MediaResolver.cs deleted file mode 100644 index 5886618..0000000 --- a/LibMatrix/Helpers/MediaResolver.cs +++ /dev/null @@ -1,7 +0,0 @@ -using LibMatrix.Services; - -namespace LibMatrix.Helpers; - -public static class MediaResolver { - public static string ResolveMediaUri(string homeserver, string mxc) => mxc.Replace("mxc://", $"{homeserver}/_matrix/media/v3/download/"); -} diff --git a/LibMatrix/Helpers/MessageFormatter.cs b/LibMatrix/Helpers/MessageFormatter.cs index 37d7004..ae02afc 100644 --- a/LibMatrix/Helpers/MessageFormatter.cs +++ b/LibMatrix/Helpers/MessageFormatter.cs @@ -1,5 +1,5 @@ using ArcaneLibs.Extensions; -using LibMatrix.StateEventTypes.Spec; +using LibMatrix.EventTypes.Spec; namespace LibMatrix.Helpers; diff --git a/LibMatrix/Helpers/SyncHelper.cs b/LibMatrix/Helpers/SyncHelper.cs index d719184..386fd4d 100644 --- a/LibMatrix/Helpers/SyncHelper.cs +++ b/LibMatrix/Helpers/SyncHelper.cs @@ -9,17 +9,17 @@ using LibMatrix.Services; namespace LibMatrix.Helpers; -public class SyncHelper(AuthenticatedHomeserverGeneric homeserver, TieredStorageService storageService) { +public class SyncHelper(AuthenticatedHomeserverGeneric homeserver) { public async Task<SyncResult?> Sync( string? since = null, int? timeout = 30000, string? setPresence = "online", SyncFilter? filter = null, CancellationToken? cancellationToken = null) { - var outFileName = "sync-" + - (await storageService.CacheStorageProvider.GetAllKeysAsync()).Count( - x => x.StartsWith("sync")) + - ".json"; + // var outFileName = "sync-" + + // (await storageService.CacheStorageProvider.GetAllKeysAsync()).Count( + // x => x.StartsWith("sync")) + + // ".json"; var url = $"/_matrix/client/v3/sync?timeout={timeout}&set_presence={setPresence}"; if (!string.IsNullOrWhiteSpace(since)) url += $"&since={since}"; if (filter is not null) url += $"&filter={filter.ToJson(ignoreNull: true, indent: false)}"; @@ -65,10 +65,10 @@ public class SyncHelper(AuthenticatedHomeserverGeneric homeserver, TieredStorage SyncFilter? filter = null, CancellationToken? cancellationToken = null ) { - await Task.WhenAll((await storageService.CacheStorageProvider.GetAllKeysAsync()) - .Where(x => x.StartsWith("sync")) - .ToList() - .Select(x => storageService.CacheStorageProvider.DeleteObjectAsync(x))); + // await Task.WhenAll((await storageService.CacheStorageProvider.GetAllKeysAsync()) + // .Where(x => x.StartsWith("sync")) + // .ToList() + // .Select(x => storageService.CacheStorageProvider.DeleteObjectAsync(x))); var nextBatch = since; while (cancellationToken is null || !cancellationToken.Value.IsCancellationRequested) { var sync = await Sync(since: nextBatch, timeout: timeout, setPresence: setPresence, filter: filter, |