Skip to content

Commit

Permalink
cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anistark committed Nov 10, 2023
1 parent 832b66e commit b04ec63
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

// Represents the app version
const appversion = "v1.0.0"
const appversion = "v1.1.0"

// A structure that represents the ChatRoom UI
type UI struct {
Expand Down Expand Up @@ -285,25 +285,25 @@ func (ui *UI) handlecommand(cmd uicommand) {

// Unsupported command
default:
ui.Logs <- chatlog{logprefix: "badcmd", logmsg: fmt.Sprintf("unsupported command - %s", cmd.cmdtype)}
ui.Logs <- chatlog{logprefix: "🦆", logmsg: fmt.Sprintf("unsupported command - %s", cmd.cmdtype)}
}
}

// A method of UI that displays a message recieved from a peer
func (ui *UI) display_chatmessage(msg chatmessage) {
prompt := fmt.Sprintf("[green]<%s>:[-]", msg.SenderName)
prompt := fmt.Sprintf("[green] %s :[-]", msg.SenderName)
fmt.Fprintf(ui.messageBox, "%s %s\n", prompt, msg.Message)
}

// A method of UI that displays a message recieved from self
func (ui *UI) display_selfmessage(msg string) {
prompt := fmt.Sprintf("[blue]<%s>:[-]", ui.UserName)
prompt := fmt.Sprintf("[blue] %s :[-]", ui.UserName)
fmt.Fprintf(ui.messageBox, "%s %s\n", prompt, msg)
}

// A method of UI that displays a log message
func (ui *UI) display_logmessage(log chatlog) {
prompt := fmt.Sprintf("[yellow]<%s>:[-]", log.logprefix)
prompt := fmt.Sprintf("[yellow] %s :[-]", log.logprefix)
fmt.Fprintf(ui.messageBox, "%s %s\n", prompt, log.logmsg)
}

Expand Down

0 comments on commit b04ec63

Please sign in to comment.