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:
parent
e4e9aa0ec1
commit
b54fec4aa9
39
stuff.lisp
39
stuff.lisp
|
@ -310,24 +310,27 @@ WhatsXMPP represents users as u440123456789 and groups as g1234-5678."
|
||||||
(defun wa-handle-error-status-code (comp conn jid err)
|
(defun wa-handle-error-status-code (comp conn jid err)
|
||||||
(with-wa-handler-context (comp conn jid)
|
(with-wa-handler-context (comp conn jid)
|
||||||
(format *debug-io* "~&error-status-code for ~A: ~A~%" jid err)
|
(format *debug-io* "~&error-status-code for ~A: ~A~%" jid err)
|
||||||
(let ((status-code (whatscl::scerror-status-code err)))
|
(if (typep err 'whatscl::login-error)
|
||||||
(cond
|
(progn
|
||||||
((equal status-code 401)
|
(let ((status-code (whatscl::scerror-status-code err)))
|
||||||
(progn
|
(cond
|
||||||
(admin-msg comp jid "Error: The WhatsApp Web connection was removed from your device! You'll need to scan the QR code again.")
|
((equal status-code 401)
|
||||||
(admin-presence comp jid "Connection removed" "xa")
|
(progn
|
||||||
(update-session-data jid "")))
|
(admin-msg comp jid "Error: The WhatsApp Web connection was removed from your device! You'll need to scan the QR code again.")
|
||||||
((equal status-code 403)
|
(admin-presence comp jid "Connection removed" "xa")
|
||||||
(progn
|
(update-session-data jid "")))
|
||||||
(admin-msg comp jid "Error: WhatsApp Web denied access. You may have violated the Terms of Service.")
|
((equal status-code 403)
|
||||||
(admin-presence comp jid "Access denied" "xa")
|
(progn
|
||||||
(update-session-data jid "")))
|
(admin-msg comp jid "Error: WhatsApp Web denied access. You may have violated the Terms of Service.")
|
||||||
(t
|
(admin-presence comp jid "Access denied" "xa")
|
||||||
(progn
|
(update-session-data jid "")))
|
||||||
(admin-presence comp jid "Login failure" "xa")
|
(t
|
||||||
(admin-msg comp jid (format nil "Login failure: ~A" err))))))
|
(progn
|
||||||
(admin-msg comp jid "(Disabling automatic reconnections.)")
|
(admin-presence comp jid "Login failure" "xa")
|
||||||
(remhash jid (component-whatsapps comp))))
|
(admin-msg comp jid (format nil "Login failure: ~A" err))))))
|
||||||
|
(admin-msg comp jid "(Disabling automatic reconnections.)")
|
||||||
|
(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)
|
(defun wa-handle-error (comp conn jid err bt)
|
||||||
(with-wa-handler-context (comp conn jid)
|
(with-wa-handler-context (comp conn jid)
|
||||||
|
|
Loading…
Reference in a new issue