# HG changeset patch # User Goffi # Date 1486410456 -3600 # Node ID f79935f411251e2e2a0c0f5403038c7dfb94e529 # Parent f8401024ab282193fc7f004a5109e53ee2e316f5 plugin XEP-0184: check if entity is allowed to see our presence before returning receipt diff -r f8401024ab28 -r f79935f41125 src/plugins/plugin_xep_0184.py --- a/src/plugins/plugin_xep_0184.py Mon Feb 06 20:46:59 2017 +0100 +++ b/src/plugins/plugin_xep_0184.py Mon Feb 06 20:47:36 2017 +0100 @@ -19,7 +19,7 @@ from sat.core.i18n import _ from sat.core.log import getLogger from twisted.internet import reactor -from twisted.words.protocols.jabber import xmlstream +from twisted.words.protocols.jabber import xmlstream, jid from twisted.words.xish import domish log = getLogger(__name__) @@ -121,8 +121,9 @@ """This method is called on message delivery receipts **request** (XEP-0184 #7) @param msg_elt: message element @param client: %(doc_client)s""" + from_jid = jid.JID(msg_elt['from']) - if self._isActif(client.profile): + if self._isActif(client.profile) and client.roster.isPresenceAuthorised(from_jid): received_elt_ret = domish.Element((NS_MESSAGE_DELIVERY_RECEIPTS, 'received')) received_elt_ret["id"] = msg_elt["id"]