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:
parent
7506da1469
commit
e151151004
15
stuff.lisp
15
stuff.lisp
|
@ -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)
|
(multiple-value-bind (to-hostname to-localpart to-resource)
|
||||||
(parse-jid to)
|
(parse-jid to)
|
||||||
(declare (ignore to-hostname))
|
(declare (ignore to-hostname))
|
||||||
;; (format *debug-io* "~&presence to: ~A from: ~A~%" to from)
|
|
||||||
(let* ((stripped (strip-resource from))
|
(let* ((stripped (strip-resource from))
|
||||||
(conn (gethash stripped (component-whatsapps comp)))
|
|
||||||
(uid (get-user-id stripped))
|
(uid (get-user-id stripped))
|
||||||
(x-element (get-node-with-xmlns (child-elements stanza) +muc-ns+)))
|
(x-element (get-node-with-xmlns (child-elements stanza) +muc-ns+)))
|
||||||
(cond
|
(cond
|
||||||
|
@ -1126,19 +1124,6 @@ Returns three values: avatar data (as two values), and a generalized boolean spe
|
||||||
:stanza-type "presence"
|
:stanza-type "presence"
|
||||||
:id id :to from :from to
|
:id id :to from :from to
|
||||||
:e e))))
|
: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))))))
|
(t nil))))))
|
||||||
|
|
||||||
(defun whatsxmpp-presence-probe-handler (comp &key from to id &allow-other-keys)
|
(defun whatsxmpp-presence-probe-handler (comp &key from to id &allow-other-keys)
|
||||||
|
|
Loading…
Reference in a new issue