Class ReceiptService
Read receipts and read markers of local users.
Inherited Members
Namespace: Uniform.Matrix.Server.Rooms
Assembly: Uniform.Matrix.Server.dll
Syntax
public sealed class ReceiptService
Remarks
Only the latest receipt per user, type and thread is kept; a receipt for an earlier event than the stored one is ignored, so receipts only move forward.
Constructors
| Edit this page View SourceReceiptService(IDbContextFactory<ServerDbContext>, ServerStream, AccountDataService, TimeProvider)
Create the service.
Declaration
public ReceiptService(IDbContextFactory<ServerDbContext> contexts, ServerStream stream, AccountDataService accountData, TimeProvider time)
Parameters
| Type | Name | Description |
|---|---|---|
| IDbContextFactory<ServerDbContext> | contexts | |
| ServerStream | stream | |
| AccountDataService | accountData | |
| TimeProvider | time |
Fields
| Edit this page View SourceRead
Public read receipt.
Declaration
public const string Read = "m.read"
Field Value
| Type | Description |
|---|---|
| string |
ReadPrivate
Read receipt only the user's own devices see.
Declaration
public const string ReadPrivate = "m.read.private"
Field Value
| Type | Description |
|---|---|
| string |
Methods
| Edit this page View SourceGetReceiptEventAsync(ServerDbContext, string, string, long?, long, CancellationToken)
Return the receipts of a room changed after since (all when null) as an m.receipt event for userId, or null when there are none.
Declaration
public static Task<JsonObject?> GetReceiptEventAsync(ServerDbContext dbContext, string roomId, string userId, long? since, long until, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| ServerDbContext | dbContext | |
| string | roomId | |
| string | userId | |
| long? | since | |
| long | until | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<JsonObject> |
Remarks
Private receipts of other users are left out.
SetReadMarkersAsync(string, string, JsonObject, CancellationToken)
Set the read markers of /read_markers: any of m.fully_read, m.read and m.read.private.
Declaration
public Task SetReadMarkersAsync(string userId, string roomId, JsonObject body, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | userId | |
| string | roomId | |
| JsonObject | body | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
SetReceiptAsync(string, string, string, string, string?, CancellationToken)
Store a receipt of type; m.fully_read moves the read marker instead.
Declaration
public Task SetReceiptAsync(string userId, string roomId, string type, string eventId, string? threadId, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | userId | Reader, joined to the room. |
| string | roomId | Room. |
| string | type | Read, ReadPrivate or |
| string | eventId | Event of the room read up to. |
| string | threadId | Thread root, |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task |