diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-tl.el | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 899377a..44d31bf 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1418,10 +1418,12 @@ LINK-HEADER is the http Link header if present." (url (mastodon-http--api endpoint))) (mastodon-http--get-json url args))) -(defun mastodon-tl--more-json-async (endpoint id callback &rest cbargs) +(defun mastodon-tl--more-json-async (endpoint id &optional params callback &rest cbargs) "Return JSON for timeline ENDPOINT before ID. -Then run CALLBACK with arguments CBARGS." +Then run CALLBACK with arguments CBARGS +PARAMS is used to send 'local=true' for local timeline." (let* ((args `(("max_id" . ,(mastodon-tl--as-string id)))) + (args (if params (push params args) args)) (url (mastodon-http--api endpoint))) (apply 'mastodon-http--get-json-async url args callback cbargs))) @@ -2554,7 +2556,7 @@ For use after e.g. deleting a toot." (mastodon-tl--get-home-timeline)) ((equal (mastodon-tl--get-endpoint) "timelines/public") (mastodon-tl--get-federated-timeline)) - ((equal (mastodon-tl--get-buffer-property 'buffer-name "*mastodon-local*")) + ((equal (mastodon-tl--buffer-name) "*mastodon-local*") (mastodon-tl--get-local-timeline)) ((equal (mastodon-tl--get-endpoint) "notifications") (mastodon-notifications-get)) @@ -2597,8 +2599,13 @@ when showing followers or accounts followed." (url (mastodon-tl--build-link-header-url next))) (mastodon-http--get-response-async url nil 'mastodon-tl--more* (current-buffer) (point) :headers)) - (mastodon-tl--more-json-async (mastodon-tl--get-endpoint) (mastodon-tl--oldest-id) - 'mastodon-tl--more* (current-buffer) (point)))) + (mastodon-tl--more-json-async + (mastodon-tl--get-endpoint) + (mastodon-tl--oldest-id) + ;; local has same endpoint as federated: + (when (string= (mastodon-tl--buffer-name) "*mastodon-local*") + '("local" . "true")) + 'mastodon-tl--more* (current-buffer) (point)))) (defun mastodon-tl--more* (response buffer point-before &optional headers) "Append older toots to timeline, asynchronously. @@ -2812,7 +2819,9 @@ from the start if it is nil." "Initialize BUFFER-NAME with timeline targeted by ENDPOINT asynchronously. UPDATE-FUNCTION is used to recieve more toots. HEADERS means to also collect the response headers. Used for paginating -favourites and bookmarks." +favourites and bookmarks. +PARAMS is any parameters to send with the request, currently only +used to send 'local=true' for local timeline." (let ((url (mastodon-http--api endpoint)) (buffer (concat "*mastodon-" buffer-name "*"))) (if headers |