Browse Source

Update list on activity, not on time. Avoid unnecessary API calls

pull/1/head
Gregory Rudolph 5 years ago
parent
commit
3968a48383
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 6
      main.go

6
main.go

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

Loading…
Cancel
Save