parent
b1cddd9f60
commit
e39a2608e8
25
main.go
25
main.go
|
@ -286,15 +286,6 @@ func mainMouseClick(b *gui.ButtonMap) {
|
|||
}
|
||||
}
|
||||
|
||||
func getToken() string {
|
||||
if (gui.Data.Current == nil) {
|
||||
log.Println("gui.Data.Current == nil")
|
||||
return ""
|
||||
}
|
||||
log.Println("gui.Data.Current.Token = ", gui.Data.Current.Token)
|
||||
return gui.Data.Current.Token
|
||||
}
|
||||
|
||||
// this watches the GUI primarily to process protobuf's
|
||||
func watchGUI() {
|
||||
count := 0
|
||||
|
@ -309,7 +300,10 @@ func watchGUI() {
|
|||
|
||||
if (gui.Data.State == "SEND WEBSOCKET") {
|
||||
event := pb.MakeGetEvent()
|
||||
event.Token = getToken()
|
||||
if (gui.Data.Current == nil) {
|
||||
event.Token = gui.Data.Current.Token
|
||||
event.Username = gui.Data.Current.Username
|
||||
}
|
||||
log.Println("\tTRIGGERING WEBSOCKET pb.MakeGetEvent() event.Token =", event.Token)
|
||||
|
||||
gorillaSendProtobuf(event)
|
||||
|
@ -317,8 +311,11 @@ func watchGUI() {
|
|||
}
|
||||
if (gui.Data.State == "SEND LOGIN") {
|
||||
event := pb.MakeLoginEvent()
|
||||
event.Token = getToken()
|
||||
if (gui.Data.Current == nil) {
|
||||
event.Token = gui.Data.Current.Token
|
||||
event.Username = gui.Data.Current.Username
|
||||
event.Password = gui.Data.Current.Password
|
||||
}
|
||||
log.Println("\tTRIGGERING LOGIN HERE pb.MakeLoginEvent() event.Token =", event.Token)
|
||||
gorillaSendProtobuf(event)
|
||||
gui.Data.State = "READ PROTOBUF"
|
||||
|
@ -326,9 +323,11 @@ func watchGUI() {
|
|||
if (gui.Data.State == "CREATE") {
|
||||
log.Println("\tTRIGGERING CREATE HERE")
|
||||
event := pb.MakeAddVmEvent()
|
||||
event.Username = gui.Data.Current.Username
|
||||
if (gui.Data.Current == nil) {
|
||||
event.Token = gui.Data.Current.Token
|
||||
log.Println("\tTRIGGERING LOGIN HERE with event.Token =", event.Token)
|
||||
event.Username = gui.Data.Current.Username
|
||||
}
|
||||
log.Println("\tTRIGGERING CREATE HERE with event.Token =", event.Token)
|
||||
|
||||
spew.Dump(event)
|
||||
gorillaSendProtobuf(event)
|
||||
|
|
Loading…
Reference in New Issue