1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2024-12-22 23:47:56 +01:00

- [TUI] added command to download a message's attachment ignoring the cached value (if such entry in the cache exists).

This commit is contained in:
cage 2024-02-28 20:23:11 +01:00
parent 7f6da862cc
commit 8c8b5555f7
3 changed files with 11 additions and 5 deletions

View File

@ -640,8 +640,13 @@
"Copy the selected link to clipboard"
(copy-link-to-clipboard specials:*open-attach-window*))
(defun open-attachment-ignoring-cache ()
(open-message-attach-perform-opening :ignore-cache t))
(define-key "C-J" #'open-message-attach-perform-opening *open-attach-keymap*)
(define-key "O" #'open-attachment-ignoring-cache *open-attach-keymap*)
(define-key "C-c" #'copy-from-attach-window-to-clipboard *open-attach-keymap*)
(define-key "a" #'open-all-message-attachments *open-attach-keymap*)
@ -650,7 +655,7 @@
(define-key "j" #'open-message-attach-go-down *open-attach-keymap*)
(define-key "k" #'open-message-attach-go-up *open-attach-keymap*)
(define-key "k" #'open-message-attach-go-up *open-attach-keymap*)
(define-key "q" #'close-open-attach-window *open-attach-keymap*)

View File

@ -136,7 +136,7 @@
(when matchedp
(first-elt res))))
(defun open-attachment (url)
(defun open-attachment (url &key (ignore-cache nil))
(labels ((add-extension (cached-value)
(strcat (to-s cached-value) (get-extension url)))
(fill-cache (url)
@ -164,7 +164,8 @@
(open-attachment url)))
(let ((cached-file (os-utils:cached-file-path (add-extension cached))))
(if (or (not (fs:file-exists-p cached-file))
(<= (fs:file-size cached-file) 0))
(<= (fs:file-size cached-file) 0)
ignore-cache)
(progn
(db:cache-invalidate url)
(open-attachment url))

View File

@ -1494,10 +1494,10 @@ It an existing file path is provided the command will refuse to run."
(defun open-message-attach-go-up ()
(open-message-attach-move -1))
(defun open-message-attach-perform-opening ()
(defun open-message-attach-perform-opening (&key (ignore-cache nil))
(when-let* ((selected-line (line-oriented-window:selected-row *open-attach-window*))
(url (line-oriented-window:normal-text selected-line)))
(open-attach-window:open-attachment url)))
(open-attach-window:open-attachment url :ignore-cache ignore-cache)))
(defun close-open-attach-window ()
(close-window-and-return-to-threads *open-attach-window*))