diff --git a/etc/default-theme.conf b/etc/default-theme.conf index 13acc79..b117b54 100644 --- a/etc/default-theme.conf +++ b/etc/default-theme.conf @@ -20,96 +20,96 @@ # - blink # The text that starts the title section of a window -window.title.left.stopper.value = "╼▌" +window.title.left.stopper.value = "╼▌" # The text taht end the title section of a window -window.title.right.stopper.value = "▐╾" +window.title.right.stopper.value = "▐╾" # default background color of terminal -main-window.background = black +main-window.background = black # default foreground color (text) of terminal -main-window.foreground = white +main-window.foreground = white # shown when a message was trasmitted in crypted form -crypted.mark.value = " 🔏👌" +crypted.mark.value = " 🔏👌" # quick help window style -quick-help.header.foreground = white +quick-help.header.foreground = white -quick-help.header.background = red +quick-help.header.background = red -quick-help.header.attribute = bold +quick-help.header.attribute = bold # help dialog style -help-dialog.background = white +help-dialog.background = white -help-dialog.foreground = red +help-dialog.foreground = red # info dialog style -info-dialog.background = blue +info-dialog.background = blue -info-dialog.foreground = yellow +info-dialog.foreground = yellow # error dialog style -error-dialog.background = red +error-dialog.background = red -error-dialog.foreground = yellow +error-dialog.foreground = yellow # input dialog style -input-dialog.background = blue +input-dialog.background = blue -input-dialog.foreground = white +input-dialog.foreground = white # this color specifies the style for form of the dialog -input-dialog.input.foreground = black +input-dialog.input.foreground = black -input-dialog.input.background = #aaaaaa +input-dialog.input.background = #aaaaaa # this color specify the style for active form of the dialog -input-dialog.input.selected.foreground = black +input-dialog.input.selected.foreground = black -input-dialog.input.selected.background = white +input-dialog.input.selected.background = white # the notify window shows useful information to the user -notify-window.background = #0219A2 +notify-window.background = #0219A2 -notify-window.foreground = #55D67C +notify-window.foreground = #55D67C -notify-window.life = 2 +notify-window.life = 2 # a window shows this text in the top left corner to indicate that it # has focus -window.focus.mark.value = "📌" +window.focus.mark.value = "📌" -window.focus.mark.foreground = white +window.focus.mark.foreground = white -window.focus.mark.background = black +window.focus.mark.background = black # this specify style for the thread window -thread-window.background = black +thread-window.background = black -thread-window.foreground = blue +thread-window.foreground = blue # the modeline window is a small section on the very bottom of the # thread window that shows some information about the threads see # below. -thread-window.modeline.background = blue +thread-window.modeline.background = blue -thread-window.modeline.foreground = yellow +thread-window.modeline.foreground = yellow # this variable customize the information that the modeline will # shows, values prefixed with a '%' will be expanded, allowe values to @@ -124,103 +124,103 @@ thread-window.modeline.foreground = yellow # - %tags in selected messages (if any) # - %% a percent sign -thread-window.modeline.value = "%u@%s ◈ %k %r/%t ◈ folder: %f ◈ tags: %h" +thread-window.modeline.value = "%u@%s ◈ %k %r/%t ◈ folder: %f ◈ tags: %h" # this is the only width you have to specify as the others windows # just fills the void left by this one -thread-window.width = 5/6 +thread-window.width = 5/6 -thread-window.height = 1/4 +thread-window.height = 1/4 # colors for selected messages in thread window -thread-window.message.selected.background = cyan +thread-window.message.selected.background = cyan -thread-window.message.selected.foreground = black +thread-window.message.selected.foreground = black -#thread-window.message.selected.attribute = bold +#thread-window.message.selected.attribute = bold # colors for messages marked for deletion in thread window -thread-window.message.deleted.background = red +thread-window.message.deleted.background = red -thread-window.message.deleted.foreground = white +thread-window.message.deleted.foreground = white -thread-window.message.deleted.attribute = bold +thread-window.message.deleted.attribute = bold # colors for already read messages in thread window -thread-window.message.read.background = black +thread-window.message.read.background = black -thread-window.message.read.foreground = #aaaaaa +thread-window.message.read.foreground = #aaaaaa -thread-window.message.read.attribute = italic +thread-window.message.read.attribute = italic # colors for new (not read) messages in thread window -thread-window.message.unread.background = black +thread-window.message.unread.background = black -thread-window.message.unread.foreground = cyan +thread-window.message.unread.foreground = cyan -#thread-window.message.unread.attribute = bold +#thread-window.message.unread.attribute = bold # text to signal that you favourited this message -thread-window.message.favourite.value = "★" +thread-window.message.favourite.value = "★" # color of the text that signals that you favourited this message -thread-window.message.favourite.foreground = yellow +thread-window.message.favourite.foreground = yellow # text to signal that this message is marked as sensible -thread-window.message.sensitive.value = "⚠ " +thread-window.message.sensitive.value = "⚠ " # color of the text that signals that this message is marked as sensible -thread-window.message.sensitive.foreground = blue +thread-window.message.sensitive.foreground = blue # text that signals that you boosted this message -thread-window.message.boosted.value = "♻" +thread-window.message.boosted.value = "♻" # color of the text that signals that you boosted this message -thread-window.message.boosted.foreground = cyan +thread-window.message.boosted.foreground = cyan # the messages are organized in trees # color of the branch of the tree (the segments that connect messages) -thread-window.tree.branch.foreground = red +thread-window.tree.branch.foreground = red # color of the arrow in the tree that points to a single message -thread-window.tree.arrow.foreground = magenta +thread-window.tree.arrow.foreground = magenta # color of the subject of the message (AKA sensistive text) for a # message -thread-window.tree.data.foreground = white +thread-window.tree.data.foreground = white # color of the subject of the message (AKA sensistive text) for # message with no replies -thread-window.tree.data-leaf.foreground = white +thread-window.tree.data-leaf.foreground = white # arrow that point to a message -thread-window.tree.arrow.value = "🞂 " +thread-window.tree.arrow.value = "🞂 " # segment that connect a message with no replies to the tree -thread-window.tree.leaf.value = "╰" +thread-window.tree.leaf.value = "╰" # segment that connect a message with replies to the tree -thread-window.tree.branch.value = "├" +thread-window.tree.branch.value = "├" # segment that push to the left a message subject -thread-window.tree.spacer.value = "─" +thread-window.tree.spacer.value = "─" # vertical segment that connect tree branches -thread-window.tree.vertical-line.value = "│" +thread-window.tree.vertical-line.value = "│" # a message shows the composition date, specify the format: # values starting with '%' will be expanded, allowed values are: @@ -237,143 +237,143 @@ thread-window.tree.vertical-line.value = "│" # - %short-month Jan to Dec # - %% a percent sign -thread-window.date-format.value = "%year %short-month %day %hour:%min" +thread-window.date-format.value = "%year %short-month %day %hour:%min" # the windows that shows tags subscriptions -tags-window.height = 1/2 +tags-window.height = 1/2 -tags-window.background = black +tags-window.background = black -tags-window.foreground = #67998B +tags-window.foreground = #67998B # the colors for currently selected tags -tags-window.input.selected.background = black +tags-window.input.selected.background = black -tags-window.input.selected.foreground = #71AF8C +tags-window.input.selected.foreground = #71AF8C # tags shows a little histogram (note that some servers do not provide # this information) for number of messages posted every day that # contains this tag -tags-window.histogram.foreground = yellow +tags-window.histogram.foreground = yellow # test to indicate that this tags got new messages -tags-window.new-message.mark.value = " 📬" +tags-window.new-message.mark.value = " 📬" # this is the window that shows active conversation (a conversation is # active until the user chooses to ignore it) -conversations-window.background = black +conversations-window.background = black -conversations-window.foreground = #B48B21 +conversations-window.foreground = #B48B21 # the colors for currently selected conversation -conversations-window.input.selected.background = #4B0301 +conversations-window.input.selected.background = #4B0301 -conversations-window.input.selected.foreground = #B27DE5 +conversations-window.input.selected.foreground = #B27DE5 #colors for count of read messages for conversation -#conversations-window.read.background = black +#conversations-window.read.background = black -#conversations-window.read.foreground = blue +#conversations-window.read.foreground = blue #colors for count of unreaded messages for conversation -conversations-window.unread.background = black +conversations-window.unread.background = black -conversations-window.unread.foreground = red +conversations-window.unread.foreground = red # this is the message that shows available keybindings -keybindings-window.background = black +keybindings-window.background = black -keybindings-window.foreground = #E2BE6F +keybindings-window.foreground = #E2BE6F -keybindings-window.height = 1/2 +keybindings-window.height = 1/2 # see configuration for tree in thread window above -keybindings-window.tree.branch.foreground = red +keybindings-window.tree.branch.foreground = red -keybindings-window.tree.arrow.foreground = magenta +keybindings-window.tree.arrow.foreground = magenta -keybindings-window.tree.data.foreground = white +keybindings-window.tree.data.foreground = white -keybindings-window.tree.data-leaf.foreground = cyan +keybindings-window.tree.data-leaf.foreground = cyan -keybindings-window.tree.arrow.value = "🞂 " +keybindings-window.tree.arrow.value = "🞂 " -keybindings-window.tree.leaf.value = "╰" +keybindings-window.tree.leaf.value = "╰" -keybindings-window.tree.branch.value = "├" +keybindings-window.tree.branch.value = "├" -keybindings-window.tree.spacer.value = "─" +keybindings-window.tree.spacer.value = "─" -keybindings-window.tree.vertical-line.value = "│" +keybindings-window.tree.vertical-line.value = "│" # autocomplete window -suggestions-window.background = blue +suggestions-window.background = blue -suggestions-window.foreground = yellow +suggestions-window.foreground = yellow -suggestions-window.height = 1/4 +suggestions-window.height = 1/4 # the directive belows configure the window at the very bottom of the # screen that user uses to give command to the program, also is used # to shows some input errors or other informations -command-window.background = black +command-window.background = black -command-window.foreground = white +command-window.foreground = white # text to separate keybindig added so far by the user -command-window.command-separator.value = " → " +command-window.command-separator.value = " → " # colors of the separator above -command-window.command-separator.foreground = yellow +command-window.command-separator.foreground = yellow -command-window.command-separator.background = black +command-window.command-separator.background = black # color for error message shown in command window -command-window.error.message.background = black +command-window.error.message.background = black -command-window.error.message.foreground = red +command-window.error.message.foreground = red -command-window.error.message.attribute = bold +command-window.error.message.attribute = bold # color for info message shown in command window -command-window.info.message.foreground = yellow +command-window.info.message.foreground = yellow -command-window.info.message.background = black +command-window.info.message.background = black -command-window.info.message.attribute = bold +command-window.info.message.attribute = bold # this is the window that show the content of a message -message-window.background = black +message-window.background = black -message-window.foreground = #c9c0c0 +message-window.foreground = #c9c0c0 # a marker on the right side of the window to show the position of the # message is visualized in repect of the message lines length (similar # to scrollbar in GUI) -message-window.line-position-mark.foreground = white +message-window.line-position-mark.foreground = white -message-window.line-position-mark.background = black +message-window.line-position-mark.background = black # the text for the marker above -message-window.line-position-mark.value = "⧫" +message-window.line-position-mark.value = "⧫" # the date format for message # values starting with '%' will be expanded, allowed values are: @@ -390,29 +390,41 @@ message-window.line-position-mark.value = "⧫" # - %short-month Jan to Dec # - %% a percent sign -message-window.date-format.value = "%year %short-month %day %hour:%min" +message-window.date-format.value = "%year %short-month %day %hour:%min" -message-window.attachment-header.prefix.value = "~%──── " +message-window.attachment-header.prefix.value = "~%──── " -message-window.attachment-header.postfix.value = " ────~%" +message-window.attachment-header.postfix.value = " ────~%" -message-window.account.locked.mark.value = " 🔒" +message-window.account.locked.mark.value = " 🔒" -message-window.account.unlocked.mark.value = " 🔓" +message-window.account.unlocked.mark.value = " 🔓" # the string for the header of attachments in a message, if not # specified a default is chosen by the software. -#message-window.attachment-header.value = " attachment " +#message-window.attachment-header.value = " attachment " # this is the window that allow to browse the attachments of a message -open-attach-window.background = black +open-attach-window.background = black -open-attach-window.foreground = #67998B +open-attach-window.foreground = #67998B -# the colors of selected attachments +# the colors of selected attachment -open-attach-window.input.selected.background = black +open-attach-window.input.selected.background = black -open-attach-window.input.selected.foreground = #71AF8C +open-attach-window.input.selected.foreground = #71AF8C + +# this is the window that allow to browse the links of a message + +open-message-link-window.background = black + +open-message-link-window.foreground = #FEB200 + +# the colors of selected link + +open-message-link-window.input.selected.background = black + +open-message-link-window.input.selected.foreground = #FFB200 diff --git a/etc/init.lisp b/etc/init.lisp index 3707f59..696861a 100644 --- a/etc/init.lisp +++ b/etc/init.lisp @@ -203,6 +203,14 @@ (define-key "v" #'open-message-attach *thread-keymap*) +(define-key "V" #'open-message-link *thread-keymap*) + +(define-key "C-c u" #'update-conversations *thread-keymap*) + +(define-key "C-c o" #'open-conversation *thread-keymap*) + +(define-key "C-c c" #'change-conversation-name *thread-keymap*) + (define-key "C-f c" #'change-folder *thread-keymap*) (define-key "C-t c" #'change-timeline *thread-keymap*) @@ -215,20 +223,6 @@ (define-key "C-t h r" #'refresh-tags *thread-keymap*) -(define-key "C-X m t" #'move-message-tree *thread-keymap*) - -(define-key "C-X m f" #'favourite-selected-status *thread-keymap*) - -(define-key "C-X m r f" #'unfavourite-selected-status *thread-keymap*) - -(define-key "C-X m b" #'boost-selected-status *thread-keymap*) - -(define-key "C-X m r b" #'unboost-selected-status *thread-keymap*) - -(define-key "C-X m s" #'subscribe-to-hash *thread-keymap*) - -(define-key "C-X m u" #'unsubscribe-to-hash *thread-keymap*) - (define-key "C-u i" #'ignore-user *thread-keymap*) (define-key "C-u x" #'unignore-user *thread-keymap*) @@ -247,11 +241,19 @@ (define-key "C-u c k g" #'crypto-generate-key *thread-keymap*) -(define-key "C-c u" #'update-conversations *thread-keymap*) +(define-key "C-X m t" #'move-message-tree *thread-keymap*) -(define-key "C-c o" #'open-conversation *thread-keymap*) +(define-key "C-X m f" #'favourite-selected-status *thread-keymap*) -(define-key "C-c c" #'change-conversation-name *thread-keymap*) +(define-key "C-X m r f" #'unfavourite-selected-status *thread-keymap*) + +(define-key "C-X m b" #'boost-selected-status *thread-keymap*) + +(define-key "C-X m r b" #'unboost-selected-status *thread-keymap*) + +(define-key "C-X m s" #'subscribe-to-hash *thread-keymap*) + +(define-key "C-X m u" #'unsubscribe-to-hash *thread-keymap*) ;; message window keymap @@ -303,4 +305,18 @@ (define-key "down" #'open-message-attach-go-down *open-attach-keymap*) -(define-key "q" #'close-open-message-window *open-attach-keymap*) +(define-key "q" #'close-open-attach-window *open-attach-keymap*) + +;; message links keymap + +(define-key "C-J" #'open-message-link-perform-opening + *open-message-link-keymap*) + +(define-key "up" #'open-message-link-go-up + *open-message-link-keymap*) + +(define-key "down" #'open-message-link-go-down + *open-message-link-keymap*) + +(define-key "q" #'close-open-message-link-window + *open-message-link-keymap*) diff --git a/src/html-utils.lisp b/src/html-utils.lisp index 6d95043..7dd929f 100644 --- a/src/html-utils.lisp +++ b/src/html-utils.lisp @@ -104,7 +104,7 @@ Some convenience functions are provided to works with this structures. (_ "No address found"))) (descend-children node) (when add-link-footnotes - (format body-stream "[~a] " link-count)))) + (format body-stream " [~a] " link-count)))) ((tag= +tag-break+ node) (format body-stream "~%") (descend-children node)) diff --git a/src/keybindings.lisp b/src/keybindings.lisp index 509c41f..994679f 100644 --- a/src/keybindings.lisp +++ b/src/keybindings.lisp @@ -243,6 +243,9 @@ produces a tree and graft the latter on `existing-tree'" (defparameter *open-attach-keymap* (make-starting-comand-tree) "The keymap for window to open message's attachments.") +(defparameter *open-message-link-keymap* (make-starting-comand-tree) + "The keymap for window to open message's links.") + (defun define-key (key-sequence function &optional (existing-keymap *global-keymap*)) "Define a key sequence that trigger a function: diff --git a/src/line-oriented-window.lisp b/src/line-oriented-window.lisp index 4eae853..881c6cc 100644 --- a/src/line-oriented-window.lisp +++ b/src/line-oriented-window.lisp @@ -220,10 +220,12 @@ this exact quantity wold go beyond the length or fows or zero." (defclass simple-line-navigation-window (wrapper-window row-oriented-widget border-window) ((selected-line-bg + :initform :blue :initarg :selected-line-bg :accessor selected-line-bg :documentation "The background color for a selected line") (selected-line-fg + :initform :red :initarg :selected-line-fg :accessor selected-line-fg :documentation "The foreground color for a selected line")) diff --git a/src/open-attach-window.lisp b/src/open-attach-window.lisp index 92beeef..b97742d 100644 --- a/src/open-attach-window.lisp +++ b/src/open-attach-window.lisp @@ -25,11 +25,11 @@ :initarg :status-id :accessor status-id))) -(defmethod refresh-config :after ((object open-attach-window)) +(defun refresh-view-links-window-config (window config-window-key) (with-accessors ((croatoan-window croatoan-window) (selected-line-bg selected-line-bg) - (selected-line-fg selected-line-fg)) object - (let* ((theme-style (swconf:form-style swconf:+key-open-attach-window+)) + (selected-line-fg selected-line-fg)) window + (let* ((theme-style (swconf:form-style config-window-key)) (fg (swconf:foreground theme-style)) (bg (swconf:background theme-style)) (selected-fg (swconf:selected-foreground theme-style)) @@ -46,9 +46,12 @@ (setf (fgcolor croatoan-window) fg) (setf selected-line-fg selected-fg) (setf selected-line-bg selected-bg) - (win-resize object win-w win-h) - (win-move object x y) - object))) + (win-resize window win-w win-h) + (win-move window x y) + window))) + +(defmethod refresh-config :after ((object open-attach-window)) + (refresh-view-links-window-config object swconf:+key-open-attach-window+)) (defmethod resync-rows-db ((object open-attach-window) &key (redraw t) diff --git a/src/package.lisp b/src/package.lisp index 9931114..c64f7b8 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -351,7 +351,8 @@ :box-fit-multiple-column :annotated-text-symbol :annotated-text-value - :box-fit-multiple-column-annotated)) + :box-fit-multiple-column-annotated + :collect-links)) (defpackage :html-utils (:use @@ -927,6 +928,7 @@ :+key-boosted+ :+key-tags-window+ :+key-open-attach-window+ + :+key-open-message-link-window+ :+key-conversations-window+ :+key-keybindings-window+ :+key-suggestions-window+ @@ -1027,6 +1029,7 @@ :*send-message-keymap* :*follow-requests-keymap* :*open-attach-keymap* + :*open-message-link-keymap* :define-key :init-keyboard-mapping :find-keymap-node @@ -1051,7 +1054,8 @@ :*follow-requests-window* :*tags-window* :*conversations-window* - :*open-attach-window*)) + :*open-attach-window* + :*open-message-link-window*)) (defpackage :program-events (:use @@ -1613,10 +1617,34 @@ (:shadowing-import-from :misc :random-elt :shuffle) (:export :open-attach-window + :status-id + :refresh-view-links-window-config :resync-rows-db :open-attachment :init)) +(defpackage :open-message-link-window + (:use + :cl + :alexandria + :cl-ppcre + :access + :croatoan + :config + :constants + :text-utils + :misc + :mtree + :specials + :windows + :line-oriented-window + :tui-utils) + (:shadowing-import-from :misc :random-elt :shuffle) + (:export + :open-message-link-window + :open-message-link + :init)) + (defpackage :command-window (:use :cl @@ -1855,7 +1883,12 @@ :open-message-attach-go-up :open-message-attach-go-down :open-message-attach-perform-opening - :close-open-message-window + :close-open-attach-window + :open-message-link + :open-message-link-go-up + :open-message-link-go-down + :open-message-link-perform-opening + :close-open-message-link-window :attach-go-up :attach-go-down :attach-delete diff --git a/src/software-configuration.lisp b/src/software-configuration.lisp index bac2519..ad7e06e 100644 --- a/src/software-configuration.lisp +++ b/src/software-configuration.lisp @@ -353,6 +353,7 @@ keybindings-window suggestions-window open-attach-window + open-message-link-window command-window command-separator tree diff --git a/src/specials.lisp b/src/specials.lisp index 77e3424..e6649b9 100644 --- a/src/specials.lisp +++ b/src/specials.lisp @@ -48,3 +48,6 @@ (defparameter *open-attach-window* nil "The window that shows attachments for a message.") + +(defparameter *open-message-link-window* nil + "The window that shows links in a message.") diff --git a/src/text-utils.lisp b/src/text-utils.lisp index 974df0a..7d14701 100644 --- a/src/text-utils.lisp +++ b/src/text-utils.lisp @@ -631,3 +631,22 @@ printed in the box column by column; in the example above the results are: box-height)) (list columns))))) (fit))) + +(defun collect-links (text &optional (schemes '("http" "https" "ftp"))) + "Collect all hyperlinks in a text marked from a list of valid `schemes'" + (flet ((build-re-scheme () + (let ((res "")) + (loop for (scheme . rest) on schemes do + (if rest + (setf res (strcat res "(" scheme ")|")) + (setf res (strcat res "(" scheme ")://")))) + (strcat "(" res ")")))) + (let* ((results ()) + (re (strcat (build-re-scheme) "\\P{White_Space}+")) + (words (split-words text)) + (scanner (cl-ppcre:create-scanner re))) + (loop for word in words when (cl-ppcre:scan scanner word) do + (pushnew (cl-ppcre:scan-to-strings scanner word) + results + :test #'string=)) + results))) diff --git a/src/ui-goodies.lisp b/src/ui-goodies.lisp index c705bdb..8cda595 100644 --- a/src/ui-goodies.lisp +++ b/src/ui-goodies.lisp @@ -342,7 +342,9 @@ Metadata includes: specials:*thread-window* :documentation "Move focus on thread window" :info-change-focus-message (_ "Focus passed on threads window") - :windows-lose-focus (specials:*conversations-window* + :windows-lose-focus (specials:*open-message-link-window* + specials:*open-attach-window* + specials:*conversations-window* specials:*tags-window* specials:*send-message-window* specials:*message-window* @@ -352,7 +354,9 @@ Metadata includes: specials:*message-window* :documentation "Move focus on message window" :info-change-focus-message (_ "Focus passed on message window") - :windows-lose-focus (specials:*conversations-window* + :windows-lose-focus (specials:*open-message-link-window* + specials:*open-attach-window* + specials:*conversations-window* specials:*tags-window* specials:*thread-window* specials:*send-message-window* @@ -363,7 +367,8 @@ Metadata includes: specials:*send-message-window* :documentation "Move focus on send message window" :info-change-focus-message (_ "Focus passed on send message window") - :windows-lose-focus (specials:*open-attach-window* + :windows-lose-focus (specials:*open-message-link-window* + specials:*open-attach-window* specials:*conversations-window* specials:*tags-window* specials:*thread-window* @@ -374,7 +379,8 @@ Metadata includes: specials:*follow-requests-window* :documentation "Move focus on follow requests window" :info-change-focus-message (_ "Focus passed on follow requests window") - :windows-lose-focus (specials:*open-attach-window* + :windows-lose-focus (specials:*open-message-link-window* + specials:*open-attach-window* specials:*conversations-window* specials:*tags-window* specials:*thread-window* @@ -385,7 +391,8 @@ Metadata includes: specials:*tags-window* :documentation "Move focus on tags window" :info-change-focus-message (_ "Focus passed on tags window") - :windows-lose-focus (specials:*open-attach-window* + :windows-lose-focus (specials:*open-message-link-window* + specials:*open-attach-window* specials:*conversations-window* specials:*follow-requests-window* specials:*thread-window* @@ -395,7 +402,8 @@ Metadata includes: specials:*conversations-window* :documentation "Move focus on conversations window" :info-change-focus-message (_ "Focus passed on conversation window") - :windows-lose-focus (specials:*open-attach-window* + :windows-lose-focus (specials:*open-message-link-window* + specials:*open-attach-window* specials:*tags-window* specials:*follow-requests-window* specials:*thread-window* @@ -406,7 +414,20 @@ Metadata includes: specials:*open-attach-window* :documentation "Move focus on open-attach window" :info-change-focus-message (_ "Focus passed on attach window") + :windows-lose-focus (specials:*open-message-link-window* + specials:*conversations-window* + specials:*tags-window* + specials:*follow-requests-window* + specials:*thread-window* + specials:*message-window* + specials:*send-message-window*)) + +(gen-focus-to-window open-message-link-window + specials:*open-message-link-window* + :documentation "Move focus on open-link window" + :info-change-focus-message (_ "Focus passed on link window") :windows-lose-focus (specials:*conversations-window* + specials:*open-attach-window* specials:*tags-window* specials:*follow-requests-window* specials:*thread-window* @@ -822,7 +843,9 @@ Starting from the oldest toot and going back." (push-event event))))))) (defun open-message-attach () - "Open message attachments window" + "Open message links window + +Browse and optionally open the links the messages contains." (when-let* ((win specials:*thread-window*) (selected-message (line-oriented-window:selected-row-fields win))) (open-attach-window:init (db:row-message-status-id selected-message)) @@ -845,9 +868,36 @@ Starting from the oldest toot and going back." (url (line-oriented-window:normal-text selected-line))) (open-attach-window:open-attachment url))) -(defun close-open-message-window () +(defun close-open-attach-window () (close-window-and-return-to-threads specials:*open-attach-window*)) +(defun open-message-link () + "Open message attachments window" + (when-let* ((win specials:*thread-window*) + (selected-message (line-oriented-window:selected-row-fields win))) + (open-message-link-window:init (db:row-message-status-id selected-message)) + (focus-to-open-message-link-window))) + +(defun open-message-link-move (amount) + (ignore-errors + (line-oriented-window:unselect-all specials:*open-message-link-window*) + (line-oriented-window:row-move specials:*open-message-link-window* amount) + (draw specials:*open-message-link-window*))) + +(defun open-message-link-go-down () + (open-message-link-move 1)) + +(defun open-message-link-go-up () + (open-message-link-move -1)) + +(defun open-message-link-perform-opening () + (when-let* ((selected-line (line-oriented-window:selected-row specials:*open-message-link-window*)) + (url (line-oriented-window:normal-text selected-line))) + (open-message-link-window:open-message-link url))) + +(defun close-open-message-link-window () + (close-window-and-return-to-threads specials:*open-message-link-window*)) + (defun prompt-for-username (prompt complete-function event notify-starting-message notify-ending-message) diff --git a/tinmop.asd b/tinmop.asd index caf733f..f5bcead 100644 --- a/tinmop.asd +++ b/tinmop.asd @@ -92,6 +92,7 @@ (:file "thread-window") (:file "message-window") (:file "open-attach-window") + (:file "open-message-link-window") (:file "command-window") (:file "sending-message") (:file "follow-requests")