Add credits and current username to UI
This commit is contained in:
parent
f8332d102a
commit
bcaa1c12af
|
@ -22,6 +22,12 @@ type Message struct {
|
|||
Server net.Conn
|
||||
}
|
||||
|
||||
type ProfileData struct {
|
||||
Username string
|
||||
}
|
||||
|
||||
var Profile ProfileData
|
||||
|
||||
func (m Message) toSend() {
|
||||
m.Server.Write([]byte(m.Contents))
|
||||
}
|
||||
|
@ -93,6 +99,8 @@ func sendName(conn net.Conn) {
|
|||
log.Fatalf("Error occurred sending message to server: %v\n", err)
|
||||
}
|
||||
|
||||
Profile.Username = strings.TrimRight(message, "\n")
|
||||
|
||||
if _, err := conn.Write([]byte(message)); err != nil {
|
||||
log.Fatalf("Error occurred writing to server: %v\n", err)
|
||||
}
|
||||
|
@ -194,7 +202,7 @@ func layout(g *gocui.Gui) error {
|
|||
return err
|
||||
}
|
||||
chatbox.Autoscroll = true
|
||||
chatbox.Title = "Chat Box"
|
||||
chatbox.Title = "Chat Box (Find source at https://git.bulgariu.xyz/raul/mini-chat!)"
|
||||
}
|
||||
|
||||
// if button, err := g.SetView("button", maxX/2+32, maxY-4, maxX-28, maxY-2); err != nil {
|
||||
|
@ -214,7 +222,7 @@ func layout(g *gocui.Gui) error {
|
|||
if _, err := g.SetCurrentView("textarea"); err != nil {
|
||||
log.Panicln(err)
|
||||
}
|
||||
textarea.Title = "Send message"
|
||||
textarea.Title = "Send message (Currently chatting as: " + Profile.Username + ")"
|
||||
textarea.Wrap = true
|
||||
textarea.Editable = true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue