Class ChatTellAddress
How a whisper names its target: a single word, or a name in double quotes.
public static class ChatTellAddress
- Inheritance
-
ChatTellAddress
- Inherited Members
Remarks
Character names may hold single spaces ("Aragorn of Arnor"), and a tell used to take its
target as the first space-delimited word: /tell Aragorn of Arnor hello went to
"Aragorn" — or, when nobody has that name, answered "Aragorn is offline" — and a name with
a space could not be whispered at all. A quoted name is now the target whole:
/tell "Aragorn of Arnor" hello. An unquoted target is still one word, exactly as
before, so every single-word tell a player already types is unchanged.
Unquoted text is never matched against longer names. Guessing that "Aragorn of Arnor hello" meant the longest name some online character happens to have would decide who receives a private message by who is logged in; a quote is an explicit rule the sender controls.
The same address is the persisted row's. A whisper is stored as its address, one
space, then the body (FormatLine(string, string)), and the target's own scene server finds it
by that address — ChatService.BuildPumpFilterSql extracts it in SQL with the same
rule (the quoted name when the row starts with a quote, otherwise the first word), and
ChatSystem.PumpKeyOf and the tell handler parse it here. A single-word name is
written unquoted, so its rows are byte-for-byte what they always were.
Pure and free of every project dependency, like ChatSanitizer, so the rule can be pinned by a test without a server.
Fields
Quote
The character that opens and closes a quoted name.
public const char Quote = '"'
Field Value
Methods
Format(string)
The address to write for a target: the name itself when it is one word, else quoted.
public static string Format(string targetName)
Parameters
targetNamestringA character name (letters and single spaces).
Returns
- string
The address.
FormatCommand(string)
The text to pre-fill a chat input with to whisper a character, ready for the message.
public static string FormatCommand(string targetName)
Parameters
targetNamestringThe target.
Returns
- string
/tell Bobor/tell "First Last".
FormatLine(string, string)
A whisper as it is persisted and parsed: the address, a space, then the body.
public static string FormatLine(string targetName, string body)
Parameters
Returns
- string
The line.
NormalizeName(string)
Trims a name and collapses every run of whitespace inside it to one space.
public static string NormalizeName(string name)
Parameters
namestringThe name as typed.
Returns
- string
The normalised name, or empty.
Remarks
Character names hold single spaces only, so "First Last" typed with two can only
mean one character, and the persisted address is always the normalised name.
TryParse(string, out string, out string)
Splits a whisper into its target and its body.
public static bool TryParse(string text, out string targetName, out string body)
Parameters
textstringThe text after the tell command:
Bob helloor"First Last" hello.targetNamestringThe target: the quoted name with its spacing normalised, or the first word.
bodystringThe message, trimmed.
Returns
- bool
True when there is a target and a non-empty body. A quote that is never closed, an empty quoted name and a tell with nothing to say are all refused, as a tell with no body always was.
TryParseAddress(string, out string)
Reads only the address at the start of a whisper, whether or not a body follows.
public static bool TryParseAddress(string text, out string targetName)
Parameters
Returns
- bool
True when an address could be read.
Remarks
For the pump's relevance key, which must agree with the SQL: the SQL reads the address and never looks at the body.