1
0
Fork 0

- added support for signature.

This commit is contained in:
cage 2020-06-24 19:42:05 +02:00
parent fc43ffb423
commit 9229d4dd08
5 changed files with 44 additions and 14 deletions

View File

@ -77,11 +77,13 @@ color-regexp = "_[^_]+_" #ffff00 underline
color-regexp = "/[^/]+/" #ffff00 italic
color-regexp = "⯀" green bold
color-regexp = "⯀" green bold
color-regexp = "The poll has expired" #ff00ff bold
# the signature file path relative to $HOME
# signature-file = ".signature"
# you can filter off users using regexp

View File

@ -274,3 +274,7 @@
(format stream "~%~a~%" (_ "A single choice allowed")))
(when expiredp
(format stream "~%~a~%" (_ "The poll has expired"))))))))
(defun signature ()
(when-let ((signature-file (swconf:signature-file-path)))
(format nil "-- ~%~a" (fs:slurp-file signature-file))))

View File

@ -949,6 +949,7 @@
:parse
:load-config-file
:external-editor
:signature-file-path
:vote-vertical-bar
:crypted-mark-value
:quick-help-header-colors
@ -1612,7 +1613,8 @@
:status-attachments->text
:message-original->text-body
:message-original->text-header
:poll->text))
:poll->text
:signature))
(defpackage :thread-window
(:use

View File

@ -351,6 +351,7 @@
locked
unlocked
account
signature-file
main-window
thread-window
message-window
@ -430,8 +431,21 @@
(defparameter *allowed-attachment-type* '("unknown" "image" "gifv" "video" "audio"))
(define-constant +default-signature-filename+ ".signature" :test #'string=)
;;;; interface
(defun signature-file-path ()
"Returns the filepath of the signature file, the $HOME is prepended."
(let* ((signature-file (or (access:accesses *software-configuration*
+key-signature-file+)
+default-signature-filename+))
(signature-path (fs:cat-parent-dir (fs:home-dir)
signature-file)))
(if (fs:file-exists-p signature-path)
signature-path
nil)))
(defun vote-vertical-bar ()
(or (access:accesses *software-configuration*
+key-vote-vertical-bar+)

View File

@ -835,18 +835,26 @@ Force the checking for new message in the thread the selected message belong."
(loop for line in quoted-lines do
(format stream "~a~%" line))))))
(add-body ()
(let ((temp-file (fs:temporary-file))
(reference-open-file (get-universal-time)))
(prepare-reply-body temp-file)
(croatoan:end-screen)
(os-utils:open-with-editor temp-file)
(when (and (> (fs:file-size temp-file)
0)
(> (fs:get-stat-mtime temp-file)
reference-open-file))
(let ((body (fs:slurp-file temp-file)))
(setf (sending-message:body *message-to-send*) body)
(add-subject))))))
(let ((temp-file (fs:temporary-file))
(signature (message-rendering-utils:signature)))
(when signature
(with-open-file (stream
temp-file
:direction :output
:element-type 'character
:if-exists :supersede)
(write-sequence signature stream)))
(let ((reference-open-file (get-universal-time)))
(prepare-reply-body temp-file)
(croatoan:end-screen)
(os-utils:open-with-editor temp-file)
(when (and (> (fs:file-size temp-file)
0)
(> (fs:get-stat-mtime temp-file)
reference-open-file))
(let ((body (fs:slurp-file temp-file)))
(setf (sending-message:body *message-to-send*) body)
(add-subject)))))))
(add-body)))
(defun reply-message ()