ui/go/characters/grouppoller.go

22 lines
463 B
Go
Raw Normal View History

2018-11-22 00:01:17 +00:00
package characters
import (
2018-11-28 22:14:02 +00:00
"cwtch.im/ui/go/gobjects"
"cwtch.im/ui/go/the"
2018-11-22 00:01:17 +00:00
"time"
)
func GroupPoller(getContact func(string) *gobjects.Contact, updateContact func(string)) {
for {
time.Sleep(time.Second * 4)
servers := the.Peer.GetServers()
groups := the.Peer.GetGroups()
for i := range groups {
group := the.Peer.GetGroup(groups[i])
getContact(group.GroupID).Status = int(servers[group.GroupServer])
updateContact(group.GroupID)
}
}
}