mirror of https://codeberg.org/cage/tinmop/
- 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:
parent
41a4787f16
commit
66c7adab15
|
@ -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))))
|
||||||
|
|
|
@ -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)
|
||||||
|
@ -493,45 +494,47 @@
|
||||||
(setf support-file (fs:temporary-file :extension extension)))
|
(setf support-file (fs:temporary-file :extension extension)))
|
||||||
(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
|
||||||
(opening-partial-contents-p (read-so-far)
|
(< read-so-far (length buffer))))
|
||||||
(let ((buffer-size (swconf:link-regex->program-to-use-buffer-size path)))
|
(opening-partial-contents-p (read-so-far)
|
||||||
(if buffer-size
|
(let ((buffer-size (swconf:link-regex->program-to-use-buffer-size path)))
|
||||||
(> read-so-far buffer-size)
|
(if buffer-size
|
||||||
(> read-so-far swconf:+buffer-minimum-size-to-open+))))
|
(> read-so-far buffer-size)
|
||||||
(%fill-buffer ()
|
(> read-so-far swconf:+buffer-minimum-size-to-open+))))
|
||||||
(declare (optimize (debug 0) (speed 3)))
|
(%fill-buffer ()
|
||||||
(when (downloading-allowed-p wrapper-object)
|
(declare (optimize (debug 0) (speed 3)))
|
||||||
(multiple-value-bind (program-exists y wait-for-download)
|
(when (downloading-allowed-p wrapper-object)
|
||||||
(swconf:link-regex->program-to-use support-file)
|
(multiple-value-bind (program-exists y wait-for-download)
|
||||||
(declare (ignore y))
|
(swconf:link-regex->program-to-use support-file)
|
||||||
(multiple-value-bind (buffer read-so-far)
|
(declare (ignore y))
|
||||||
(read-array download-stream +read-buffer-size+)
|
(multiple-value-bind (buffer read-so-far)
|
||||||
(declare ((vector (unsigned-byte 8)) buffer))
|
(with-print-error-message
|
||||||
(declare (fixnum read-so-far))
|
(read-array download-stream +read-buffer-size+))
|
||||||
(increment-bytes-count wrapper-object read-so-far)
|
(declare ((vector (unsigned-byte 8)) buffer))
|
||||||
(if (download-completed-p buffer read-so-far)
|
(declare (fixnum read-so-far))
|
||||||
(progn
|
(increment-bytes-count wrapper-object read-so-far)
|
||||||
(write-sequence buffer file-stream :start 0 :end read-so-far)
|
(if (download-completed-p buffer read-so-far)
|
||||||
(force-output file-stream)
|
(progn
|
||||||
(setf (stream-status wrapper-object) :completed)
|
(write-sequence buffer file-stream :start 0 :end read-so-far)
|
||||||
(gemini-client:close-ssl-socket socket)
|
(force-output file-stream)
|
||||||
(when (or wait-for-download
|
(setf (stream-status wrapper-object) :completed)
|
||||||
partial-content-not-opened)
|
(gemini-client:close-ssl-socket socket)
|
||||||
(os-utils:open-resource-with-external-program support-file
|
(when (or wait-for-download
|
||||||
nil)))
|
partial-content-not-opened)
|
||||||
(progn
|
(os-utils:open-resource-with-external-program support-file
|
||||||
(write-sequence buffer file-stream)
|
nil)))
|
||||||
(when (and partial-content-not-opened
|
(progn
|
||||||
program-exists
|
(write-sequence buffer file-stream)
|
||||||
(not wait-for-download)
|
(when (and partial-content-not-opened
|
||||||
(opening-partial-contents-p (octect-count wrapper-object)))
|
program-exists
|
||||||
(setf partial-content-not-opened nil)
|
(not wait-for-download)
|
||||||
(os-utils:open-resource-with-external-program support-file
|
(opening-partial-contents-p (octect-count wrapper-object)))
|
||||||
nil))
|
(setf partial-content-not-opened nil)
|
||||||
(%fill-buffer))))))))
|
(os-utils:open-resource-with-external-program support-file
|
||||||
(%fill-buffer)))))))
|
nil))
|
||||||
|
(%fill-buffer))))))))
|
||||||
|
(%fill-buffer)))))))
|
||||||
|
|
||||||
(defun request-success-dispatched-clrs (enqueue)
|
(defun request-success-dispatched-clrs (enqueue)
|
||||||
(lambda (status code-description meta response socket iri parsed-iri)
|
(lambda (status code-description meta response socket iri parsed-iri)
|
||||||
|
|
|
@ -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
|
||||||
(tooter:kind notification)
|
"type: ~a from ~a"
|
||||||
(tooter:account-name (tooter:account notification))))
|
(tooter:kind 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
|
||||||
|
|
|
@ -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)))
|
||||||
|
|
Loading…
Reference in New Issue