forked from External/ergo
add a type for CTCP-encoded strings, and NOTICEs for error cases
This commit is contained in:
parent
6267b6a40c
commit
34b01b115e
5 changed files with 38 additions and 14 deletions
|
|
@ -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))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue