Update dependencies (#1841)

This commit is contained in:
Wim
2022-06-11 23:07:42 +02:00
committed by GitHub
parent 3819062574
commit 8751fb4bb1
188 changed files with 5608 additions and 1334 deletions

View File

@@ -9,6 +9,7 @@ package binary
import (
"fmt"
"strconv"
"time"
"go.mau.fi/whatsmeow/types"
)
@@ -112,6 +113,16 @@ func (au *AttrUtility) GetBool(key string, require bool) (bool, bool) {
}
}
func (au *AttrUtility) GetUnixTime(key string, require bool) (time.Time, bool) {
if intVal, ok := au.GetInt64(key, require); !ok {
return time.Time{}, false
} else if intVal == 0 {
return time.Time{}, true
} else {
return time.Unix(intVal, 0), true
}
}
// OptionalString returns the string under the given key.
func (au *AttrUtility) OptionalString(key string) string {
strVal, _ := au.GetString(key, false)
@@ -155,6 +166,16 @@ func (au *AttrUtility) Bool(key string) bool {
return val
}
func (au *AttrUtility) OptionalUnixTime(key string) time.Time {
val, _ := au.GetUnixTime(key, false)
return val
}
func (au *AttrUtility) UnixTime(key string) time.Time {
val, _ := au.GetUnixTime(key, true)
return val
}
// OK returns true if there are no errors.
func (au *AttrUtility) OK() bool {
return len(au.Errors) == 0