Adapt WA-HANDLE-ERROR-STATUS-CODE to recent whatscl changes

- We can now differentiate fatal login errors from other types of errors. For
  non-fatal errors, we just send an informational warning message.
  (Login errors kill the connection as before.)
This commit is contained in:
eta 2020-08-01 15:53:29 +01:00
parent e4e9aa0ec1
commit b54fec4aa9

View file

@ -310,6 +310,8 @@ WhatsXMPP represents users as u440123456789 and groups as g1234-5678."
(defun wa-handle-error-status-code (comp conn jid err)
(with-wa-handler-context (comp conn jid)
(format *debug-io* "~&error-status-code for ~A: ~A~%" jid err)
(if (typep err 'whatscl::login-error)
(progn
(let ((status-code (whatscl::scerror-status-code err)))
(cond
((equal status-code 401)
@ -327,7 +329,8 @@ WhatsXMPP represents users as u440123456789 and groups as g1234-5678."
(admin-presence comp jid "Login failure" "xa")
(admin-msg comp jid (format nil "Login failure: ~A" err))))))
(admin-msg comp jid "(Disabling automatic reconnections.)")
(remhash jid (component-whatsapps comp))))
(remhash jid (component-whatsapps comp)))
(admin-msg comp jid (format nil "Warning: A non-fatal WhatsApp error has occurred.~%You should be fine to continue, but if problems persist, consider re-connecting or re-registering.~%Details: ~A" err)))))
(defun wa-handle-error (comp conn jid err bt)
(with-wa-handler-context (comp conn jid)