Class RoomService
Rooms of local users: creation, membership, messages and state, redaction, and what a user may read.
Namespace: Uniform.Matrix.Server.Rooms
Assembly: Uniform.Matrix.Server.dll
public sealed class RoomService
Constructors
|
Edit this page
View Source
RoomService(IDbContextFactory<ServerDbContext>, EventSender, IOptions<ServerOptions>, TimeProvider, RemoteJoins, RemoteInvites, ILogger<RoomService>)
Declaration
public RoomService(IDbContextFactory<ServerDbContext> contexts, EventSender sender, IOptions<ServerOptions> options, TimeProvider time, RemoteJoins remoteJoins, RemoteInvites remoteInvites, ILogger<RoomService> logger)
Parameters
Methods
|
Edit this page
View Source
Return whether a joined user's power level allows sending state of type.
Declaration
public Task<bool> CanSendStateAsync(string userId, string roomId, string type, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
CreateRoomAsync(Requester, JsonObject, CancellationToken)
Create a room following createRoom; return its ID.
Declaration
public Task<string> CreateRoomAsync(Requester requester, JsonObject body, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Forget a room the user has left, so it disappears from their sync.
Declaration
public Task ForgetAsync(string userId, string roomId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return an event a user may see: anything up to their leaving, while they were or are a member.
Declaration
public Task<JsonObject> GetEventAsync(Requester requester, string roomId, string eventId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return the joined members with display names and avatars; only for members.
Declaration
public Task<JsonObject> GetJoinedMembersAsync(Requester requester, string roomId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return the rooms a user is joined to.
Declaration
public Task<IReadOnlyList<string>> GetJoinedRoomsAsync(string userId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return a user's current membership in a room, or null.
Declaration
public Task<string?> GetMembershipAsync(string roomId, string userId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return the state a user may see: the current state while joined, otherwise the state when they left; throw M_FORBIDDEN for others.
Declaration
public Task<IReadOnlyList<JsonObject>> GetStateAsync(Requester requester, string roomId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
GetStateContentAsync(Requester, string, string, string, CancellationToken)
Return the content of one state event a user may see; throw M_NOT_FOUND when unset.
Declaration
public Task<JsonObject> GetStateContentAsync(Requester requester, string roomId, string type, string stateKey, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Invite a user: local users directly, other servers' users through their server, which signs the invite too.
Declaration
public Task InviteAsync(string userId, string roomId, string target, string? reason, bool isDirect, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Join a room by ID or alias; already joined users stay joined. Aliases of other servers are asked from them. A room ID that is not here yet is joined through the server that invited the user, via servers and the server in the room ID, in that order. Returns the room ID.
Declaration
public Task<string> JoinAsync(string userId, string roomIdOrAlias, string? reason, CancellationToken cancellationToken, IReadOnlyList<string>? via = null)
Parameters
Returns
|
Edit this page
View Source
Leave a room; leaving a room one is not in does nothing.
Declaration
public Task LeaveAsync(string userId, string roomId, string? reason, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Redact an event of the room: one's own, or anyone's with the redact level. Returns the redaction's ID.
Declaration
public Task<string> RedactAsync(Requester requester, string roomId, string eventId, string? reason, string transactionId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return the room ID of a room ID or local alias of a room here; throw M_NOT_FOUND for unknown rooms.
Declaration
public Task<string> ResolveAsync(string roomIdOrAlias, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
SendMessageAsync(Requester, string, string, JsonObject, string, CancellationToken)
Send a message event; return its ID, the same for a retried transaction.
Declaration
public Task<string> SendMessageAsync(Requester requester, string roomId, string type, JsonObject content, string transactionId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Change another user's membership: kick (leave), ban or unban (leave of a banned user).
Declaration
public Task SetMembershipAsync(string userId, string roomId, string target, string membership, string? reason, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
SetStateAsync(Requester, string, string, string, JsonObject, CancellationToken)
Set room state; return the event ID.
Declaration
public Task<string> SetStateAsync(Requester requester, string roomId, string type, string stateKey, JsonObject content, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Update the user's member event in every joined room to their current profile.
Declaration
public Task UpdateMemberProfilesAsync(string userId, CancellationToken cancellationToken)
Parameters
Returns