replace pause until with available

This commit is contained in:
Bel LaPointe
2022-01-12 22:09:58 -05:00
parent b515143fc6
commit 3213c21c7e
5 changed files with 13 additions and 13 deletions

View File

@@ -63,7 +63,7 @@ type Client struct {
IDs struct {
Matrix string
}
PauseUntil Time
Available Time
}
var live Config
@@ -76,11 +76,11 @@ func configPath() string {
return p
}
func Clients() map[string]Client {
func Clients(t time.Time) map[string]Client {
clients := Get().Clients
result := map[string]Client{}
for k := range clients {
if clients[k].PauseUntil.Get().IsZero() || time.Now().After(clients[k].PauseUntil.Get()) {
if clients[k].Available.Get().IsZero() || t.After(clients[k].Available.Get()) {
result[k] = clients[k]
}
}
@@ -89,7 +89,7 @@ func Clients() map[string]Client {
func AllStates() []State {
statem := map[State]struct{}{}
for _, v := range Clients() {
for _, v := range Clients(time.Now().Add(time.Hour * 24 * 365)) {
for _, state := range v.States {
statem[state] = struct{}{}
}