replace pause until with available
This commit is contained in:
@@ -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{}{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user