mirror of
https://github.com/vale981/ement.el
synced 2025-03-06 01:31:41 -05:00
WIP: Only fill gaps after initial sync
This commit is contained in:
parent
ad8766ef10
commit
d7e33f9bc1
1 changed files with 14 additions and 10 deletions
24
ement.el
24
ement.el
|
@ -614,16 +614,20 @@ To be called in `ement-sync-callback-hook'."
|
|||
do (run-hook-with-args 'ement-event-hook event room session)
|
||||
(when (ement--sync-messages-p session)
|
||||
(ement-progress-update)))
|
||||
(when (alist-get 'limited timeline)
|
||||
;; Timeline was limited: start filling gap. We start the
|
||||
;; gap-filling, retrieving up to the session's current
|
||||
;; next-batch token (this function is not called when retrieving
|
||||
;; older messages, so the session's next-batch token is only
|
||||
;; evaluated once, when this chain begins, and then that token
|
||||
;; is passed to repeated calls to `ement-room-retro-to-token'
|
||||
;; until the gap is filled).
|
||||
(ement-room-retro-to-token joined-room session (alist-get 'prev_batch timeline)
|
||||
(ement-session-next-batch session)))))
|
||||
(when (ement-session-has-synced-p session)
|
||||
;; NOTE: We don't fill gaps in "limited" requests on initial
|
||||
;; sync, only in subsequent syncs, e.g. after the system has
|
||||
;; slept and awakened.
|
||||
(when (alist-get 'limited timeline)
|
||||
;; Timeline was limited: start filling gap. We start the
|
||||
;; gap-filling, retrieving up to the session's current
|
||||
;; next-batch token (this function is not called when retrieving
|
||||
;; older messages, so the session's next-batch token is only
|
||||
;; evaluated once, when this chain begins, and then that token
|
||||
;; is passed to repeated calls to `ement-room-retro-to-token'
|
||||
;; until the gap is filled).
|
||||
(ement-room-retro-to-token room session (alist-get 'prev_batch timeline)
|
||||
(ement-session-next-batch session))))))
|
||||
|
||||
(defun ement--make-event (event)
|
||||
"Return `ement-event' struct for raw EVENT list.
|
||||
|
|
Loading…
Add table
Reference in a new issue