Bridge through <gone/> chat state as unavailable presence

- Also, fix an error where we'd send a bogus presence if you sent an
  <active/> chat state.
This commit is contained in:
eta 2020-09-01 20:33:12 +01:00
parent 83d172f899
commit 51821a774f

View file

@ -1189,6 +1189,7 @@ Returns three values: avatar data (as two values), and a generalized boolean spe
((string= type "composing") :composing) ((string= type "composing") :composing)
((string= type "paused") :paused) ((string= type "paused") :paused)
((string= type "active") :available) ((string= type "active") :available)
((string= type "gone") :unavailable)
(t (return-from whatsxmpp-chat-state-handler))))) (t (return-from whatsxmpp-chat-state-handler)))))
(unless uid (unless uid
(warn "Got chat state for user that isn't registered") (warn "Got chat state for user that isn't registered")
@ -1199,7 +1200,8 @@ Returns three values: avatar data (as two values), and a generalized boolean spe
(warn "Can't send chat state, since user connection is offline") (warn "Can't send chat state, since user connection is offline")
(return-from whatsxmpp-chat-state-handler)) (return-from whatsxmpp-chat-state-handler))
(whatscl::send-presence conn presence-type (whatscl::send-presence conn presence-type
(unless (eql presence-type :active) (unless (or (eql presence-type :available)
(eql presence-type :unavailable))
wa-jid)))))) wa-jid))))))
(defun whatsxmpp-marker-handler (comp &key from to type marker-id id &allow-other-keys) (defun whatsxmpp-marker-handler (comp &key from to type marker-id id &allow-other-keys)