Class MessageFormatter
Turns Matrix events into irssi-style timeline text; call under the SyncProcessor lock as it reads Room.
Inherited Members
Namespace: Uniform.Chat.Terminal.Ui
Assembly: Uniform.Chat.dll
Syntax
public static class MessageFormatter
Methods
| Edit this page View SourceFormat(Room, ClientEvent, string, Func<string, ClientEvent?>?)
Format clientEvent of room, or return null for events not shown, e.g. power levels.
Declaration
public static TimelineEntry? Format(Room room, ClientEvent clientEvent, string ownUserId, Func<string, ClientEvent?>? findEvent = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Room | room | Room for member names. |
| ClientEvent | clientEvent | Event to format. |
| string | ownUserId | Logged-in user, for own and highlighted lines. |
| Func<string, ClientEvent> | findEvent | Finds an earlier event by ID, to quote the message a reply answers; replies show no quote when null or not found. |
Returns
| Type | Description |
|---|---|
| TimelineEntry |
FormatOutbox(OutboxMessage, string)
Format a queued message of the logged-in user as pending or failed.
Declaration
public static TimelineEntry FormatOutbox(OutboxMessage message, string ownNick)
Parameters
| Type | Name | Description |
|---|---|---|
| OutboxMessage | message | |
| string | ownNick |
Returns
| Type | Description |
|---|---|
| TimelineEntry |
GetText(ClientEvent, Func<string, string?>?)
Return the visible text of a message, see GetText(ClientEvent, Func<string, string?>?).
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 |
Snippet(string, int)
Shorten text to one line of at most maxColumns columns.
Declaration
public static string Snippet(string text, int maxColumns)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | |
| int | maxColumns |
Returns
| Type | Description |
|---|---|
| string |