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
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
package mtproto
|
|
|
|
import (
|
|
"github.com/go-faster/errors"
|
|
"go.uber.org/zap"
|
|
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/mt"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/proto"
|
|
)
|
|
|
|
func (c *Conn) handleMessage(msgID int64, b *bin.Buffer) error {
|
|
id, err := b.PeekID()
|
|
if err != nil {
|
|
// Empty body.
|
|
return errors.Wrap(err, "peek message type")
|
|
}
|
|
|
|
c.logWithBuffer(b).Debug("Handle message", zap.Int64("msg_id", msgID))
|
|
|
|
switch id {
|
|
case mt.NewSessionCreatedTypeID:
|
|
return c.handleSessionCreated(b)
|
|
case mt.BadMsgNotificationTypeID, mt.BadServerSaltTypeID:
|
|
return c.handleBadMsg(b)
|
|
case mt.FutureSaltsTypeID:
|
|
return c.handleFutureSalts(b)
|
|
case proto.MessageContainerTypeID:
|
|
return c.handleContainer(msgID, b)
|
|
case proto.ResultTypeID:
|
|
return c.handleResult(b)
|
|
case mt.PongTypeID:
|
|
return c.handlePong(b)
|
|
case mt.MsgsAckTypeID:
|
|
return c.handleAck(b)
|
|
case proto.GZIPTypeID:
|
|
return c.handleGZIP(msgID, b)
|
|
case mt.MsgDetailedInfoTypeID,
|
|
mt.MsgNewDetailedInfoTypeID:
|
|
return nil
|
|
default:
|
|
return c.handler.OnMessage(b)
|
|
}
|
|
}
|