1
0
Fork 0

- [gopher] added notification of any error signaled when making a gopher request.

This commit is contained in:
cage 2022-10-01 17:02:46 +02:00
parent ad14de7e41
commit 2bbf092975
1 changed files with 46 additions and 45 deletions

View File

@ -228,51 +228,52 @@
port port
type type
selector))) selector)))
(cond (with-notify-errors
((gopher-parser::%line-type-dir-p type) (cond
(gemini-viewer:push-url-to-history message-win link) ((gopher-parser::%line-type-dir-p type)
(let ((data (misc:make-fresh-array 0 :type '(unsigned-int 8)))) (gemini-viewer:push-url-to-history message-win link)
(gopher-client:request host (let ((data (misc:make-fresh-array 0 :type '(unsigned-int 8))))
type (gopher-client:request host
:port port type
:selector selector :port port
:collect-fn (gopher-client:make-collect-fn data)) :selector selector
(init) :collect-fn (gopher-client:make-collect-fn data))
(ui:focus-to-gopher-window) (init)
(print-response-rows *gopher-window* (ui:focus-to-gopher-window)
(gopher-parser:parse-menu (text-utils:to-s data))) (print-response-rows *gopher-window*
(select-row *gopher-window* 0) (gopher-parser:parse-menu (text-utils:to-s data)))
(draw *gopher-window*))) (select-row *gopher-window* 0)
((gopher-parser::%line-type-index-search-p type) (draw *gopher-window*)))
(search-index-server host port selector)) ((gopher-parser::%line-type-index-search-p type)
((gopher-parser::%line-type-file-p type) (search-index-server host port selector))
(win-close *gopher-window*) ((gopher-parser::%line-type-file-p type)
(let ((data (misc:make-fresh-array 0 :type '(unsigned-int 8)))) (win-close *gopher-window*)
(gopher-client:request host (let ((data (misc:make-fresh-array 0 :type '(unsigned-int 8))))
type (gopher-client:request host
:port port type
:selector selector :port port
:collect-fn (gopher-client:make-collect-fn data)) :selector selector
(let* ((text (to-s data)) :collect-fn (gopher-client:make-collect-fn data))
(raw-lines (split-lines (gopher-parser:parse-text-file text))) (let* ((text (to-s data))
(lines (mapcar (lambda (a) (raw-lines (split-lines (gopher-parser:parse-text-file text)))
(message-window:text->rendered-lines-rows *message-window* (lines (mapcar (lambda (a)
a)) (message-window:text->rendered-lines-rows *message-window*
raw-lines))) a))
(line-oriented-window:update-all-rows *message-window* (a:flatten lines)) raw-lines)))
(draw *message-window*) (line-oriented-window:update-all-rows *message-window* (a:flatten lines))
(ui:focus-to-message-window)))) (draw *message-window*)
(t (ui:focus-to-message-window))))
(fs:with-anaphoric-temp-file (stream) (t
(gopher-client:request host (fs:with-anaphoric-temp-file (stream)
type (gopher-client:request host
:port port type
:selector selector :port port
:collect-fn (lambda (buffer) :selector selector
(write-sequence buffer stream))) :collect-fn (lambda (buffer)
(finish-output stream) (write-sequence buffer stream)))
(os-utils:open-resource-with-external-program filesystem-utils:temp-file (finish-output stream)
nil))))))) (os-utils:open-resource-with-external-program filesystem-utils:temp-file
nil))))))))
(defun open-menu-link () (defun open-menu-link ()
(a:when-let* ((win *gopher-window*) (a:when-let* ((win *gopher-window*)