about summary refs log tree commit diff
path: root/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-10-24 17:44:03 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-10-24 17:44:03 +0200
commit478fc1b0ef855530e1e93c5212d154280f9d7dd8 (patch)
tree3bb348b939f8d78e85337d49d3163ac5dbc8e8cc /LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs
parentfix synchelper null check (diff)
downloadLibMatrix-478fc1b0ef855530e1e93c5212d154280f9d7dd8.tar.xz
Minor cleanup
Diffstat (limited to 'LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs')
-rw-r--r--LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs5
1 files changed, 3 insertions, 2 deletions
diff --git a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs
index ef5d01f..e5e4274 100644
--- a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs
+++ b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs
@@ -156,7 +156,7 @@ public class AuthenticatedHomeserverGeneric(string baseUrl, string accessToken)
         return await _httpClient.GetFromJsonAsync<T>($"/_matrix/client/v3/user/{WhoAmI.UserId}/account_data/{key}");
     }
 
-    public virtual async Task SetAccountData(string key, object data) {
+    public virtual async Task SetAccountDataAsync(string key, object data) {
         var res = await _httpClient.PutAsJsonAsync($"/_matrix/client/v3/user/{WhoAmI.UserId}/account_data/{key}", data);
         if (!res.IsSuccessStatusCode) {
             Console.WriteLine($"Failed to set account data: {await res.Content.ReadAsStringAsync()}");
@@ -168,10 +168,11 @@ public class AuthenticatedHomeserverGeneric(string baseUrl, string accessToken)
 
     public string? ResolveMediaUri(string? mxcUri) {
         if (mxcUri is null) return null;
+        if (mxcUri.StartsWith("https://")) return mxcUri;
         return $"{_httpClient.BaseAddress}/_matrix/media/v3/download/{mxcUri.Replace("mxc://", "")}".Replace("//_matrix", "/_matrix");
     }
 
-    public async Task UpdateProfileAsync(ProfileResponseEventContent? newProfile, bool preserveCustomRoomProfile = true) {
+    public async Task UpdateProfileAsync(UserProfileResponse? newProfile, bool preserveCustomRoomProfile = true) {
         if (newProfile is null) return;
         Console.WriteLine($"Updating profile for {WhoAmI.UserId} to {newProfile.ToJson(ignoreNull: true)} (preserving room profiles: {preserveCustomRoomProfile})");
         var oldProfile = await GetProfileAsync(WhoAmI.UserId!);