1
0
Fork 0

- added a window to browse the links that a message contains.

This commit is contained in:
cage 2020-05-17 17:47:33 +02:00
parent 9f6adf02c4
commit 07b13b40d2
12 changed files with 297 additions and 154 deletions

View File

@ -20,96 +20,96 @@
# - blink # - blink
# The text that starts the title section of a window # 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 # 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 # default background color of terminal
main-window.background = black main-window.background = black
# default foreground color (text) of terminal # default foreground color (text) of terminal
main-window.foreground = white main-window.foreground = white
# shown when a message was trasmitted in crypted form # shown when a message was trasmitted in crypted form
crypted.mark.value = " 🔏👌" crypted.mark.value = " 🔏👌"
# quick help window style # 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 style
help-dialog.background = white help-dialog.background = white
help-dialog.foreground = red help-dialog.foreground = red
# info dialog style # info dialog style
info-dialog.background = blue info-dialog.background = blue
info-dialog.foreground = yellow info-dialog.foreground = yellow
# error dialog style # error dialog style
error-dialog.background = red error-dialog.background = red
error-dialog.foreground = yellow error-dialog.foreground = yellow
# input dialog style # 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 # 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 # 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 # 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 # a window shows this text in the top left corner to indicate that it
# has focus # 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 # 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 # the modeline window is a small section on the very bottom of the
# thread window that shows some information about the threads see # thread window that shows some information about the threads see
# below. # 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 # this variable customize the information that the modeline will
# shows, values prefixed with a '%' will be expanded, allowe values to # 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) # - %tags in selected messages (if any)
# - %% a percent sign # - %% 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 # this is the only width you have to specify as the others windows
# just fills the void left by this one # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # the messages are organized in trees
# color of the branch of the tree (the segments that connect messages) # 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 # 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 # color of the subject of the message (AKA sensistive text) for a
# message # message
thread-window.tree.data.foreground = white thread-window.tree.data.foreground = white
# color of the subject of the message (AKA sensistive text) for # color of the subject of the message (AKA sensistive text) for
# message with no replies # message with no replies
thread-window.tree.data-leaf.foreground = white thread-window.tree.data-leaf.foreground = white
# arrow that point to a message # 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 # 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 # 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 # 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 # 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: # a message shows the composition date, specify the format:
# values starting with '%' will be expanded, allowed values are: # values starting with '%' will be expanded, allowed values are:
@ -237,143 +237,143 @@ thread-window.tree.vertical-line.value = "│"
# - %short-month Jan to Dec # - %short-month Jan to Dec
# - %% a percent sign # - %% 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 # 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 # 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 # tags shows a little histogram (note that some servers do not provide
# this information) for number of messages posted every day that # this information) for number of messages posted every day that
# contains this tag # contains this tag
tags-window.histogram.foreground = yellow tags-window.histogram.foreground = yellow
# test to indicate that this tags got new messages # 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 # this is the window that shows active conversation (a conversation is
# active until the user chooses to ignore it) # 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 # 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 #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 #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 # 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 # 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 # 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 # 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 # screen that user uses to give command to the program, also is used
# to shows some input errors or other informations # 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 # 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 # 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 # 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 # 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 # 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 # 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 # message is visualized in repect of the message lines length (similar
# to scrollbar in GUI) # 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 # the text for the marker above
message-window.line-position-mark.value = "⧫" message-window.line-position-mark.value = "⧫"
# the date format for message # the date format for message
# values starting with '%' will be expanded, allowed values are: # values starting with '%' will be expanded, allowed values are:
@ -390,29 +390,41 @@ message-window.line-position-mark.value = "⧫"
# - %short-month Jan to Dec # - %short-month Jan to Dec
# - %% a percent sign # - %% 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 # the string for the header of attachments in a message, if not
# specified a default is chosen by the software. # 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 # 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

View File

@ -203,6 +203,14 @@
(define-key "v" #'open-message-attach *thread-keymap*) (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-f c" #'change-folder *thread-keymap*)
(define-key "C-t c" #'change-timeline *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-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 i" #'ignore-user *thread-keymap*)
(define-key "C-u x" #'unignore-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-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 ;; message window keymap
@ -303,4 +305,18 @@
(define-key "down" #'open-message-attach-go-down *open-attach-keymap*) (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*)

View File

@ -104,7 +104,7 @@ Some convenience functions are provided to works with this structures.
(_ "No address found"))) (_ "No address found")))
(descend-children node) (descend-children node)
(when add-link-footnotes (when add-link-footnotes
(format body-stream "[~a] " link-count)))) (format body-stream " [~a] " link-count))))
((tag= +tag-break+ node) ((tag= +tag-break+ node)
(format body-stream "~%") (format body-stream "~%")
(descend-children node)) (descend-children node))

View File

@ -243,6 +243,9 @@ produces a tree and graft the latter on `existing-tree'"
(defparameter *open-attach-keymap* (make-starting-comand-tree) (defparameter *open-attach-keymap* (make-starting-comand-tree)
"The keymap for window to open message's attachments.") "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*)) (defun define-key (key-sequence function &optional (existing-keymap *global-keymap*))
"Define a key sequence that trigger a function: "Define a key sequence that trigger a function:

View File

@ -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) (defclass simple-line-navigation-window (wrapper-window row-oriented-widget border-window)
((selected-line-bg ((selected-line-bg
:initform :blue
:initarg :selected-line-bg :initarg :selected-line-bg
:accessor selected-line-bg :accessor selected-line-bg
:documentation "The background color for a selected line") :documentation "The background color for a selected line")
(selected-line-fg (selected-line-fg
:initform :red
:initarg :selected-line-fg :initarg :selected-line-fg
:accessor selected-line-fg :accessor selected-line-fg
:documentation "The foreground color for a selected line")) :documentation "The foreground color for a selected line"))

View File

@ -25,11 +25,11 @@
:initarg :status-id :initarg :status-id
:accessor 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) (with-accessors ((croatoan-window croatoan-window)
(selected-line-bg selected-line-bg) (selected-line-bg selected-line-bg)
(selected-line-fg selected-line-fg)) object (selected-line-fg selected-line-fg)) window
(let* ((theme-style (swconf:form-style swconf:+key-open-attach-window+)) (let* ((theme-style (swconf:form-style config-window-key))
(fg (swconf:foreground theme-style)) (fg (swconf:foreground theme-style))
(bg (swconf:background theme-style)) (bg (swconf:background theme-style))
(selected-fg (swconf:selected-foreground theme-style)) (selected-fg (swconf:selected-foreground theme-style))
@ -46,9 +46,12 @@
(setf (fgcolor croatoan-window) fg) (setf (fgcolor croatoan-window) fg)
(setf selected-line-fg selected-fg) (setf selected-line-fg selected-fg)
(setf selected-line-bg selected-bg) (setf selected-line-bg selected-bg)
(win-resize object win-w win-h) (win-resize window win-w win-h)
(win-move object x y) (win-move window x y)
object))) 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 (defmethod resync-rows-db ((object open-attach-window) &key
(redraw t) (redraw t)

View File

@ -351,7 +351,8 @@
:box-fit-multiple-column :box-fit-multiple-column
:annotated-text-symbol :annotated-text-symbol
:annotated-text-value :annotated-text-value
:box-fit-multiple-column-annotated)) :box-fit-multiple-column-annotated
:collect-links))
(defpackage :html-utils (defpackage :html-utils
(:use (:use
@ -927,6 +928,7 @@
:+key-boosted+ :+key-boosted+
:+key-tags-window+ :+key-tags-window+
:+key-open-attach-window+ :+key-open-attach-window+
:+key-open-message-link-window+
:+key-conversations-window+ :+key-conversations-window+
:+key-keybindings-window+ :+key-keybindings-window+
:+key-suggestions-window+ :+key-suggestions-window+
@ -1027,6 +1029,7 @@
:*send-message-keymap* :*send-message-keymap*
:*follow-requests-keymap* :*follow-requests-keymap*
:*open-attach-keymap* :*open-attach-keymap*
:*open-message-link-keymap*
:define-key :define-key
:init-keyboard-mapping :init-keyboard-mapping
:find-keymap-node :find-keymap-node
@ -1051,7 +1054,8 @@
:*follow-requests-window* :*follow-requests-window*
:*tags-window* :*tags-window*
:*conversations-window* :*conversations-window*
:*open-attach-window*)) :*open-attach-window*
:*open-message-link-window*))
(defpackage :program-events (defpackage :program-events
(:use (:use
@ -1613,10 +1617,34 @@
(:shadowing-import-from :misc :random-elt :shuffle) (:shadowing-import-from :misc :random-elt :shuffle)
(:export (:export
:open-attach-window :open-attach-window
:status-id
:refresh-view-links-window-config
:resync-rows-db :resync-rows-db
:open-attachment :open-attachment
:init)) :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 (defpackage :command-window
(:use (:use
:cl :cl
@ -1855,7 +1883,12 @@
:open-message-attach-go-up :open-message-attach-go-up
:open-message-attach-go-down :open-message-attach-go-down
:open-message-attach-perform-opening :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-up
:attach-go-down :attach-go-down
:attach-delete :attach-delete

View File

@ -353,6 +353,7 @@
keybindings-window keybindings-window
suggestions-window suggestions-window
open-attach-window open-attach-window
open-message-link-window
command-window command-window
command-separator command-separator
tree tree

View File

@ -48,3 +48,6 @@
(defparameter *open-attach-window* nil (defparameter *open-attach-window* nil
"The window that shows attachments for a message.") "The window that shows attachments for a message.")
(defparameter *open-message-link-window* nil
"The window that shows links in a message.")

View File

@ -631,3 +631,22 @@ printed in the box column by column; in the example above the results are:
box-height)) box-height))
(list columns))))) (list columns)))))
(fit))) (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)))

View File

@ -342,7 +342,9 @@ Metadata includes:
specials:*thread-window* specials:*thread-window*
:documentation "Move focus on thread window" :documentation "Move focus on thread window"
:info-change-focus-message (_ "Focus passed on threads 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:*tags-window*
specials:*send-message-window* specials:*send-message-window*
specials:*message-window* specials:*message-window*
@ -352,7 +354,9 @@ Metadata includes:
specials:*message-window* specials:*message-window*
:documentation "Move focus on message window" :documentation "Move focus on message window"
:info-change-focus-message (_ "Focus passed 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:*tags-window*
specials:*thread-window* specials:*thread-window*
specials:*send-message-window* specials:*send-message-window*
@ -363,7 +367,8 @@ Metadata includes:
specials:*send-message-window* specials:*send-message-window*
:documentation "Move focus on send message window" :documentation "Move focus on send message window"
:info-change-focus-message (_ "Focus passed 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:*conversations-window*
specials:*tags-window* specials:*tags-window*
specials:*thread-window* specials:*thread-window*
@ -374,7 +379,8 @@ Metadata includes:
specials:*follow-requests-window* specials:*follow-requests-window*
:documentation "Move focus on follow requests window" :documentation "Move focus on follow requests window"
:info-change-focus-message (_ "Focus passed 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:*conversations-window*
specials:*tags-window* specials:*tags-window*
specials:*thread-window* specials:*thread-window*
@ -385,7 +391,8 @@ Metadata includes:
specials:*tags-window* specials:*tags-window*
:documentation "Move focus on tags window" :documentation "Move focus on tags window"
:info-change-focus-message (_ "Focus passed 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:*conversations-window*
specials:*follow-requests-window* specials:*follow-requests-window*
specials:*thread-window* specials:*thread-window*
@ -395,7 +402,8 @@ Metadata includes:
specials:*conversations-window* specials:*conversations-window*
:documentation "Move focus on conversations window" :documentation "Move focus on conversations window"
:info-change-focus-message (_ "Focus passed on conversation 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:*tags-window*
specials:*follow-requests-window* specials:*follow-requests-window*
specials:*thread-window* specials:*thread-window*
@ -406,7 +414,20 @@ Metadata includes:
specials:*open-attach-window* specials:*open-attach-window*
:documentation "Move focus on open-attach window" :documentation "Move focus on open-attach window"
:info-change-focus-message (_ "Focus passed on 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* :windows-lose-focus (specials:*conversations-window*
specials:*open-attach-window*
specials:*tags-window* specials:*tags-window*
specials:*follow-requests-window* specials:*follow-requests-window*
specials:*thread-window* specials:*thread-window*
@ -822,7 +843,9 @@ Starting from the oldest toot and going back."
(push-event event))))))) (push-event event)))))))
(defun open-message-attach () (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*) (when-let* ((win specials:*thread-window*)
(selected-message (line-oriented-window:selected-row-fields win))) (selected-message (line-oriented-window:selected-row-fields win)))
(open-attach-window:init (db:row-message-status-id selected-message)) (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))) (url (line-oriented-window:normal-text selected-line)))
(open-attach-window:open-attachment url))) (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*)) (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 (defun prompt-for-username (prompt complete-function event
notify-starting-message notify-starting-message
notify-ending-message) notify-ending-message)

View File

@ -92,6 +92,7 @@
(:file "thread-window") (:file "thread-window")
(:file "message-window") (:file "message-window")
(:file "open-attach-window") (:file "open-attach-window")
(:file "open-message-link-window")
(:file "command-window") (:file "command-window")
(:file "sending-message") (:file "sending-message")
(:file "follow-requests") (:file "follow-requests")