7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
37 lines
739 B
Go
37 lines
739 B
Go
package cached
|
|
|
|
import (
|
|
"sort"
|
|
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/telegram/query/hasher"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tg"
|
|
)
|
|
|
|
func (s *ContactsGetContacts) computeHash(v *tg.ContactsContacts) int64 {
|
|
cts := v.Contacts
|
|
|
|
sort.SliceStable(cts, func(i, j int) bool {
|
|
return cts[i].UserID < cts[j].UserID
|
|
})
|
|
h := hasher.Hasher{}
|
|
for _, contact := range cts {
|
|
h.Update(uint32(contact.UserID))
|
|
}
|
|
|
|
return h.Sum()
|
|
}
|
|
|
|
func (s *MessagesGetQuickReplies) computeHash(v *tg.MessagesQuickReplies) int64 {
|
|
r := v.QuickReplies
|
|
|
|
sort.SliceStable(r, func(i, j int) bool {
|
|
return r[i].ShortcutID < r[j].ShortcutID
|
|
})
|
|
h := hasher.Hasher{}
|
|
for _, contact := range r {
|
|
h.Update(uint32(contact.ShortcutID))
|
|
}
|
|
|
|
return h.Sum()
|
|
}
|