# HG changeset patch # User Goffi # Date 1486410419 -3600 # Node ID f8401024ab282193fc7f004a5109e53ee2e316f5 # Parent 6e509ee853a8a4a11084564673d8f59a99b437ea core (roster): added isPresenceAuthorised to check if an entity is authorised to see our presence diff -r 6e509ee853a8 -r f8401024ab28 src/core/xmpp.py --- a/src/core/xmpp.py Sun Feb 05 15:00:01 2017 +0100 +++ b/src/core/xmpp.py Mon Feb 06 20:46:59 2017 +0100 @@ -430,6 +430,16 @@ """Return True if jid is in roster""" return entity_jid in self._jids + def isPresenceAuthorised(self, entity_jid): + """Return True if entity is authorised to see our presence""" + import pudb + pudb.set_trace() + try: + item = self._jids[entity_jid.userhostJID()] + except KeyError: + return False + return item.subscriptionFrom + def getItems(self): """Return all items of the roster""" return self._jids.values()