mirror of
https://github.com/jeremyd/ergo.git
synced 2026-07-25 16:48:10 -07:00
add a type for CTCP-encoded strings, and NOTICEs for error cases
This commit is contained in:
@@ -64,3 +64,12 @@ func NewText(str string) Text {
|
||||
func (text Text) String() string {
|
||||
return string(text)
|
||||
}
|
||||
|
||||
// CTCPText is text suitable escaped for CTCP.
|
||||
type CTCPText string
|
||||
|
||||
var ctcpEscaper = strings.NewReplacer("\x00", "\x200", "\n", "\x20n", "\r", "\x20r")
|
||||
|
||||
func NewCTCPText(str string) CTCPText {
|
||||
return CTCPText(ctcpEscaper.Replace(str))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user