pass the account nickname to the socket

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-23 17:43:41 -07:00
parent e5128f8b48
commit 1f80bd3249
1 changed files with 9 additions and 3 deletions

12
main.go
View File

@ -122,6 +122,7 @@ func buttonClick(b *gui.ButtonMap) {
} else { } else {
log.Println("\tb.Name", b.Name) log.Println("\tb.Name", b.Name)
log.Println("\tb.Note", b.Note) log.Println("\tb.Note", b.Note)
log.Println("\tb.AccNick", b.AccNick)
if (b.Note == "BACK") { if (b.Note == "BACK") {
gui.Data.State = "splash" gui.Data.State = "splash"
} }
@ -154,22 +155,26 @@ func buttonClick(b *gui.ButtonMap) {
} }
if (b.Note == "SHOW") { if (b.Note == "SHOW") {
log.Println("\tTRIGGER DISPLAY ACCOUNT") log.Println("\tTRIGGER DISPLAY ACCOUNT")
gui.Data.State = "READ WEBSOCKET" gui.Data.State = "READ WEBSOCKET"
gui.Data.AccNick = b.AccNick
for { for {
log.Println("Sleep() in buttonClick() gui.Data.State =", gui.Data.State) log.Println("Sleep() in buttonClick() gui.Data.State =", gui.Data.State)
time.Sleep(200 * time.Millisecond) time.Sleep(200 * time.Millisecond)
if (gui.Data.State == "NEW PROTOBUF") { if (gui.Data.State == "NEW PROTOBUF") {
if (currentMessage == nil) { if (currentMessage == nil) {
gui.SocketError() gui.SocketError()
gui.Data.State = "done"
} else { } else {
count := countVMS(currentMessage) count := countVMS(currentMessage)
log.Println("SHOW VMS currentMessage =", currentMessage) log.Println("SHOW VMS currentMessage =", currentMessage)
log.Println("SHOW VMS count =", count) log.Println("SHOW VMS count =", count)
if (count != 0) { if (count != 0) {
mh := gui.AddVmsTab(count) name := "Virtual Machines (" + b.AccNick + ")"
mh := gui.AddVmsTab(name, count)
ReadReceivedData(currentMessage, mh) ReadReceivedData(currentMessage, mh)
} }
currentMessage = nil currentMessage = nil
gui.Data.State = "done"
} }
return return
} }
@ -185,7 +190,8 @@ func buttonClick(b *gui.ButtonMap) {
time.Sleep(200 * time.Millisecond) time.Sleep(200 * time.Millisecond)
if (gui.Data.State == "NEW PROTOBUF") { if (gui.Data.State == "NEW PROTOBUF") {
count := countVMS(currentMessage) count := countVMS(currentMessage)
mh := gui.AddVmsTab(count) name := "Bmath VMs"
mh := gui.AddVmsTab(name, count)
ReadReceivedData(currentMessage, mh) ReadReceivedData(currentMessage, mh)
currentMessage = nil currentMessage = nil
return return