package main import ( "fmt" "os" "strings" "time" "github.com/kennygrant/sanitize" "layeh.com/gumble/gumble" ) func esc(str string) string { return sanitize.HTML(str) } func (b *Barnard) UpdateInputStatus(status string) { fmt.Fprintf(os.Stdout, "input status: %s\n", status) } func (b *Barnard) AddOutputLine(line string) { now := time.Now() fmt.Fprintf(os.Stdout, "[%02d:%02d:%02d] %s\n", now.Hour(), now.Minute(), now.Second(), line) } func (b *Barnard) AddOutputMessage(sender *gumble.User, message string) { if sender == nil { b.AddOutputLine(message) } else { b.AddOutputLine(fmt.Sprintf("%s: %s", sender.Name, strings.TrimSpace(esc(message)))) } }