diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-12-23 12:00:48 +0100 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-12-23 12:00:48 +0100 |
commit | 314f7044f62b92c49abe2d5c7422c6cf3430b021 (patch) | |
tree | 9d60d32370738b45676f4ac0d8615b943646e46e /LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs | |
parent | User impersonation support (appservice identity assertion), non-AsyncEnumerab... (diff) | |
download | LibMatrix-314f7044f62b92c49abe2d5c7422c6cf3430b021.tar.xz |
SetImpersonate optimisation (dont execute if already set), cleanup
Diffstat (limited to 'LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs')
-rw-r--r-- | LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs index 73cd641..0f2c1ea 100644 --- a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs +++ b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs @@ -309,6 +309,7 @@ public class AuthenticatedHomeserverGeneric(string serverName, string accessToke #endregion public async Task SetImpersonate(string mxid) { + if(ClientHttpClient.AdditionalQueryParameters.TryGetValue("user_id", out var existingMxid) && existingMxid == mxid && WhoAmI.UserId == mxid) return; ClientHttpClient.AdditionalQueryParameters["user_id"] = mxid; WhoAmI = await ClientHttpClient.GetFromJsonAsync<WhoAmIResponse>("/_matrix/client/v3/account/whoami"); } |