move gotd fork into repo. (#111)

- 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
This commit is contained in:
Adam Van Ymeren
2025-06-27 20:03:37 -07:00
committed by GitHub
parent 0952df0244
commit 7a04f298d2
19264 changed files with 1539697 additions and 84 deletions
+47
View File
@@ -0,0 +1,47 @@
package updates
import (
"context"
"go.mau.fi/mautrix-telegram/pkg/gotd/tg"
)
// State is the user internalState.
type State struct {
Pts, Qts, Date, Seq int
}
func (s State) fromRemote(remote *tg.UpdatesState) State {
return State{
Pts: remote.Pts,
Qts: remote.Qts,
Date: remote.Date,
Seq: remote.Seq,
}
}
// StateStorage is the users internalState storage.
//
// Note:
// SetPts, SetQts, SetDate, SetSeq, SetDateSeq
// should return error if user internalState does not exist.
type StateStorage interface {
GetState(ctx context.Context, userID int64) (state State, found bool, err error)
SetState(ctx context.Context, userID int64, state State) error
SetPts(ctx context.Context, userID int64, pts int) error
SetQts(ctx context.Context, userID int64, qts int) error
SetDate(ctx context.Context, userID int64, date int) error
SetSeq(ctx context.Context, userID int64, seq int) error
SetDateSeq(ctx context.Context, userID int64, date, seq int) error
GetChannelPts(ctx context.Context, userID, channelID int64) (pts int, found bool, err error)
SetChannelPts(ctx context.Context, userID, channelID int64, pts int) error
ForEachChannels(ctx context.Context, userID int64, f func(ctx context.Context, channelID int64, pts int) error) error
}
// AccessHasher stores user and channel access hashes for a user.
type AccessHasher interface {
SetChannelAccessHash(ctx context.Context, forUserID, channelID, accessHash int64) error
GetChannelAccessHash(ctx context.Context, forUserID, channelID int64) (accessHash int64, found bool, err error)
SetUserAccessHash(ctx context.Context, forUserID, userID, accessHash int64) error
GetUserAccessHash(ctx context.Context, forUserID, userID int64) (accessHash int64, found bool, err error)
}