This commit is contained in:
Ken Piper 2014-12-15 01:46:42 -05:00
commit cdbbd9a807

View File

@ -18,6 +18,7 @@ const (
historyLength = 20 historyLength = 20
systemMessageFormat = "\033[1;90m" systemMessageFormat = "\033[1;90m"
privateMessageFormat = "\033[1m" privateMessageFormat = "\033[1m"
highlightFormat = Bold + "\033[48;5;11m\033[38;5;16m"
beep = "\007" beep = "\007"
) )
@ -106,11 +107,11 @@ func (s *Server) Broadcast(msg string, except *Client, canHighlight bool) {
if strings.Contains(msg, client.Name) && canHighlight { if strings.Contains(msg, client.Name) && canHighlight {
// Turn message red if client's name is mentioned, and send BEL if they have enabled beeping // Turn message red if client's name is mentioned, and send BEL if they have enabled beeping
tmpMsg := strings.Split(msg, Reset) personalMsg := strings.Replace(msg, client.Name, highlightFormat+client.Name+Reset, -1)
if client.beepMe { if client.beepMe {
tmpMsg[0] += beep personalMsg += beep
} }
client.Send(strings.Join(tmpMsg, Reset+Bold+"\033[31m") + Reset) client.Send(personalMsg)
} else { } else {
client.Send(msg) client.Send(msg)
} }