mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-14 16:17:17 +03:00
This commit is contained in:
commit
cdbbd9a807
@ -18,6 +18,7 @@ const (
|
||||
historyLength = 20
|
||||
systemMessageFormat = "\033[1;90m"
|
||||
privateMessageFormat = "\033[1m"
|
||||
highlightFormat = Bold + "\033[48;5;11m\033[38;5;16m"
|
||||
beep = "\007"
|
||||
)
|
||||
|
||||
@ -106,11 +107,11 @@ func (s *Server) Broadcast(msg string, except *Client, canHighlight bool) {
|
||||
|
||||
if strings.Contains(msg, client.Name) && canHighlight {
|
||||
// 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 {
|
||||
tmpMsg[0] += beep
|
||||
personalMsg += beep
|
||||
}
|
||||
client.Send(strings.Join(tmpMsg, Reset+Bold+"\033[31m") + Reset)
|
||||
client.Send(personalMsg)
|
||||
} else {
|
||||
client.Send(msg)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user