about summary refs log tree commit diff
path: root/LibMatrix/Interfaces
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-09-04 02:17:10 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-09-04 02:17:10 +0200
commit21da6cde79ccd0cb7f895a29e3d8cab959ef11ba (patch)
treefb0b89566b64ae907d7ca3ea8a29adcf0c0361d0 /LibMatrix/Interfaces
parentClean up some extension functions (diff)
downloadLibMatrix-bak-21da6cde79ccd0cb7f895a29e3d8cab959ef11ba.tar.xz
Too many changes to name...
Diffstat (limited to 'LibMatrix/Interfaces')
-rw-r--r--LibMatrix/Interfaces/IHomeServer.cs29
-rw-r--r--LibMatrix/Interfaces/IStateEventType.cs4
-rw-r--r--LibMatrix/Interfaces/Services/IStorageProvider.cs5
3 files changed, 6 insertions, 32 deletions
diff --git a/LibMatrix/Interfaces/IHomeServer.cs b/LibMatrix/Interfaces/IHomeServer.cs
deleted file mode 100644
index 5e7e374..0000000
--- a/LibMatrix/Interfaces/IHomeServer.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System.Net.Http.Json;
-using LibMatrix.Extensions;
-using LibMatrix.StateEventTypes.Spec;
-
-namespace LibMatrix.Interfaces;
-
-public class IHomeServer {
-    private readonly Dictionary<string, object> _profileCache = new();
-    public string HomeServerDomain { get; set; }
-    public string FullHomeServerDomain { get; set; }
-
-    public MatrixHttpClient _httpClient { get; set; } = new();
-
-    public async Task<ProfileResponseEventData> GetProfile(string mxid) {
-        if(mxid is null) throw new ArgumentNullException(nameof(mxid));
-        if (_profileCache.ContainsKey(mxid)) {
-            if (_profileCache[mxid] is SemaphoreSlim s) await s.WaitAsync();
-            if (_profileCache[mxid] is ProfileResponseEventData p) return p;
-        }
-        _profileCache[mxid] = new SemaphoreSlim(1);
-
-        var resp = await _httpClient.GetAsync($"/_matrix/client/v3/profile/{mxid}");
-        var data = await resp.Content.ReadFromJsonAsync<ProfileResponseEventData>();
-        if (!resp.IsSuccessStatusCode) Console.WriteLine("Profile: " + data);
-        _profileCache[mxid] = data;
-
-        return data;
-    }
-}
diff --git a/LibMatrix/Interfaces/IStateEventType.cs b/LibMatrix/Interfaces/IStateEventType.cs
index d80f22d..13a0d05 100644
--- a/LibMatrix/Interfaces/IStateEventType.cs
+++ b/LibMatrix/Interfaces/IStateEventType.cs
@@ -1,5 +1,3 @@
 namespace LibMatrix.Interfaces;
 
-public interface IStateEventType {
-
-}
+public interface IStateEventType { }
diff --git a/LibMatrix/Interfaces/Services/IStorageProvider.cs b/LibMatrix/Interfaces/Services/IStorageProvider.cs
index 519d8ed..e07e136 100644
--- a/LibMatrix/Interfaces/Services/IStorageProvider.cs
+++ b/LibMatrix/Interfaces/Services/IStorageProvider.cs
@@ -1,3 +1,8 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Threading.Tasks;
+
 namespace LibMatrix.Interfaces.Services;
 
 public interface IStorageProvider {