|
|
@ -4,7 +4,6 @@ import ( |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"log" |
|
|
|
"log" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/jroimartin/gocui" |
|
|
|
"github.com/jroimartin/gocui" |
|
|
|
"samhofi.us/x/keybase" |
|
|
|
"samhofi.us/x/keybase" |
|
|
@ -43,18 +42,14 @@ func sendChat(message string) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func populateList(g *gocui.Gui) { |
|
|
|
func populateList(g *gocui.Gui) { |
|
|
|
for { |
|
|
|
if testVar, err := k.ChatList(); err != nil { |
|
|
|
if testVar, err := k.ChatList(); err != nil { |
|
|
|
log.Fatalln(err) |
|
|
|
log.Fatalln(err) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
clearView(g, "List") |
|
|
|
clearView(g, "List") |
|
|
|
for _, s := range testVar.Result.Conversations { |
|
|
|
for _, s := range testVar.Result.Conversations { |
|
|
|
printToView(g, "List", s.Channel.Name) |
|
|
|
printToView(g, "List", s.Channel.Name) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
time.Sleep(5 * time.Second) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func clearView(kbtui *gocui.Gui, viewName string) { |
|
|
|
func clearView(kbtui *gocui.Gui, viewName string) { |
|
|
@ -159,6 +154,7 @@ func cleanChannelName(c string) string { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func handleMessage(api keybase.ChatAPI, g *gocui.Gui) { |
|
|
|
func handleMessage(api keybase.ChatAPI, g *gocui.Gui) { |
|
|
|
|
|
|
|
go populateList(g) |
|
|
|
if api.Msg.Content.Type == "text" { |
|
|
|
if api.Msg.Content.Type == "text" { |
|
|
|
msgBody := api.Msg.Content.Text.Body |
|
|
|
msgBody := api.Msg.Content.Text.Body |
|
|
|
msgSender := api.Msg.Sender.Username |
|
|
|
msgSender := api.Msg.Sender.Username |
|
|
|