event: add helper to get remaining mute duration
Some checks are pending
Go / Lint (latest) (push) Waiting to run
Go / Build (old, libolm) (push) Waiting to run
Go / Build (latest, libolm) (push) Waiting to run
Go / Build (old, goolm) (push) Waiting to run
Go / Build (latest, goolm) (push) Waiting to run

This commit is contained in:
Tulir Asokan 2025-10-02 14:45:46 +03:00
commit 97da8eb44d

View file

@ -105,3 +105,15 @@ func (bmec *BeeperMuteEventContent) GetMutedUntilTime() time.Time {
}
return time.Time{}
}
func (bmec *BeeperMuteEventContent) GetMuteDuration() time.Duration {
ts := bmec.GetMutedUntilTime()
now := time.Now()
if ts.Before(now) {
return 0
} else if ts == MutedForever {
return -1
} else {
return ts.Sub(now)
}
}