mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-29 12:42:46 +00:00
Fix issue uint64 values with high bit are not supported
in presence (#2562)
* Fix issue #2528 * Use gomatrixserverlib.Timestamp * Use ParseUint instead of ParseInt
This commit is contained in:
parent
f3e8a9a4cb
commit
f76f28e6db
3 changed files with 7 additions and 7 deletions
|
@ -144,7 +144,7 @@ func (s *PresenceConsumer) onMessage(ctx context.Context, msg *nats.Msg) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
ts, err := strconv.Atoi(timestamp)
|
||||
ts, err := strconv.ParseUint(timestamp, 10, 64)
|
||||
if err != nil {
|
||||
return true
|
||||
}
|
||||
|
@ -157,12 +157,12 @@ func (s *PresenceConsumer) onMessage(ctx context.Context, msg *nats.Msg) bool {
|
|||
// already checked, so no need to check error
|
||||
p, _ := types.PresenceFromString(presence)
|
||||
|
||||
s.EmitPresence(ctx, userID, p, statusMsg, ts, fromSync)
|
||||
s.EmitPresence(ctx, userID, p, statusMsg, gomatrixserverlib.Timestamp(ts), fromSync)
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *PresenceConsumer) EmitPresence(ctx context.Context, userID string, presence types.Presence, statusMsg *string, ts int, fromSync bool) {
|
||||
pos, err := s.db.UpdatePresence(ctx, userID, presence, statusMsg, gomatrixserverlib.Timestamp(ts), fromSync)
|
||||
func (s *PresenceConsumer) EmitPresence(ctx context.Context, userID string, presence types.Presence, statusMsg *string, ts gomatrixserverlib.Timestamp, fromSync bool) {
|
||||
pos, err := s.db.UpdatePresence(ctx, userID, presence, statusMsg, ts, fromSync)
|
||||
if err != nil {
|
||||
logrus.WithError(err).WithField("user", userID).WithField("presence", presence).Warn("failed to updated presence for user")
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue