From 440807e02393410327cd86d5ffa007dee98f8954 Mon Sep 17 00:00:00 2001 From: Rory& Date: Fri, 19 Apr 2024 15:54:30 +0200 Subject: Partial User-Interactive Authentication, allow skipping homeserver typing --- .../Homeservers/AuthenticatedHomeserverGeneric.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs') diff --git a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs index afa6a6c..267b54d 100644 --- a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs +++ b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs @@ -128,10 +128,20 @@ public class AuthenticatedHomeserverGeneric : RemoteHomeserver { public virtual async IAsyncEnumerable GetJoinedRoomsByType(string type) { var rooms = await GetJoinedRooms(); var tasks = rooms.Select(async room => { - var roomType = await room.GetRoomType(); - if (roomType == type) return room; - - return null; + while (true) { + try { + var roomType = await room.GetRoomType(); + if (roomType == type) return room; + return null; + } + catch (MatrixException e) { + throw; + } + catch (Exception e) { + Console.WriteLine($"Failed to get room type for {room.RoomId}: {e.Message}"); + await Task.Delay(1000); + } + } }).ToAsyncEnumerable(); await foreach (var result in tasks) -- cgit 1.4.1