Class EventText
Plain-text descriptions of room events for any user interface: message text as shown, and one-line descriptions of membership and state changes.
Inherited Members
Namespace: Uniform.Matrix.Client.Formatting
Assembly: Uniform.Matrix.Client.dll
Syntax
public static class EventText
Fields
| Edit this page View SourceDeletionShown
How long a deleted message keeps its "deleted" line in the history; older deletions are not shown, so a room reads better.
Declaration
public static readonly TimeSpan DeletionShown
Field Value
| Type | Description |
|---|---|
| TimeSpan |
Methods
| Edit this page View SourceDescribe(Room, ClientEvent)
Describe a non-message event in one line, e.g. Alice joined; null for events that are not shown, and for messages.
Declaration
public static string? Describe(Room room, ClientEvent clientEvent)
Parameters
| Type | Name | Description |
|---|---|---|
| Room | room | Room, for member names. |
| ClientEvent | clientEvent | Event to describe. |
Returns
| Type | Description |
|---|---|
| string |
DescribeMember(Room, ClientEvent)
Describe a membership change by comparing with the previous content, e.g. Bob is now known as Robert; null when only the avatar changed.
Declaration
public static string? DescribeMember(Room room, ClientEvent clientEvent)
Parameters
| Type | Name | Description |
|---|---|---|
| Room | room | Room, for member names. |
| ClientEvent | clientEvent | Member event. |
Returns
| Type | Description |
|---|---|
| string |
FormatSize(long)
Format a byte count like 12 KB.
Declaration
public static string FormatSize(long bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| long | bytes |
Returns
| Type | Description |
|---|---|
| string |
GetHtml(ClientEvent)
Return the HTML formatted_body of the content GetText(ClientEvent, Func<string, string?>?) shows, or null for messages without formatting.
Declaration
public static string? GetHtml(ClientEvent clientEvent)
Parameters
| Type | Name | Description |
|---|---|---|
| ClientEvent | clientEvent | Message event. |
Returns
| Type | Description |
|---|---|
| string |
GetText(ClientEvent, Func<string, string?>?)
Return the visible text of a message: the new content of an edit, rendered from HTML when formatted, without a reply fallback quote; null for deleted or non-text events.
Declaration
public static string? GetText(ClientEvent clientEvent, Func<string, string?>? userName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ClientEvent | clientEvent | Message event. |
| Func<string, string> | userName | Display name for a user ID, used for mention pills in formatted messages. |
Returns
| Type | Description |
|---|---|
| string |
IsOldDeletion(ClientEvent, DateTimeOffset)
Return whether clientEvent is a message deleted more than DeletionShown before now: by its deletion's time, or by its own when the server left the deletion out.
Declaration
public static bool IsOldDeletion(ClientEvent clientEvent, DateTimeOffset now)
Parameters
| Type | Name | Description |
|---|---|---|
| ClientEvent | clientEvent | |
| DateTimeOffset | now |
Returns
| Type | Description |
|---|---|
| bool |
StripReplyFallback(string)
Remove the > quoted lines older clients put before reply text.
Declaration
public static string StripReplyFallback(string body)
Parameters
| Type | Name | Description |
|---|---|---|
| string | body |
Returns
| Type | Description |
|---|---|
| string |