From 7865ae7f9981d2efab4b119fd7c6d650b4122f9e Mon Sep 17 00:00:00 2001 From: Goffi Date: Mon, 6 Feb 2017 20:46:59 +0100 Subject: [PATCH] core (roster): added isPresenceAuthorised to check if an entity is authorised to see our presence --- src/core/xmpp.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/xmpp.py b/src/core/xmpp.py index 2eb48235..cd80ad24 100644 --- a/src/core/xmpp.py +++ b/src/core/xmpp.py @@ -430,6 +430,16 @@ class SatRosterProtocol(xmppim.RosterClientProtocol): """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()