1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2025-02-17 08:10:36 +01:00

- prevented deletion of mentions when the program is in debug-mode;

- [gemini] prevented crash when and error getting data from TLS socket;
- prevented crash when dumping mentions.
This commit is contained in:
cage 2022-11-25 18:32:13 +01:00
parent 41a4787f16
commit 66c7adab15
4 changed files with 54 additions and 45 deletions

View File

@ -756,6 +756,7 @@ the latest 15 mentions)."
mentions-so-far)) mentions-so-far))
(defun update-mentions-folder (&key (delete-mentions-on-server t)) (defun update-mentions-folder (&key (delete-mentions-on-server t))
(declare (ignorable delete-mentions-on-server)) ; because of the render macro '#-debug-mode'
(let ((trees '())) (let ((trees '()))
(when-let* ((all-mentions (all-mentions)) (when-let* ((all-mentions (all-mentions))
(statuses (loop for mention in all-mentions (statuses (loop for mention in all-mentions
@ -773,6 +774,7 @@ the latest 15 mentions)."
:folder db:+mentions-status-folder+ :folder db:+mentions-status-folder+
:localp t :localp t
:min-id nil))) :min-id nil)))
#-debug-mode
(when delete-mentions-on-server (when delete-mentions-on-server
(loop for mention in all-mentions do (loop for mention in all-mentions do
(delete-notification (tooter:id mention)))) (delete-notification (tooter:id mention))))

View File

@ -429,7 +429,8 @@
(loop (loop
named download-loop named download-loop
for ct from 0 for ct from 0
for line-as-array = (read-line-into-array download-stream) for line-as-array = (with-print-error-message
(read-line-into-array download-stream))
while line-as-array do while line-as-array do
(gemini-client:debug-gemini "[stream] gemini file stream raw data line : ~a" (gemini-client:debug-gemini "[stream] gemini file stream raw data line : ~a"
line-as-array) line-as-array)
@ -494,7 +495,8 @@
(with-open-support-file (file-stream support-file) (with-open-support-file (file-stream support-file)
(let ((partial-content-not-opened t)) (let ((partial-content-not-opened t))
(labels ((download-completed-p (buffer read-so-far) (labels ((download-completed-p (buffer read-so-far)
(< read-so-far (length buffer))) (and buffer
(< read-so-far (length buffer))))
(opening-partial-contents-p (read-so-far) (opening-partial-contents-p (read-so-far)
(let ((buffer-size (swconf:link-regex->program-to-use-buffer-size path))) (let ((buffer-size (swconf:link-regex->program-to-use-buffer-size path)))
(if buffer-size (if buffer-size
@ -507,7 +509,8 @@
(swconf:link-regex->program-to-use support-file) (swconf:link-regex->program-to-use support-file)
(declare (ignore y)) (declare (ignore y))
(multiple-value-bind (buffer read-so-far) (multiple-value-bind (buffer read-so-far)
(read-array download-stream +read-buffer-size+) (with-print-error-message
(read-array download-stream +read-buffer-size+))
(declare ((vector (unsigned-byte 8)) buffer)) (declare ((vector (unsigned-byte 8)) buffer))
(declare (fixnum read-so-far)) (declare (fixnum read-so-far))
(increment-bytes-count wrapper-object read-so-far) (increment-bytes-count wrapper-object read-so-far)

View File

@ -1690,9 +1690,11 @@
(message-window specials:*message-window*)) (message-window specials:*message-window*))
(if mentions (if mentions
(labels ((print-mention (notification) (labels ((print-mention (notification)
(format nil "type: ~a from ~a" (let ((raw-text (format nil
"type: ~a from ~a"
(tooter:kind notification) (tooter:kind notification)
(tooter:account-name (tooter:account notification)))) (tooter:account-name (tooter:account notification)))))
(tui:make-tui-string raw-text)))
(make-rows (mentions) (make-rows (mentions)
(mapcar (lambda (mention) (mapcar (lambda (mention)
(make-instance 'line-oriented-window:line (make-instance 'line-oriented-window:line

View File

@ -508,7 +508,8 @@ latter has a length equals to `total-size'"))
(error (e) (error (e)
(ui:notify (format nil (_ "Error: ~a") e) (ui:notify (format nil (_ "Error: ~a") e)
:life (* (swconf:config-notification-life) 5) :life (* (swconf:config-notification-life) 5)
:as-error t)))) :as-error t)
nil)))
(defmacro with-print-error-message (&body body) (defmacro with-print-error-message (&body body)
#+debug-mode `(progn ,@body) #+debug-mode `(progn ,@body)
@ -516,4 +517,5 @@ latter has a length equals to `total-size'"))
(progn (progn
,@body) ,@body)
(error (e) (error (e)
(ui:error-message (format nil (_ "Error: ~a") e))))) (ui:error-message (format nil (_ "Error: ~a") e))
nil)))