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"
|
2019-01-21 21:17:51 +00:00
|
|
|
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
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])
|
2019-01-21 21:17:51 +00:00
|
|
|
if group != nil {
|
|
|
|
getContact(group.GroupID).Status = int(servers[group.GroupServer])
|
|
|
|
updateContact(group.GroupID)
|
|
|
|
} else {
|
|
|
|
log.Errorf("grouppoller found a group that is nil :/")
|
|
|
|
}
|
2018-11-22 00:01:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|