Make WS messages less invasive

This commit is contained in:
Miguel de la Cruz 2022-06-01 11:59:26 +02:00
parent 3a8d4b661c
commit 34fa91691c

View file

@ -105,7 +105,7 @@ if the user is not present"
:on-message (lambda (ws frame) :on-message (lambda (ws frame)
(let* ((text (websocket-frame-text frame)) (let* ((text (websocket-frame-text frame))
(msg (json-parse-string text))) (msg (json-parse-string text)))
(message "INCOMING> %s" msg))) (lwarn 'mattermost :debug (format "INCOMING> %s" msg))))
:on-close (lambda (ws) :on-close (lambda (ws)
(lwarn 'mattermost :error "websocket connection closed")))) (lwarn 'mattermost :error "websocket connection closed"))))
@ -215,13 +215,14 @@ user to check their status and select between them")
(if (string-empty-p mattermost-host) (if (string-empty-p mattermost-host)
;; ToDo: throw error here ;; ToDo: throw error here
(lwarn 'mattermost :error "`mattermost-host` cannot be empty")) (lwarn 'mattermost :error "`mattermost-host` cannot be empty"))
(mattermost-close) (mattermost-disconnect)
(let ((password (mattermost-read-password))) (let ((password (mattermost-read-password)))
(mattermost-login mattermost-login-id password)) (mattermost-login mattermost-login-id password))
(mattermost-show-root)) (mattermost-show-root))
(defun mattermost-close () (defun mattermost-disconnect ()
"Closes the connection with the Mattermost server" "Closes the connection with the Mattermost server"
(interactive)
(unless (null mattermost-websocket) (unless (null mattermost-websocket)
(websocket-close mattermost-websocket)) (websocket-close mattermost-websocket))
(setq mattermost-token nil (setq mattermost-token nil