Don't spam the user with presences when they send us one

- I don't think sending the user a crapton of presence when they send us some is
  actually a good thing (and it's not doing any favours for my mobile data plan)
- Instead, let's let the user's server send us presence probes and reply to
  those (?)
This commit is contained in:
eta 2020-08-21 18:16:00 +01:00
parent 7506da1469
commit e151151004
1 changed files with 0 additions and 15 deletions

View File

@ -1094,9 +1094,7 @@ Returns three values: avatar data (as two values), and a generalized boolean spe
(multiple-value-bind (to-hostname to-localpart to-resource)
(parse-jid to)
(declare (ignore to-hostname))
;; (format *debug-io* "~&presence to: ~A from: ~A~%" to from)
(let* ((stripped (strip-resource from))
(conn (gethash stripped (component-whatsapps comp)))
(uid (get-user-id stripped))
(x-element (get-node-with-xmlns (child-elements stanza) +muc-ns+)))
(cond
@ -1126,19 +1124,6 @@ Returns three values: avatar data (as two values), and a generalized boolean spe
:stanza-type "presence"
:id id :to from :from to
:e e))))
((equal to-localpart "admin")
(progn
(unless uid
(return-from whatsxmpp-presence-handler))
(multiple-value-bind (admin-status admin-show)
(get-admin-status comp stripped)
(format *debug-io* "~&sending presences of everyone to ~A~%" from)
(admin-presence comp from admin-status admin-show)
(when conn
(loop
for localpart in (get-contact-localparts uid)
do (handle-wa-contact-presence comp conn stripped localpart))
(whatscl::send-presence conn :available)))))
(t nil))))))
(defun whatsxmpp-presence-probe-handler (comp &key from to id &allow-other-keys)